Review: Needs Fixing

I am not convinced by the refactoring, it makes the method very complex.
Moreover, differentiating both "onchange" actions by the context is bad 
practice.

I found an issue in method product_id_change: the variable 'res' is sometimes 
used as a field-value dictionary, sometimes as an action result {'value': ..., 
'domain': ..., 'warning': ...}.

Couldn't you do an extra step in refactoring?  I prefer having two separate 
methods 'onchange_product_id' and 'onchange_product_uom' that use extra methods 
for common subtasks:

onchange_product_id should, if product_id is given:
 - check for the presence of partner_id and pricelist_id
 - set a domain on product_uom
 - check that uom and product uom belong to the same category
 - determine name and notes based on product
 - determine product_qty and date_planned based on seller info
 - determine price_unit and taxes_id

onchange_product_uom should, if uom_id is given:
 - check for the presence of partner_id and pricelist_id
 - check that uom and product uom belong to the same category
 - determine price_unit and taxes_id

Thanks,
Raphael


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-clean-yml-purchase-uom-hmo/+merge/87737
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-clean-yml-purchase-uom-hmo.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to