Hiral Patel (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-1095986-hip into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) Related bugs: Bug #1095986 in OpenERP Addons: "[OpenERP V7/Trunk] Change unit on account.invoice.line error (traceback)" https://bugs.launchpad.net/openobject-addons/+bug/1095986 For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1095986-hip/+merge/142239 -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1095986-hip/+merge/142239 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-1095986-hip.
=== modified file 'account/account_invoice.py' --- account/account_invoice.py 2012-12-21 16:48:08 +0000 +++ account/account_invoice.py 2013-01-08 05:53:53 +0000 @@ -1485,10 +1485,12 @@ res_final['value']['price_unit'] = new_price if result['uos_id'] != res.uom_id.id: - selected_uom = self.pool.get('product.uom_id').browse(cr, uid, result['uos_id'], context=context) + selected_uom = self.pool.get('product.uom').browse(cr, uid, result['uos_id'], context=context) if res.uom_id.category_id.id == selected_uom.category_id.id: - new_price = res_final['value']['price_unit'] * uom_id.factor_inv + new_price = res_final['value']['price_unit'] * selected_uom.factor_inv res_final['value']['price_unit'] = new_price + else: + res_final['value']['uos_id'] = res.uom_id.id return res_final def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): === modified file 'product_visible_discount/product_visible_discount.py' --- product_visible_discount/product_visible_discount.py 2012-12-06 14:56:32 +0000 +++ product_visible_discount/product_visible_discount.py 2013-01-08 05:53:53 +0000 @@ -157,6 +157,11 @@ discount=(real_price-price_unit) / real_price * 100 result['price_unit'] = real_price result['discount'] = discount + default_uom = product.uom_id and product.uom_id.id + selected_uom = self.pool.get('product.uom').browse(cr, uid, res['value']['uos_id'], context=context) + if res['value']['uos_id'] != default_uom: + new_price = real_price * selected_uom.factor_inv + result['price_unit'] = new_price else: result['discount']=0.0 return res
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp