[FIX] uom compare

bzr revid: jco@openerp.com-20140226112342-n702mbth1wfv4e7s
This commit is contained in:
Josse Colpaert 2014-02-26 12:23:42 +01:00
parent 043e4eefc9
commit 39c5e97588
2 changed files with 3 additions and 3 deletions

View File

@ -4,4 +4,4 @@
I duplicate order.
-
!python {model: purchase.order}: |
self.copy(cr, uid, ref('purchase_order_1'), context)
self.copy(cr, uid, ref('purchase_order_1'), context)

View File

@ -1598,12 +1598,12 @@ class stock_move(osv.osv):
for move in self.browse(cr, uid, ids, context=context):
#Check UoM in meantime
if vals.get('product_uom') or vals.get('product_id'):
product_uom = move.product_uom
product_uom = move.product_id.uom_id
move_uom = move.product_uom
if vals.get('product_uom'):
move_uom = self.pool.get('product.uom').browse(cr, uid, vals['product_uom'], context=context)
if vals.get('product_id'):
product_uom = self.pool.get('product.product').browse(cr, uid, vals['product_id'], context=context)
product_uom = self.pool.get('product.product').browse(cr, uid, vals['product_id'], context=context).uom_id
if move_uom.category_id.id != product_uom.category_id.id:
raise osv.except_osv(_('Operation Forbidden'),
_('Category of Product UoM must be the same as the category of the UoM of the move'))