Atik Agewan(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-855356-aag into
lp:openobject-addons.
Requested reviews:
Rucha (Open ERP) (rpa-openerp)
Related bugs:
Bug #855356 in OpenERP Addons: "Incorrect weight calculation in using
different UOM"
https://bugs.launchpad.net/openobject-addons/+bug/855356
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-855356-aag/+merge/76936
Hello,
Product:weight calculation is Done Correct when using different UOM of Same
Category
Thanks
Atik
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-855356-aag/+merge/76936
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-855356-aag.
=== modified file 'product/product.py'
--- product/product.py 2011-09-25 22:15:43 +0000
+++ product/product.py 2011-09-26 06:10:23 +0000
@@ -502,13 +502,24 @@
return super(product_product, self).unlink(cr, uid, unlink_ids, context=context)
def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id):
+ val = {}
+ browse_obj = self.browse(cursor, user, ids)[0]
+ old_uom = browse_obj.uom_id.id
if uom_id and uom_po_id:
uom_obj=self.pool.get('product.uom')
uom=uom_obj.browse(cursor,user,[uom_id])[0]
+ old_uom=uom_obj.browse(cursor,user,[old_uom])[0]
uom_po=uom_obj.browse(cursor,user,[uom_po_id])[0]
if uom.category_id.id != uom_po.category_id.id:
- return {'value': {'uom_po_id': uom_id}}
- return False
+ val['uom_po_id'] = uom_id
+ if old_uom.category_id.id == uom.category_id.id:
+ if browse_obj.weight != 0.0:
+ weight = (browse_obj.weight * uom.factor_inv)/old_uom.factor_inv
+ val['weight'] = weight
+ if browse_obj.weight_net != 0.0:
+ weight_net = (browse_obj.weight_net * uom.factor_inv)/old_uom.factor_inv
+ val['weight_net'] = weight_net
+ return {'value': val}
def _check_ean_key(self, cr, uid, ids, context=None):
for product in self.browse(cr, uid, ids, context=context):
_______________________________________________
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