← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-751222-ron into lp:openobject-addons

 

Rohan Nayani(openerp) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-751222-ron into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #751222 in OpenERP Addons: "[6.0 - trunk] partial stock move wizard bugs : uom, new lines, production lot attrs"
  https://bugs.launchpad.net/openobject-addons/+bug/751222

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-751222-ron/+merge/56933

https://launchpad.net/bugs/751222
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-751222-ron/+merge/56933
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-751222-ron.
=== modified file 'stock/stock.py'
--- stock/stock.py	2011-04-07 11:40:14 +0000
+++ stock/stock.py	2011-04-08 13:31:33 +0000
@@ -1180,7 +1180,6 @@
                     too_few.append(move)
                 else:
                     too_many.append(move)
-
                 # Average price computation
                 if (pick.type == 'in') and (move.product_id.cost_method == 'average'):
                     product = product_obj.browse(cr, uid, move.product_id.id)
@@ -1233,6 +1232,7 @@
                             'state': 'assigned',
                             'move_dest_id': False,
                             'price_unit': move.price_unit,
+                            'product_uom':product_uom,
                     }
                     prodlot_id = prodlot_ids[move.id]
                     if prodlot_id:
@@ -1248,13 +1248,16 @@
             if new_picking:
                 move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking})
             for move in complete:
+                defaults = {'product_uom': product_uom}
                 if prodlot_ids.get(move.id):
-                    move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]})
+                    defaults.update({'prodlot_id': prodlot_ids[move.id]})
+                move_obj.write(cr, uid, move.id, defaults)
             for move in too_many:
                 product_qty = move_product_qty[move.id]
                 defaults = {
                     'product_qty' : product_qty,
                     'product_uos_qty': product_qty, #TODO: put correct uos_qty
+                    'product_uom': product_uom
                 }
                 prodlot_id = prodlot_ids.get(move.id)
                 if prodlot_ids.get(move.id):

=== modified file 'stock/wizard/stock_partial_move.py'
--- stock/wizard/stock_partial_move.py	2011-01-17 08:00:48 +0000
+++ stock/wizard/stock_partial_move.py	2011-04-08 13:31:33 +0000
@@ -28,7 +28,7 @@
     _name = "stock.move.memory.out"
     _rec_name = 'product_id'
     _columns = {
-        'product_id' : fields.many2one('product.product', string="Product", required=True),
+        'product_id' : fields.many2one('product.product', string="Product", required=True, readonly=True),
         'quantity' : fields.float("Quantity", required=True),
         'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),
         'prodlot_id' : fields.many2one('stock.production.lot', 'Production Lot'),

=== modified file 'stock/wizard/stock_partial_picking.py'
--- stock/wizard/stock_partial_picking.py	2011-03-15 13:27:26 +0000
+++ stock/wizard/stock_partial_picking.py	2011-04-08 13:31:33 +0000
@@ -154,6 +154,8 @@
             moves_list = picking_type == 'in' and partial.product_moves_in or partial.product_moves_out
 
             for move in moves_list:
+                if move.product_uom.category_id.id <> move.product_id.uom_id.category_id.id:
+                    raise osv.except_osv(_('Error !'), _('Product UoM category %s must be same with  Product Default UoM Category %s!.') % (move.product_uom.category_id.name,move.product_id.uom_id.category_id.name,))
                 partial_datas['move%s' % (move.move_id.id)] = {
                     'product_id': move.id, 
                     'product_qty': move.quantity,