← 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/57112

https://bugs.launchpad.net/openobject-addons/+bug/751222
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-751222-ron/+merge/57112
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-11 06:52:26 +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-11 06:52:26 +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'),
@@ -36,6 +36,7 @@
         'wizard_id' : fields.many2one('stock.partial.move', string="Wizard"),
         'cost' : fields.float("Cost", help="Unit Cost for this product line"),
         'currency' : fields.many2one('res.currency', string="Currency", help="Currency in which Unit cost is expressed"),
+        'tracking': fields.related('product_id', 'track_production', type='boolean', relation='product.product', string='Tracking'),
     }
     
 class stock_partial_move_memory_in(osv.osv_memory):

=== modified file 'stock/wizard/stock_partial_move_view.xml'
--- stock/wizard/stock_partial_move_view.xml	2011-01-14 15:01:33 +0000
+++ stock/wizard/stock_partial_move_view.xml	2011-04-11 06:52:26 +0000
@@ -30,7 +30,8 @@
                     <field name="product_id" />
                     <field name="quantity" />
                     <field name="product_uom" />
-                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" groups="base.group_extended" />
+                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}" groups="base.group_extended" />
+                    <field name="tracking" invisible="1"/>
                     <field name="cost" />
                     <field name="currency" />
                 </tree>
@@ -46,7 +47,8 @@
                     <field name="product_id" />
                     <field name="quantity" />
                     <field name="product_uom" />
-                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" groups="base.group_extended" />
+                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}" groups="base.group_extended" />
+                    <field name="tracking" invisible="1"/>
                     <field name="cost" />
                     <field name="currency" />
                  </form>
@@ -62,7 +64,8 @@
                     <field name="product_id" />
                     <field name="quantity" />
                     <field name="product_uom" />
-                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]"  groups="base.group_extended" />
+                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}" groups="base.group_extended" />
+                    <field name="tracking" invisible="1"/>
                 </tree>
             </field>
         </record>
@@ -76,7 +79,8 @@
                     <field name="product_id" />
                     <field name="quantity" />
                     <field name="product_uom" />
-                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" groups="base.group_extended" />
+                    <field name="prodlot_id" domain="[('product_id', '=', product_id)]" attrs="{'required':[('tracking','=',True)]}" groups="base.group_extended" />
+                    <field name="tracking" invisible="1"/>
                 </form>
             </field>
         </record>  

=== 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-11 06:52:26 +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, 


Follow ups