← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/6.0-bug-700928-jvo into lp:openobject-addons/6.0

 

Jay Vora (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-bug-700928-jvo into lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #700928 in OpenERP Addons: "Validation production lot in inventory"
  https://bugs.launchpad.net/openobject-addons/+bug/700928

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-700928-jvo/+merge/55334
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-700928-jvo/+merge/55334
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-bug-700928-jvo.
=== modified file 'stock/stock.py'
--- stock/stock.py	2011-03-07 09:52:46 +0000
+++ stock/stock.py	2011-03-29 13:21:36 +0000
@@ -2636,6 +2636,7 @@
         'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True, select=True, readonly=True),
         'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
         'state': fields.related('inventory_id','state',type='char',string='State',readonly=True),
+        'tracking': fields.dummy(string='Tracking', type='boolean'),
     }
 
     def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False, to_date=False):
@@ -2646,12 +2647,11 @@
         @return:  Dictionary of changed values
         """
         if not product:
-            return {}
-        if not uom:
-            prod = self.pool.get('product.product').browse(cr, uid, [product], {'uom': uom})[0]
-            uom = prod.uom_id.id
+            return {'product_qty': 0.0, 'product_uom': False, 'tracking': False}
+        obj_product = self.pool.get('product.product').browse(cr, uid, product)
+        uom = uom or obj_product.uom_id.id
         amount = self.pool.get('stock.location')._product_get(cr, uid, location_id, [product], {'uom': uom, 'to_date': to_date})[product]
-        result = {'product_qty': amount, 'product_uom': uom}
+        result = {'product_qty': amount, 'product_uom': uom, 'tracking': obj_product.track_production}
         return {'value': result}
 
 stock_inventory_line()

=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml	2011-01-18 17:14:00 +0000
+++ stock/stock_view.xml	2011-03-29 13:21:36 +0000
@@ -58,6 +58,7 @@
             <field name="arch" type="xml">
                 <form string="Stock Inventory Lines">
                     <field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" select="1" domain="[('type','&lt;&gt;','service')]"/>
+                    <field name="tracking" invisible="1" />
                     <field name="product_qty"/>
                     <field name="product_uom"/>
                     <field name="prod_lot_id" groups="base.group_extended"/>
@@ -118,6 +119,7 @@
                             <tree string="Products" editable="bottom">
                                 <field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
                                 <field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"  domain="[('type','&lt;&gt;','service')]"/>
+                                <field name="tracking" invisible="1" />
                                 <field name="product_qty"/>
                                 <field name="product_uom"/>
                                 <field name="prod_lot_id" groups="base.group_extended"/>
@@ -130,6 +132,7 @@
                                 <field domain="[('usage','=','internal')]" name="location_id"/>
                                 <newline/>
                                 <field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"  domain="[('type','&lt;&gt;','service')]"/>
+                                <field name="tracking" invisible="1" />
                                 <field name="product_qty"/>
                                 <field name="product_uom"/>
                                 <group colspan="2" col="4">


Follow ups