Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-production_lot-on-tracking-rha into 
lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-production_lot-on-tracking-rha/+merge/68651

Set production lot field as required while product's tracking is true.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-production_lot-on-tracking-rha/+merge/68651
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-production_lot-on-tracking-rha.
=== modified file 'stock/wizard/stock_partial_move.py'
--- stock/wizard/stock_partial_move.py	2011-06-29 10:41:59 +0000
+++ stock/wizard/stock_partial_move.py	2011-07-21 10:06:03 +0000
@@ -25,6 +25,17 @@
 
 
 class stock_partial_move_memory_out(osv.osv_memory):
+    
+    def _tracking(self, cursor, user, ids, name, arg, context=None):
+        res = {}
+        for tracklot in self.browse(cursor, user, ids, context=context):
+            track = False
+            if (tracklot.move_id.picking_id.type == 'in' and tracklot.product_id.track_incoming == True) or \
+                (tracklot.move_id.picking_id.type == 'out' and tracklot.product_id.track_outgoing == True):
+                track = True
+            res[tracklot.id] = track
+        return res
+    
     _name = "stock.move.memory.out"
     _rec_name = 'product_id'
     _columns = {
@@ -36,6 +47,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"),
+        'track': fields.function(_tracking, method=True, string='Tracking', type='boolean'),
     }
     
 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-07-21 10:06:03 +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':[('track','=',True)]}" groups="base.group_extended" />
+                    <field name="track" 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':[('track','=',True)]}" groups="base.group_extended" />
+                    <field name="track" 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':[('track','=',True)]}" groups="base.group_extended" />
+                    <field name="track" 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':[('track','=',True)]}" groups="base.group_extended" />
+                    <field name="track" invisible="1"/>
                 </form>
             </field>
         </record>  

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to