← Back to team overview

avanzosc team mailing list archive

[Merge] lp:~gkliska/avanzosc/mrp-6.1_kgb_fix into lp:avanzosc/mrp-6.1

 

Goran Kliska has proposed merging lp:~gkliska/avanzosc/mrp-6.1_kgb_fix into lp:avanzosc/mrp-6.1.

Requested reviews:
  Daniel Campos (Avanzosc) (dani-ds)

For more details, see:
https://code.launchpad.net/~gkliska/avanzosc/mrp-6.1_kgb_fix/+merge/176377

Security, UOM from BOM, some PEP8 readability, String concat(UTF8 errors), dependency on sale,
if product.product_uom.name == 'PCE' => if product.product_uom.rounding == 1.0
Not sure about action_confirm() on production order changes?
Need to remove # KGB comments
-- 
https://code.launchpad.net/~gkliska/avanzosc/mrp-6.1_kgb_fix/+merge/176377
Your team Avanzosc Developers is subscribed to branch lp:avanzosc/mrp-6.1.
=== modified file 'mrp_manufacturing_cost/__openerp__.py'
--- mrp_manufacturing_cost/__openerp__.py	2013-06-21 12:35:14 +0000
+++ mrp_manufacturing_cost/__openerp__.py	2013-07-23 13:13:30 +0000
@@ -35,7 +35,7 @@
 	],
 	"init_xml" : [],
 	"update_xml" : [ 
-		#'security/ir.model.access.csv',
+		'security/ir.model.access.csv',
 		'wizard/final_cost_view.xml',
 		'wizard/wc_view.xml',
 		'wizard/users_view.xml',

=== modified file 'mrp_manufacturing_cost/cost.py'
--- mrp_manufacturing_cost/cost.py	2012-10-15 09:01:48 +0000
+++ mrp_manufacturing_cost/cost.py	2013-07-23 13:13:30 +0000
@@ -25,42 +25,42 @@
 from datetime import datetime
 
 class production_opert_users(osv.osv):
-    _name = 'production.opert.users'    
+    _name = 'production.opert.users'
     _columns = {
-                'name':fields.char('Name', size=54), 
-                'user' :fields.many2one('res.users','Operator'),
-                'production':fields.many2one('mrp.production', 'Production'),
-                'op':fields.many2one('mrp.production.operation', 'Operation'),                
-                'ops_times' : fields.one2many('mrp.ops.cost', 'wuser', 'Production Operations'),              
+                'name': fields.char('Name', size=54),
+                'user': fields.many2one('res.users','Operator'),
+                'production': fields.many2one('mrp.production', 'Production'),
+                'op': fields.many2one('mrp.production.operation', 'Operation'),
+                'ops_times': fields.one2many('mrp.ops.cost', 'wuser', 'Production Operations'),
         }
-    
-    
+
+
 production_opert_users()
 
+
 class mrp_production_users(osv.osv):
     _inherit = 'mrp.production.users'
-    _name = 'mrp.production.users'    
-    
+    _name = 'mrp.production.users'
+
     def delete_it(self, cr, uid, ids, context=None):  
-         obj = self.browse(cr, uid, ids, context=context)
-         for aux in obj:
-             prod_us_op_search = self.pool.get('mrp.ops.cost').search(cr, uid,[('user', '=', aux.name.id ),('operation','=',aux.op.id)])
-              
-         if prod_us_op_search:
-             raise osv.except_osv(_('The operator can not be deleted, has hours charged.'), _(aux.name.name))
-         else:
-             self.unlink(cr, uid,ids, context=context)
-         return False
-     
-     
+        obj = self.browse(cr, uid, ids, context=context)
+        for aux in obj:
+            prod_us_op_search = self.pool.get('mrp.ops.cost').search(cr, uid,[('user', '=', aux.name.id ),('operation','=',aux.op.id)])
+
+        if prod_us_op_search:
+            raise osv.except_osv(_('The operator can not be deleted, has hours charged.'), _(aux.name.name))
+        else:
+            self.unlink(cr, uid,ids, context=context)
+        return False
 mrp_production_users()
 
+
 class mrp_ops_cost(osv.osv):
     """
     Operators cost
     """
-    _name = 'mrp.ops.cost'    
-    
+    _name = 'mrp.ops.cost'
+
     def create(self, cr, uid, data, context=None):
         if 'production' in data:
             op = self.pool.get('mrp.production').browse(cr, uid, data['production'])
@@ -71,9 +71,8 @@
             op.write( values),
 
         return super(mrp_ops_cost, self).create(cr, uid, data, context)
-    
-    _columns = { 
-          
+
+    _columns = {
           'user':fields.many2one('res.users','Operator'),
           'production':fields.many2one('mrp.production','Production'),
           'operation':fields.many2one('mrp.production.operation', 'Operation'),
@@ -85,12 +84,13 @@
      }
 mrp_ops_cost()
 
+
 class mrp_wc_cost(osv.osv):
     """
     Work center cost
     """
-    _name = 'mrp.wc.cost'    
-    
+    _name = 'mrp.wc.cost'
+
     def create(self, cr, uid, data, context=None):
         if 'production' in data:
             op = self.pool.get('mrp.production').browse(cr, uid, data['production'])
@@ -101,36 +101,34 @@
             op.write(values),
 
         return super(mrp_wc_cost, self).create(cr, uid, data, context)
-    
-    _columns = { 
-          
+
+    _columns = {
           'wc':fields.many2one('mrp.workcenter','Work center'),
           'production':fields.many2one('mrp.production','Production'),
           'operation':fields.many2one('mrp.production.operation', 'Operation'),
-          'real_op': fields.many2one('mrp.production.operation.real','Real operation'),  
+          'real_op': fields.many2one('mrp.production.operation.real','Real operation'),
           'time':fields.float('Time'),
           'date':fields.date('Date'),
-          'descript':fields.text('Description'),       
+          'descript':fields.text('Description'),
      }
-
 mrp_wc_cost()
+
 class production_opert_users(osv.osv):
-    _name = 'production.opert.users'    
+    _name = 'production.opert.users'
     _columns = {
                 'name':fields.char('Name', size=54), 
                 'user' :fields.many2one('res.users','Operator'),
                 'production':fields.many2one('mrp.production', 'Production'),
-                'op':fields.many2one('mrp.production.operation', 'Operation'),                
-                'ops_times' : fields.one2many('mrp.ops.cost', 'wuser', 'Production Operations'),                
+                'op':fields.many2one('mrp.production.operation', 'Operation'),
+                'ops_times' : fields.one2many('mrp.ops.cost', 'wuser', 'Production Operations'),
         }
-    
-    
 production_opert_users()
 
+
 class manufacturing_user_op(osv.osv):
     _inherit = 'mrp.production.operation'
-    _name = 'mrp.production.operation'  
-    _columns = {  
+    _name = 'mrp.production.operation'
+    _columns = {
                 'tot':fields.float('Total hr'),
                 'tot_ops':fields.float('Total hr operators'),
                 'tot_mac':fields.float('Total hr machines'),
@@ -142,12 +140,13 @@
      }
 manufacturing_user_op()
 
+
 class mrp_production(osv.osv):
     _name = "mrp.production"
-    _inherit = "mrp.production"    
+    _inherit = "mrp.production"
     _columns = {
-                'users_cost':fields.one2many('production.opert.users', 'production', 'Users'),              
-                'ops_times' : fields.one2many('mrp.ops.cost', 'production', 'Users times'), 
+                'users_cost':fields.one2many('production.opert.users', 'production', 'Users'),
+                'ops_times' : fields.one2many('mrp.ops.cost', 'production', 'Users times'),
                 'wc_times':fields.one2many('mrp.wc.cost', 'production', 'Work centers'),
                 'tot':fields.float('Total'),
                 'tot_ops':fields.float('Total Operators'),
@@ -159,13 +158,14 @@
     _defaults = {
         'tot': 0,
         'tot_ops': 0,
-        'tot_mac': 0,  
+        'tot_mac': 0,
         'tot_cost':0,
         'ops_cost':0,
-        'mac_cost':0,   
+        'mac_cost':0,
                 }
 mrp_production()
 
+
 class mrp_production_operation_real(osv.osv):
     _inherit = "mrp.production.operation.real"
     _name = "mrp.production.operation.real"
@@ -176,35 +176,34 @@
        'operators_all_hours':fields.one2many('mrp.ops.cost','real_op','Operators'),
        'wc_all_hours':fields.one2many('mrp.wc.cost','real_op','Machines'),
        }
-    
+
     def action_pause(self, cr, uid, ids):
             """ Sets state to pause.
             @return: True
             """
-            
+
             delay = 0.0
             date_now = time.strftime('%Y-%m-%d %H:%M:%S')
             obj_line = self.browse(cr, uid, ids[0])
-            
+
             date_start = datetime.strptime(obj_line.date_start,'%Y-%m-%d %H:%M:%S')
-            
+
             if obj_line.date_restart:
-                date_start = datetime.strptime(obj_line.date_restart,'%Y-%m-%d %H:%M:%S')       
-            
+                date_start = datetime.strptime(obj_line.date_restart,'%Y-%m-%d %H:%M:%S')
+
             date_finished = datetime.strptime(date_now,'%Y-%m-%d %H:%M:%S')
             delay += (date_finished-date_start).days * 24
             delay += (date_finished-date_start).seconds / float(60*60)
-            
+
             time_obj = self.pool.get('new.input.time')
-            
-        
-            time_obj.input_real_worktime(cr, uid, ids, uid, delay, obj_line.mrp_manu_op.id, date_now, 'Work in '+str(obj_line.workcenter_id.name))
-            
-            
+
+            time_obj.input_real_worktime(cr, uid, ids, uid, delay, obj_line.mrp_manu_op.id, date_now,
+                                         _('Work in ')+ (obj_line.workcenter_id.name or ''))  # KGB translatable
+
             self.write(cr, uid, ids, {'state':'pause', 'date_pause': date_now})
-            
+
             return True
-    
+
     def action_done(self, cr, uid, ids):
         """ Sets state to done, writes finish date and calculates delay.
         @return: True
@@ -212,29 +211,28 @@
         tot_time = 0.0
         date_now = time.strftime('%Y-%m-%d %H:%M:%S')
         obj_line = self.browse(cr, uid, ids[0])
-        
-        date_start = datetime.strptime(obj_line.date_start,'%Y-%m-%d %H:%M:%S')
-        
-        date_finished = datetime.strptime(date_now,'%Y-%m-%d %H:%M:%S')
-        tot_time += (date_finished-date_start).days * 24
-        tot_time += (date_finished-date_start).seconds / float(60*60)
-        
-        tot_time -=     obj_line.paused_time       
-        
+
+        date_start = datetime.strptime(obj_line.date_start, '%Y-%m-%d %H:%M:%S')
+        date_finished = datetime.strptime(date_now, '%Y-%m-%d %H:%M:%S')
+        tot_time += (date_finished - date_start).days * 24
+        tot_time += (date_finished - date_start).seconds / float(60*60)
+
+        tot_time -= obj_line.paused_time
+
         if obj_line.date_restart:
                 date_start = datetime.strptime(obj_line.date_restart,'%Y-%m-%d %H:%M:%S')
-        
+
         delay = 0.0
-        
         date_finished = datetime.strptime(date_now,'%Y-%m-%d %H:%M:%S')
         delay += (date_finished-date_start).days * 24
-        delay += (date_finished-date_start).seconds / float(60*60)              
-            
-            
-        time_obj = self.pool.get('new.input.time')           
-        
-        time_obj.input_real_worktime(cr, uid, ids, uid, delay, obj_line.mrp_manu_op.id, date_now, 'Work in '+str(obj_line.workcenter_id.name))
-        
+        delay += (date_finished-date_start).seconds / float(60*60)
+
+
+        time_obj = self.pool.get('new.input.time')
+
+        time_obj.input_real_worktime(cr, uid, ids, uid, delay, obj_line.mrp_manu_op.id, date_now,
+                                     _('Work in ') + (obj_line.workcenter_id.name or ''))
+
         self.write(cr, uid, ids, {'state':'done', 'date_finished': date_now,'delay':tot_time})
         self.modify_production_order_state(cr,uid,ids,'done')
         return True

=== added directory 'mrp_manufacturing_cost/security'
=== added file 'mrp_manufacturing_cost/security/ir.model.access.csv'
--- mrp_manufacturing_cost/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ mrp_manufacturing_cost/security/ir.model.access.csv	2013-07-23 13:13:30 +0000
@@ -0,0 +1,7 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_production_opert_users_user","production.opert.users user","model_production_opert_users","mrp.group_mrp_user","1","1","1","1"
+"access_production_opert_users_manager","production.opert.users manager","model_production_opert_users","mrp.group_mrp_manager","1","1","1","1"
+"access_mrp_ops_cost_user","mrp.ops.cost user","model_mrp_ops_cost","mrp.group_mrp_user","1","1","1","1"
+"access_mrp_ops_cost_manager","mrp.ops.cost manager","model_mrp_ops_cost","mrp.group_mrp_manager","1","1","1","1"
+"access_mrp_wc_cost_user","mrp.wc.cost user","model_mrp_wc_cost","mrp.group_mrp_user","1","1","1","1"
+"access_mrp_wc_cost_manager","mrp.wc.cost manager","model_mrp_wc_cost","mrp.group_mrp_manager","1","1","1","1"

=== modified file 'mrp_manufacturing_cost/wizard/final_cost.py'
--- mrp_manufacturing_cost/wizard/final_cost.py	2012-10-15 09:01:48 +0000
+++ mrp_manufacturing_cost/wizard/final_cost.py	2013-07-23 13:13:30 +0000
@@ -63,6 +63,8 @@
         for t_ops in ops_times:
             usr_obj = self.pool.get('hr.employee')
             usr_search = usr_obj.search(cr, uid,[('user_id', '=', t_ops.user.id)])
+            if len(usr_search) != 1:  # KGB
+                raise osv.except_osv(_('User is not employee'), _(t_ops.user.name))  # KGB
             usr = usr_obj.browse(cr , uid, usr_search[0])
             if not usr.product_id:
                 raise osv.except_osv(_('You must assign a product to all employers'), _(usr.name))                

=== modified file 'mrp_master_extension/__openerp__.py'
--- mrp_master_extension/__openerp__.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/__openerp__.py	2013-07-23 13:13:30 +0000
@@ -35,13 +35,15 @@
 	"depends" : [
 		'stock',
 		'mrp',
+		'sale',  # KGB new sale_order_id in mrp_production IMO it is OK to depend on sale
 	],
 	"category" : "Custom Modules",
 	"init_xml" : [],
 	"demo_xml" : [],
-	"update_xml" : [ 
-		'wizard/routing_assign_view.xml',		
-		'wizard/new_manufacturing_user_view.xml',		
+	"update_xml" : [
+		'security/ir.model.access.csv',
+		'wizard/routing_assign_view.xml',
+		'wizard/new_manufacturing_user_view.xml',
 		'wizard/partial_production_view.xml',
 		'wizard/prod_parcial_picking_view.xml',
 		'mrp_factory_view.xml',

=== modified file 'mrp_master_extension/mrp_bom.py'
--- mrp_master_extension/mrp_bom.py	2013-07-17 15:50:22 +0000
+++ mrp_master_extension/mrp_bom.py	2013-07-23 13:13:30 +0000
@@ -23,6 +23,7 @@
 import math
 from tools.translate import _
 
+
 class bom_fixed_cost(osv.osv):
     _name = 'bom.fixed.cost'
     _description = 'Bom fixed costs'
@@ -32,13 +33,13 @@
                 'estimated':fields.float('Estimated amount'),
                 'bom_id':fields.many2one('mrp.bom','Bom')
                 }
-
 bom_fixed_cost()
 
+
 class mrp_bom_operations_product(osv.osv):
     _name = 'mrp.bom.operations.product'
     _description = 'materials used to produce'
-    
+
     def _calculate_time(self, cr, uid, ids, field_name, arg, context=None):
         res = {}
         operation = self.pool.get('mrp.bom.operations.product').browse(cr, uid, ids)[0]
@@ -52,7 +53,7 @@
                     'hour': float(((operation.time_cycle * cycle) + operation.time_start + operation.time_stop) / operation.time_efficiency)
             }
         return res
-    
+
     def _compute_qty(self, cr, uid, ids, field_name, arg, context=None):
         id = ids[0]
         bom_objs = self.pool.get('mrp.bom')
@@ -62,18 +63,18 @@
             return {id: 1 / float(bom.product_qty / operation.semi_prod_qty)}
         else:
             return {id: float(operation.semi_prod_qty)}
-    
+
     def create(self, cr, uid, data, context=None):
         if 'name' not in data:
             op = self.pool.get('mrp.operation').browse(cr, uid, data['operation_id'])
             wc = self.pool.get('mrp.workcenter').browse(cr, uid, data['workcenter_id'])
             data['name'] = '%s -> %s' % (op.name, wc.name)
         return super(mrp_bom_operations_product, self).create(cr, uid, data, context)
-    
-    _columns = { 
-        'name': fields.char('Name', size = 64, required= True),    
+
+    _columns = {
+        'name': fields.char('Name', size = 64, required= True),
         'sequence': fields.integer('Sequence', required= True),
-        'descript': fields.text('Description', size= 64),    
+        'descript': fields.text('Description', size= 64),
         'product_id': fields.many2one('product.product', 'Product'),
         'semi_prod_qty': fields.float('Product Qty'),
         'semi_prod_uom': fields.many2one('product.uom', 'Product UOM'),
@@ -93,13 +94,12 @@
             store={'mrp.bom.operations.product': (lambda self, cr, uid, ids, c={}: ids, None, 20)}, multi="All"),
         'hour': fields.function(_calculate_time, string='Nº Hour', method=True, type='float',
             store={'mrp.bom.operations.product': (lambda self, cr, uid, ids, c={}: ids, None, 20)}, multi="All"),
-        'final_products_ids': fields.one2many('mrp.bom.final.product', 'mrp_bom_operations_product_id', 'Final products'),        
-        'components_used_ids': fields.one2many('mrp.bom', 'mrp_bom_operations_product_id', 'Components used'), 
+        'final_products_ids': fields.one2many('mrp.bom.final.product', 'mrp_bom_operations_product_id', 'Final products'),
+        'components_used_ids': fields.one2many('mrp.bom', 'mrp_bom_operations_product_id', 'Components used'),
         'bom_id': fields.many2one('mrp.bom', 'Parent BOM', required=True),
-        'type': fields.selection([('fixed','Fixed'),('variable','Variable')],'Type'),     
-        
+        'type': fields.selection([('fixed','Fixed'),('variable','Variable')],'Type'),
     }
-    
+
     _defaults = {
         'sequence': lambda *a: 1,
         'time_efficiency': lambda *a: 1,
@@ -107,7 +107,7 @@
         'hour': lambda *a: 0.0,
         'type': lambda *a: 'variable',
     }
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -116,7 +116,7 @@
             id = self.pool.get('mrp.bom').search(cr, uid, [('name', '=', context['name']), ('routing_id', '=', context['routing_id'])])[0]
             res.update({'bom_id': id})
         return res
-    
+
     def wc_onchange(self, cr, uid, ids, workcenter_id, operation_id):
         value = {}
         if workcenter_id:
@@ -132,7 +132,7 @@
             value['costs_cycle'] = wc.costs_cycle
             value['name'] = '%s -> %s' % (op.name, wc.name)
         return {'value': value}
-    
+
     def prod_onchange(self, cr, uid, ids, product_id):
         value = {}
         warning = {}
@@ -154,22 +154,23 @@
                     'semi_prod_uom': prod.product_tmpl_id.uom_id.id or False,
                 })
         return {'value': value, 'warning': warning}
-    
+
     def cycle_onchange(self, cr, uid, ids, time_cycle, costs_hour):
         value = {}
         costh = costs_hour * time_cycle
         value['costs_cycle'] = costh
-        return {'value':value}
-        
+        return {'value': value}
+
     def button_dummy(self, cr, uid, ids, *args):
         self.pool.get('mrp.bom.operations.product').write(cr, uid, ids, {})
         return True
 mrp_bom_operations_product()
 
+
 class mrp_bom_final_product(osv.osv):
     _name = 'mrp.bom.final.product'
     _description = 'Bill of Material'
-    
+
     _columns = {
         'product_id': fields.many2one('product.product', 'Product', required=True),
         'product_qty': fields.float('Product Qty', required=True),
@@ -178,12 +179,12 @@
         'location_id': fields.related('product_id', 'default_location', type='many2one', relation='stock.location', string='Default Location', required=True),
         'bom_id': fields.many2one('mrp.bom', 'Final Product'),
     }
-    
-    _defaults = {  
+
+    _defaults = {
         'product_qty': lambda *a: 1,
         'product_uom': lambda *a: 1,
     }
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -194,7 +195,7 @@
         if 'bom_id' in context.keys():
             res.update({'bom_id': context['bom_id']})
         return res
-    
+
     def prod_onchange(self, cr, uid, ids, product_id):
         value = {}
         if product_id:
@@ -202,7 +203,7 @@
             value['location_id'] = prod.default_location.id
             value['product_uom'] = prod.product_tmpl_id.uom_id.id or False
         return {'value': value}
-    
+
 mrp_bom_final_product()
 
 def rounding(f, r):
@@ -213,7 +214,7 @@
 class mrp_bom(osv.osv):
     _description = 'Bill of Material'
     _inherit = 'mrp.bom'
-    
+
 #    def write(self, cr, uid, ids, value, context=None):
 #        id = ids[0]
 #        for line in value['bom_lines']:
@@ -236,13 +237,13 @@
             self.write(cr,uid,[bom.id],{'standard_price': bom.product_id.standard_price,
                                         'list_price': bom.product_id.list_price}) 
         return new_id
-    
+
     def copy(self, cr, uid, id, default=None, context=None):
         if default is None:
-            default = {}       
-        
+            default = {}
+
         bom_super = super(mrp_bom, self).copy(cr, uid, id, default, context)
-        
+
         original_bom = self.browse(cr, uid, id)
         #copy_bom_id = self.search(cr, uid, [('name','=',(original_bom.name+' Copy'))])[0]
         #copy_bom  = self.browse(cr, uid, copy_bom_id)
@@ -252,9 +253,8 @@
             for aux_op in bom_aux.mrp_bom_operations_product_ids:
                 if aux_op.name == aux_bom_op.name:
                     bom_aux.write({'mrp_bom_operations_product_id':aux_op.id})
-        return bom_super	
-    
-    
+        return bom_super
+
     _columns = {
         'mrp_bom_operations_product_ids': fields.one2many('mrp.bom.operations.product', 'bom_id', 'Operations'),
         'mrp_bom_operations_product_id': fields.many2one('mrp.bom.operations.product','Consumed On'),
@@ -262,7 +262,7 @@
         'routing_id_name': fields.char('Routing',size=64),   
         'fixed_costs':fields.one2many('bom.fixed.cost','bom_id','Fixed costs')
     }
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -273,7 +273,7 @@
         if 'bom_id' in context.keys():
             res.update({'bom_id': context['bom_id']})
         return res
-    
+
     def prod_onchange(self, cr, uid, ids, product_id):
         value = {}
         if product_id:
@@ -282,22 +282,22 @@
             value['name'] = prod.name
             value['product_uom'] = prod.product_tmpl_id.uom_id.id or False
         return {'value': value}
-    
+
     def onchange_routingField(self, cr, uid, ids, routing_id):
         operations_product_obj = self.pool.get('mrp.bom.operations.product')
         if not self.browse(cr, uid, ids):
-          raise osv.except_osv(_('User error'), _('Save the record first !'))
+            raise osv.except_osv(_('User error'), _('Save the record first !'))
         mrp_bom_id = self.browse(cr, uid, ids)[0]
         workcenter_lines_obj = self.pool.get('mrp.production.workcenter.line')
         workcenter_line_ids = workcenter_lines_obj.search(cr, uid, [('id', '=', routing_id)])
         workcenter_line_objs = []
-        
+
         if len(workcenter_line_ids):
             workcenter_line_objs = workcenter_lines_obj.browse(cr, uid, workcenter_line_ids)
-        
+
         for operation_product_id in mrp_bom_id.mrp_bom_operations_product_ids:
             operations_product_obj.unlink(cr, uid, [operation_product_id.id])
-        
+
         values = {
                 'sequence': 0,
                 'descript': '',
@@ -313,7 +313,7 @@
                 'costs_hour': 0,
                 'costs_cycle': 0,
         }
-        
+
         for workcenter_line in workcenter_line_objs:
             values['sequence'] = workcenter_line.sequence
             values['descript'] = workcenter_line.descript
@@ -329,9 +329,9 @@
             values['costs_cycle'] = workcenter_line.workcenter_id.costs_cycle
             values['name'] = '%s -> %s' % (workcenter_line.operation_id.name, workcenter_line.workcenter_id.name)
             res = operations_product_obj.create(cr, uid, values)
-    
+
         return {}
-    
+
     def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0):
         """ Finds Products and Work Centers for related BoM for manufacturing order.
         @param bom: BoM of particular product.
@@ -352,7 +352,7 @@
         if bom.type == 'phantom' and bom.bom_id: # Not Master Phantom / No control over phanton into phantom 
             phantom = True
 
-        if not phantom:            
+        if not phantom:
             if bom.routing_id:
                 for op_use in bom.mrp_bom_operations_product_ids:
                     products = []
@@ -361,17 +361,17 @@
                     for product in op_use.components_used_ids:
                         product_lst.append(product)
                     for product in op_use.components_used_ids:
-                        if product.type == 'phantom' and product.bom_id: # product is a not master phantom BOM
-                            bom_lst = self.search(cr,uid,[('bom_id','=', product.id)]) # search phantom components BOM
+                        if product.type == 'phantom' and product.bom_id:  # product is a not master phantom BOM
+                            bom_lst = self.search(cr,uid,[('bom_id','=', product.id)])  # search phantom components BOM
                             phantom = True
-                            for bom_id in bom_lst: # Exchange Phantom product components
+                            for bom_id in bom_lst:  # Exchange Phantom product components
                                 bom_reg = self.browse(cr,uid,bom_id)
-                                if bom_reg.product_uom.name == 'PCE': 
-                                    qty = math.ceil(product.product_qty )
+                                if bom_reg.product_uom.rounding == 1.0:  # KGB orig: if bom_reg.product_uom.name == 'PCE':
+                                    qty = math.ceil(product.product_qty)
                                 else:
                                     qty = bom_reg.product_qty
                                 if bom_reg.type == 'variable':
-                                    qty = qty * factor                                   
+                                    qty = qty * factor
                                 products.append({
                                         'name': bom_reg.product_id.name,
                                         'product_id': bom_reg.product_id.id,
@@ -381,13 +381,13 @@
                                         'product_uos': bom_reg.product_uos and bom.product_uos.id or False,
                                         })
                         else:
-                            if product.product_uom.name == 'PCE': 
+                            if product.product_uom.rounding == 1.0:  # KGB orig: if product.product_uom.name == 'PCE': 
                                 qty = math.ceil(product.product_qty )
                             else:
                                 qty = product.product_qty
                             if op_use.type == 'variable':
                                 qty = qty * factor
-                                                             
+
                             products.append({
                                 'name': product.product_id.name,
                                 'product_id': product.product_id.id,
@@ -396,14 +396,14 @@
                                 'product_uos_qty': product.product_uos and bom.product_uos_qty * factor or False,
                                 'product_uos': product.product_uos and bom.product_uos.id or False,
                             })
-                        for final in op_use.final_products_ids:                            
-                            if final.product_uom.name == 'PCE':
-                                qty = math.ceil(final.product_qty )
-                            else:                       
-                                qty = final.product_qty                       
+                        for final in op_use.final_products_ids:
+                            if final.product_uom.rounding == 1.0:  # KGB orig: if final.product_uom.name == 'PCE'
+                                qty = math.ceil(final.product_qty)
+                            else:
+                                qty = final.product_qty
                             if op_use.type == 'variable':
                                 qty = qty * factor
-                                
+
                             finals.append({
                                 'name': final.product_id.name,
                                 'product_id': final.product_id.id,
@@ -420,7 +420,7 @@
                         'product_id': op_use.product_id.id,
                         'semi_prod_uom': op_use.semi_prod_uom.id,
                         'semi_prod_qty_fact': op_use.semi_prod_qty_fact or 0,
-                        'sequence': level+(op_use.sequence or 0),
+                        'sequence': level + (op_use.sequence or 0),
                         'capacity_per_cycle': op_use.capacity_per_cycle,
                         'time_efficiency': op_use.time_efficiency,
                         'time_cycle': op_use.time_cycle,
@@ -438,5 +438,5 @@
                 if res != []:
                     result = result + res
         return result
-    
+
 mrp_bom()

=== modified file 'mrp_master_extension/mrp_factory.py'
--- mrp_master_extension/mrp_factory.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/mrp_factory.py	2013-07-23 13:13:30 +0000
@@ -22,21 +22,19 @@
 from tools.translate import _
     
 class mrp_factory(osv.osv):
-     
-     _name = 'mrp.factory'
-     _description = 'Manufacturing Factory'
-     
-     _columns = {
+    _name = 'mrp.factory'
+    _description = 'Manufacturing Factory'
+    _columns = {
                 'name':fields.char('Factory', size=64, required=True, readonly=False),
                 'active': fields.boolean('Active'),
                 'description':fields.text('Description', required=False, readonly=False),
                 'location_id': fields.many2one('stock.location', 'Location', size= 64, required= True, help='Specify the location of this plant'),
                 'workcenter_ids': fields.one2many('mrp.workcenter', 'factory_id', 'Work Centers', required= False),
                 'company_id': fields.many2one('res.company', 'Company'),
-     }
-     
-     _defaults = {  
-         'active': lambda *a: True,
-         'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.routing', context=context)
-     }
-mrp_factory()
\ No newline at end of file
+    }
+
+    _defaults = {
+        'active': lambda *a: True,
+        'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.routing', context=context)
+    }
+mrp_factory()

=== modified file 'mrp_master_extension/mrp_operation.py'
--- mrp_master_extension/mrp_operation.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/mrp_operation.py	2013-07-23 13:13:30 +0000
@@ -21,6 +21,7 @@
 from osv import osv, fields
 from tools.translate import _
 
+
 class mrp_operation(osv.osv):
     _name = 'mrp.operation'
     _description = 'MRP Operation'
@@ -29,20 +30,18 @@
         'cod': fields.char('Code', size = 64, required=True),
         'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the resource record without removing it."),
         'name': fields.char('Name', size=64, required=True),
-        'workcenter': fields.many2many('mrp.workcenter','mrp_operations_workcenter', 'operation_id', 'workcenter_id','Work centers'),
+        'workcenter': fields.many2many('mrp.workcenter', 'mrp_operations_workcenter', 'operation_id', 'workcenter_id', 'Work centers'),
         'descript': fields.text('Description', help="Description of the operation"),
         'type': fields.selection([
-            ('mfo','Manufacturing Operation'),
+            ('mfo', 'Manufacturing Operation'),
             ('mto', 'Maintenance Operation')], 'Operation type', size=64, required=True),
         'operation_line_ids': fields.one2many('mrp.production.workcenter.line', 'operation_id', 'Operations'),
         'operations_product': fields.one2many('mrp.bom.operations.product', 'operation_id', 'Operations'),
      }
-    
-    _defaults = {  
+
+    _defaults = {
         'type': lambda *a: 'mfo',
         'active': lambda *a: True,
     }
-    
+
 mrp_operation()
-    
-

=== modified file 'mrp_master_extension/mrp_production.py'
--- mrp_master_extension/mrp_production.py	2013-06-26 11:27:28 +0000
+++ mrp_master_extension/mrp_production.py	2013-07-23 13:13:30 +0000
@@ -42,10 +42,11 @@
 
 mrp_fixed_cost()
 
+
 class mrp_production_operation(osv.osv):
     _name = 'mrp.production.operation'
     _description = 'Production Operation'
-    
+
     def _calculate_time(self, cr, uid, ids, field_name, arg, context=None):
         res = {}
         operation = self.pool.get('mrp.production.operation').browse(cr, uid, ids)[0]
@@ -59,7 +60,7 @@
                     'hour': float(((operation.time_cycle * cycle) + operation.time_start + operation.time_stop) / operation.time_efficiency)
             }
         return res
-    
+
     def _compute_qty(self, cr, uid, ids, field_name, arg, context=None):
         id = ids[0]
         production_objs = self.pool.get('mrp.production')
@@ -69,7 +70,7 @@
             return {id: float(production.product_qty * operation.semi_prod_qty_fact)}
         else:
             return {id: float(operation.semi_prod_qty_fact)}
-    
+
     _columns = {
             'name': fields.char('Name', size = 64, required= True),
             'sequence': fields.integer('Sequence', size = 64, required= True),
@@ -97,9 +98,8 @@
             'final_products_ids': fields.one2many('mrp.production.final.product', 'mrp_production_operation_id', 'Final products'),        
             'components_used_ids': fields.one2many('mrp.production.product.line', 'mrp_production_operation_id', 'Components used'),
             'type':fields.selection([('fixed','Fixed'),('variable','Variable')],'Type'),
-      
     }
-    
+
     _defaults = {
             'sequence': lambda *a: 1,
             'semi_prod_qty_fact': lambda *a: 1,
@@ -108,7 +108,7 @@
             'hour': lambda *a: 0.0,
             'type': lambda *a: 'variable',
     }
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -166,19 +166,20 @@
         return True
 mrp_production_operation()
 
+
 class mrp_production_product_line(osv.osv):
     _description = 'Production Scheduled Product'
     _inherit = 'mrp.production.product.line'
-    
+
     _columns = {
         'mrp_production_operation_id': fields.many2one('mrp.production.operation', 'Consumed On'),
         'location_id': fields.related('product_id', 'default_location', type='many2one', relation='stock.location', string='Default Location'),
     }
-    
+
     _default = {
         'product_qty': lambda *a: 1,
     }
-    
+
     def prod_onchange(self, cr, uid, ids, product_id):
         value = {}
         if product_id:
@@ -188,7 +189,7 @@
             value['product_uom'] = prod.product_tmpl_id.uom_id.id or False
             value['location_id'] = prod.default_location.id
         return {'value': value}
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -200,20 +201,21 @@
         return {}
 mrp_production_product_line()
 
+
 class mrp_production_final_product(osv.osv):
     _name = 'mrp.production.final.product'
     _description = 'Production Scheduled Final Product'
-    
+
     _columns = {
-        'name': fields.char('Name', size = 64, required= True),
-        'product_id': fields.many2one('product.product', 'Product', required=True),
-        'product_qty': fields.float('Product Qty', required=True),
+        'name': fields.char('Name', size = 64, required = True),
+        'product_id': fields.many2one('product.product', 'Product', required = True),
+        'product_qty': fields.float('Product Qty', required = True),
         'product_uom': fields.many2one('product.uom', 'Product UOM', required=True, help="UoM (Unit of Measure) is the unit of measurement for the inventory control"),
-        'mrp_production_operation_id': fields.many2one('mrp.production.operation','Produced On'),
+        'mrp_production_operation_id': fields.many2one('mrp.production.operation', 'Produced On'),
         'location_id': fields.related('product_id', 'default_location', type='many2one', relation='stock.location', string='Default Location'),
         'production_id': fields.many2one('mrp.production', 'Final Product'),
     }
-    
+
     def prod_onchange(self, cr, uid, ids, product_id):
         value = {}
         if product_id:
@@ -223,7 +225,7 @@
             value['product_uom'] = prod.product_tmpl_id.uom_id.id or False
             value['location_id'] = prod.default_location.id
         return {'value': value}
-    
+
     def default_get(self, cr, uid, fields, context=None):
         if context is None:
             context = {}
@@ -233,28 +235,28 @@
             production_id = self.pool.get('mrp.production').search(cr, uid, [('name', '=', context['name'])])
             return {'production_id': production_id}
         return {}
-    
+
 mrp_production_final_product()
 
 class mrp_production_users(osv.osv):
-    _name = 'mrp.production.users'    
-    
-    def delete_it(self, cr, uid, ids, context=None):
-              self.unlink(cr, uid,ids, context=context)
-              return False
-    
-    _columns = {       
-            'name': fields.many2one('res.users','User'),
+    _name = 'mrp.production.users'
+
+    def delete_it(self, cr, uid, ids, context = None):
+        self.unlink(cr, uid, ids, context = context)
+        return False
+
+    _columns = {
+            'name': fields.many2one('res.users', 'User'),
             'op': fields.many2one('mrp.production.operation','Operation'),
             'prod': fields.many2one('mrp.production','Production'),
             'percent': fields.float('% Estimated'),
             'est_time':fields.float('Time Estimated'),
         }
-    
-    _default= {
+
+    _default = {
         'percent': 0
      }
-    
+
     def name_get(self, cr, uid, ids, context=None):
         if not ids:
             return []
@@ -265,12 +267,12 @@
             else:
                 result.append((line.id, line.name))
         return result
-    
-    
+
 mrp_production_users()
 
+
 class mrp_production(osv.osv):
-    _inherit = "mrp.production"    
+    _inherit = "mrp.production"
     _columns = {
             'bom_id': fields.many2one('mrp.bom', 'Bill of Material', readonly=True, states={'draft': [('readonly', False)]}, domain=[('bom_id','=',False)]),
             'routing_id': fields.many2one('mrp.routing', 'Routing', on_delete='set null', readonly=True, help="The list of operations (list of work centers) to produce the finished product. The routing is mainly used to compute work center costs during operations and to plan future loads on work centers based on production plannification."),
@@ -285,15 +287,15 @@
             'company_id': fields.many2one('res.company', 'Company'),
             'sale_order_id':fields.many2one('sale.order', 'Sale Order', readonly=True),
     }
-    
-    _defaults = {  
+
+    _defaults = {
          'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.routing', context=context)
      }
-    
+
     def write(self, cr, uid, ids, vals, context=None):
         res = {}
         if 'bom_id' in vals:
-            for order in self.browse(cr, uid, ids):            
+            for order in self.browse(cr, uid, ids):
                 if vals['bom_id']:
                     bom_id = self.pool.get('mrp.bom').browse(cr, uid, vals['bom_id'])
                     vals.update({'routing_id': bom_id.routing_id.id})
@@ -303,9 +305,8 @@
         else:
                 res = super(mrp_production, self).write(cr, uid, ids, vals, context)
         return res
-    
+
     def create(self, cr, uid, vals, context={}):
-        
         if 'bom_id' in vals:
             if not 'product_def_loc' in vals:
                 prod = self.pool.get('product.product').browse(cr, uid, vals['product_id'])
@@ -319,7 +320,7 @@
         else:
             res = super(mrp_production, self).create(cr, uid, vals, context)
         return res
-    
+
     def onchange_bom(self, cr, uid, ids, bom_id, context=None):
         val = {}
         if bom_id:
@@ -328,18 +329,17 @@
                 'routing_id': bom.routing_id.id
             }
         return {'value': val}
-    
+
     def product_qty_change_inh(self, cr, uid, ids, product_id, product_qty, context=None):
         product_obj = self.pool.get('product.product')
         val = {}
         if product_qty:
             if product_id:
                 product = product_obj.browse(cr,uid,product_id)
-                val={'product_uos_qty': product_qty * product.uos_coeff
+                val = {'product_uos_qty': product_qty * product.uos_coeff
                      }
-                
         return {'value': val}
-    
+
     def product_id_change_inh(self, cr, uid, ids, product_id, context=None):
         value = super(mrp_production, self).product_id_change(cr, uid, ids, product_id, context=None)
         val = value['value']
@@ -351,49 +351,46 @@
             else:
                 val['product_def_loc'] = prod.default_location.id
                 val['product_uos'] = False
-                
         return {'value': val}
-    
+
     def do_full_move_consume(self, cr, uid, ids, context=None):
-      objs = self.pool.get('mrp.production').browse(cr , uid, ids)
-      con_prod = []
-      for obj in objs:
-          for prod in obj.move_lines:
-              con_prod.append(prod.id) 
-      for prod_id in con_prod:
-            if context is None:
-                context = {}
+        if context is None:
+            context = {}
+        objs = self.pool.get('mrp.production').browse(cr, uid, ids)
+        con_prod = []
+        for obj in objs:
+            for prod in obj.move_lines:
+                con_prod.append(prod.id)
+        for prod_id in con_prod:
             move_obj = self.pool.get('stock.move')
-            line = self.pool.get('stock.move').browse(cr , uid, prod_id)
+            line = self.pool.get('stock.move').browse(cr, uid, prod_id)
             prod_qty = line.product_qty
             prod_loc = line.location_id
-            move_obj.action_consume(cr, uid, [prod_id] ,prod_qty,prod_loc.id,context=context)       
-      return True
-  
+            move_obj.action_consume(cr, uid, [prod_id], prod_qty, prod_loc.id, context=context)
+        return True
+
     def do_full_produce(self, cr, uid, ids, context=None):
-      objs = self.pool.get('mrp.production').browse(cr , uid, ids)
-      con_prod = []
-      for obj in objs:
-          for prod in obj.move_created_ids:
-              con_prod.append(prod.id) 
-      for prod_id in con_prod:
-            if context is None:
-                context = {}
+        if context is None:
+            context = {}
+        objs = self.pool.get('mrp.production').browse(cr, uid, ids)
+        con_prod = []
+        for obj in objs:
+            for prod in obj.move_created_ids:
+                con_prod.append(prod.id)
+        for prod_id in con_prod:
             move_obj = self.pool.get('stock.move')
-            line = self.pool.get('stock.move').browse(cr , uid, prod_id)
+            line = self.pool.get('stock.move').browse(cr, uid, prod_id)
             prod_qty = line.product_qty
             prod_loc = line.location_id
-            move_obj.action_consume(cr, uid, [prod_id] ,prod_qty,prod_loc.id,context=context)
-      return True
-  
-  
+            move_obj.action_consume(cr, uid, [prod_id], prod_qty, prod_loc.id, context=context)
+        return True
+
     def action_button_confirm(self, cr, uid, ids, *args):
         wf_service = netsvc.LocalService("workflow")
         for id in ids:
             wf_service.trg_validate(uid, 'mrp.production', id, 'button_confirm', cr)
         return True
 
-  
     def action_compute(self, cr, uid, ids, properties=[]):
         """ Computes bills of material of a product.
         @param properties: List containing dictionaries of properties.
@@ -409,7 +406,7 @@
             prod_line_obj.unlink(cr, uid, prod_line_obj.search(cr, uid, [('production_id', '=', production.id)]))
             operation_line_obj.unlink(cr, uid, operation_line_obj.search(cr, uid, [('production_id', '=', production.id)]))
             final_product_obj.unlink(cr, uid, final_product_obj.search(cr, uid, [('production_id', '=', production.id)]))
-            
+
             bom_point = production.bom_id
             bom_id = production.bom_id.id
             if not bom_point:
@@ -423,24 +420,19 @@
                 raise osv.except_osv(_('Error'), _("Couldn't find bill of material for product"))
 
             factor = production.product_qty * production.product_uom.factor / bom_point.product_uom.factor
-       
             res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties)
-            
             fix_obj = self.pool.get('mrp.fixed.cost')
-            
             for del_it in production.fixed_costs:
-                context = {'borrar':True}
+                context = {'borrar': True}  # KGB eng "to_delete"?
                 fix_obj.unlink(cr, uid, del_it.id, context=context)
-            
             for aux in bom_point.fixed_costs:
                 values = {
-                          'name':aux.name,
-                          'amount':aux.amount,
-                          'production_id':production.id,
-                          'estimated':aux.amount
+                          'name': aux.name,
+                          'amount': aux.amount,
+                          'production_id': production.id,
+                          'estimated': aux.amount
                           }
                 fix_obj.create(cr, uid, values)
-            
             for user in user_obj.search(cr, uid, [('prod', '=', production.id)]):
                 user_obj.unlink(cr, uid, user)
             for line in res:
@@ -460,11 +452,12 @@
                     final_product_obj.create(cr, uid, final_prod)
                 self.create_operator(cr, uid, operation_line_obj.browse(cr, uid, operation_id))
         return len(results)
-    
+
     def action_confirm(self, cr, uid, ids):
         """ Confirms production order.
         @return: Newly generated picking Id.
         """
+        #TODO KGB needs refactoring/rethinking 400LOC
         res_final_ids = []
         picking_id = False
         proc_ids = []
@@ -477,17 +470,16 @@
                 production = self.browse(cr, uid, [production.id])[0]
             pick_type = 'internal'
             moves = []
-            
+
             for i in range(len(production.production_operation_ids)):
                 move_id = False
                 next_operation = False
                 semi_product_id = False
                 newdate = production.date_planned
                 operation = production.production_operation_ids[i]
-                if i < len(production.production_operation_ids)-1:
-                    next_operation = production.production_operation_ids[i+1]
-                
-                
+                if i < len(production.production_operation_ids) - 1:
+                    next_operation = production.production_operation_ids[i + 1]
+
                 for line in operation.final_products_ids:
                     if not line.product_id.default_location:
                         raise osv.except_osv(_('Product Default Location'), _('All final products must have a default location !'))
@@ -502,9 +494,9 @@
                     picking_id = self.create_picking(cr, uid, 'out', 'direct', production, operation)
                     self.create_purchase(cr, uid, operation)
                     for line in operation.components_used_ids:
-                        
+
                         move_id = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'product_id': line.product_id.id,
                             'product_qty': line.product_qty,
                             'product_uom': line.product_uom.id,
@@ -519,9 +511,8 @@
                             'operation_id': operation.id or False,
                         })
                         moves.append(move_id)
-                        
-                        move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                        move_new_id = move_obj.create(cr, uid, {  # KGB
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': line.product_id.id,
                             'picking_id': picking_id,
@@ -547,14 +538,14 @@
                             'product_uos': line.product_uos and production.product_uos.id or False,
                             'location_id': line.product_id.default_location.id,
                             'procure_method': line.product_id.procure_method,
+                            'move_id': move_new_id, #KGB
                             'company_id': production.company_id.id,
                         })
                         wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
                         proc_ids.append(proc_id)
-                        
-                    
+
                     data = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': production.product_id.id,
                             'product_qty': production.product_qty,
@@ -575,8 +566,8 @@
                     picking_id = self.create_picking(cr, uid, 'out', 'direct', production, next_operation)
                     self.create_purchase(cr, uid, next_operation)
                     for line in next_operation.components_used_ids:
-                        move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                        move_new_id = move_obj.create(cr, uid, { #KGB
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': line.product_id.id,
                             'picking_id': picking_id,
@@ -601,17 +592,18 @@
                             'product_uos': line.product_uos and production.product_uos.id or False,
                             'location_id': line.product_id.default_location.id,
                             'procure_method': line.product_id.procure_method,
+                            'move_id': move_new_id, #KGB
                             'company_id': production.company_id.id,
                         })
                         wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
                         proc_ids.append(proc_id)
-                    move_pick_id = move_obj.create(cr, uid, {
-                        'name':'PROD:' + production.name + '/'+ next_operation.name,
+                    move_new_id = move_obj.create(cr, uid, {
+                        'name': 'PROD:' + production.name + '/' + next_operation.name,
                         'date': production.date_planned,
                         'picking_id': picking_id,
                         'product_id': operation.product_id.id,
                         'product_qty': operation.semi_prod_qty,
-                        'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
+                        'product_uom': operation.semi_prod_uom.id,  #  KGB orig operation.product_id.product_tmpl_id.uom_id.id,
                         'product_uos_qty': False,
                         'product_uos': False,
                         'date': newdate,
@@ -621,18 +613,18 @@
                         'company_id': production.company_id.id,
                     })
                     data = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': operation.product_id.id,
                             'product_qty': operation.semi_prod_qty,
-                            'bom_prop': line.product_qty / production.product_qty,
-                            'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
+                            'bom_prop': line.product_qty / production.semi_prod_qty,  #  KGB orig 'bom_prop': line.product_qty / production.product_qty,
+                            'product_uom': operation.semi_prod_uom.id,  #  KGB orig operation.product_id.product_tmpl_id.uom_id.id,
                             'product_uos_qty': False,
                             'product_uos': False,
                             'date': newdate,
                             'location_id': operation.product_id.product_tmpl_id.property_stock_production.id,
                             'location_dest_id': operation.location_id.id,
-                            'move_dest_id': move_pick_id,
+                            'move_dest_id': move_new_id,
                             'state': 'waiting',
                             'company_id': production.company_id.id,
                             'operation_id': operation.id,
@@ -643,11 +635,11 @@
                     if not operation.product_id:
                         raise osv.except_osv(_('Semi-elaborated Product'), _('A semi-elaborated product is missing in the %s operation !') %(operation.name))
                     semi_product_id = move_obj.create(cr, uid, {
-                        'name':'PROD:' + production.name + '/'+ operation.name,
+                        'name': 'PROD:' + production.name + '/'+ operation.name,
                         'product_id': operation.product_id.id,
                         'product_qty': operation.semi_prod_qty,
                         'bom_prop': operation.semi_prod_qty / production.product_qty,
-                        'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
+                        'product_uom': operation.semi_prod_uom.id,  #  KGB orig 'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
                         'product_uos_qty': False,
                         'product_uos': False,
                         'date': newdate,
@@ -660,12 +652,12 @@
                     moves.append(semi_product_id)
                     if not operation.location_id.usage == 'supplier':
                         data = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': operation.product_id.id,
                             'product_qty': operation.semi_prod_qty,
                             'bom_prop': operation.semi_prod_qty / production.product_qty,
-                            'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
+                            'product_uom': operation.semi_prod_uom.id,  #  KGB orig 'product_uom': operation.product_id.product_tmpl_id.uom_id.id,
                             'product_uos_qty': False,
                             'product_uos': False,
                             'date': newdate,
@@ -684,10 +676,10 @@
                         product_qty = operation.semi_prod_qty
                     else:
                         product_qty = production.product_qty
-                    location_dest_id = ( next_operation and next_operation.location_id  and next_operation.location_id.id ) or (production.product_id and production.product_id.default_location and production.product_id.default_location.id)
+                    location_dest_id = (next_operation and next_operation.location_id and next_operation.location_id.id ) or (production.product_id and production.product_id.default_location and production.product_id.default_location.id)
                     company_id = production.company_id.id 
-                    move_pick_id = move_obj.create(cr, uid, {
-                        'name':'PROD:' + production.name + '/'+ operation.name,
+                    move_new_id = move_obj.create(cr, uid, {
+                        'name': 'PROD:' + production.name + '/' + operation.name,
                         'date': production.date_planned,
                         'picking_id': picking_id,
                         'product_id': product.id,
@@ -703,34 +695,37 @@
                         'company_id': company_id,
                     })
                     wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
-                else:  
+                else:
                     if operation.components_used_ids:
                         picking_id = self.create_picking(cr, uid, pick_type, 'direct', production, operation, 'input')
                     for line in operation.components_used_ids:
+                        move_new_id = False  # KGB
                         if line.product_id.type in ('product', 'consu'):
                             move_id = move_obj.create(cr, uid, {
                                 'name':'PROD:' + production.name + '/'+ operation.name,
                                 'date': production.date_planned,
                                 'product_id': line.product_id.id,
                                 'product_qty': line.product_qty,
-                                'bom_prop': line.product_qty / production.product_qty,
+                                'bom_prop': line.product_qty / operation.semi_prod_qty,  # KGB 'bom_prop': line.product_qty / production.product_qty,
                                 'product_uom': line.product_uom.id,
                                 'product_uos_qty': line.product_uos and line.product_uos_qty or False,
                                 'product_uos': line.product_uos and line.product_uos.id or False,
                                 'location_id': operation.location_id.id,
                                 'location_dest_id': line.product_id.product_tmpl_id.property_stock_production.id,
-                                'state': 'waiting',
+                                'state': 'confirmed',  # KGB2  'state': 'waiting',
                                 'company_id': production.company_id.id,
                                 'operation_id': operation.id,
                             })
                             moves.append(move_id)
-                            move_pick_id = move_obj.create(cr, uid, {
+                            # KGB2 - let scheduler do the job from raw to machine + pull flow
+                            #"""
+                            move_new_id = move_obj.create(cr, uid, {
                                 'name':'PROD:' + production.name + '/'+ operation.name,
                                 'date': production.date_planned,
                                 'product_id': line.product_id.id,
                                 'picking_id': picking_id,
                                 'product_qty': line.product_qty,
-                                'bom_prop': line.product_qty / production.product_qty,
+                                'bom_prop': line.product_qty / operation.semi_prod_qty,  # KGB 'bom_prop': line.product_qty / production.product_qty,
                                 'product_uom': line.product_uom.id,
                                 'product_uos_qty': line.product_uos and line.product_uos_qty or False,
                                 'product_uos': line.product_uos and line.product_uos.id or False,
@@ -740,6 +735,9 @@
                                 'state': 'confirmed',
                                 'company_id': production.company_id.id,
                             })
+                            #"""
+                        # KGB2 - let scheduler do the job from raw to machine + pull flow
+                        #"""
                         wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
                         ##TODO: Create procurements for each consumed product  
                         proc_id = proc_obj.create(cr, uid, {
@@ -753,15 +751,17 @@
                             'product_uos': line.product_uos and production.product_uos.id or False,
                             'location_id': line.product_id.default_location.id,
                             'procure_method': line.product_id.procure_method,
+                            'move_id': move_new_id, #kgb
                             'company_id': production.company_id.id,
                         })
                         wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
                         proc_ids.append(proc_id)
+                        #"""
                     if operation.final_products_ids:
                         picking_id = self.create_picking(cr, uid, pick_type, 'direct', production, operation, 'output')
                     for line in operation.final_products_ids:
-                        move_pick_id = move_obj.create(cr, uid, {
-                                'name':'PROD:' + production.name + '/'+ operation.name,
+                        move_new_id = move_obj.create(cr, uid, {
+                                'name': 'PROD:' + production.name + '/'+ operation.name,
                                 'date': production.date_planned,
                                 'product_id': line.product_id.id,
                                 'picking_id': picking_id,
@@ -776,7 +776,7 @@
                                 'company_id': production.company_id.id,
                             })
                         data = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/' + operation.name,
                             'date': production.date_planned,
                             'product_id': line.product_id.id,
                             'product_qty': line.product_qty,
@@ -789,14 +789,16 @@
                             'state': 'waiting',
                             'company_id': production.company_id.id,
                             'operation_id': operation.id,
+                            # KGB TODO waiting for what?  'move_dest_id': move_id,
+
                         })
                         res_final_ids.append(data)
                         wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
                     if not next_operation:
                         if not operation.final_products_ids:
                             picking_id = self.create_picking(cr, uid, pick_type, 'direct', production, operation, 'output')
-                        move_pick_id = move_obj.create(cr, uid, {
-                                'name':'PROD:' + production.name + '/'+ operation.name,
+                        move_new_id = move_obj.create(cr, uid, {
+                                'name': 'PROD:' + production.name + '/'+ operation.name,
                                 'date': production.date_planned,
                                 'picking_id': picking_id,
                                 'product_id': production.product_id.id,
@@ -811,7 +813,7 @@
                             })
                         wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
                         product_bom = move_obj.create(cr, uid, {
-                            'name':'PROD:' + production.name + '/'+ operation.name,
+                            'name': 'PROD:' + production.name + '/'+ operation.name,
                             'date': production.date_planned,
                             'product_id': production.product_id.id,
                             'product_qty': production.product_qty,
@@ -826,16 +828,16 @@
                         }) 
                         res_final_ids.append(product_bom)
                 self.write(cr, uid, [production.id], {'move_created_ids': [(6, 0, res_final_ids)]})
-                 
+
             self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6, 0, moves)], 'state':'confirmed'})
             message = _("Manufacturing order '%s' is scheduled for the %s.") % (
                 production.name,
                 datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%m/%d/%Y'),
             )
             self.log(cr, uid, production.id, message)
-                
+
         return {'move_lines': moves, 'move_created_ids': res_final_ids}
-    
+
     def create_picking(self, cr, uid, pick_type, move_type, production, operation, internal_type=False):
         pick_obj = self.pool.get('stock.picking')
         seq_obj = self.pool.get('ir.sequence')
@@ -851,22 +853,22 @@
             'company_id': production.company_id.id,
         })
         return picking_id
-    
+
     def create_purchase(self, cr, uid, next_operation):
         po_obj = self.pool.get('purchase.order')
-        po_lines_obj =self.pool.get('purchase.order.line')
+        po_lines_obj = self.pool.get('purchase.order.line')
         notes = ''
         if (next_operation):
             if (not next_operation.location_id.address_id):
                         raise osv.except_osv(_('External Operation'), _('External operation location must be set on operation!'))
             elif (not next_operation.location_id.address_id.partner_id):
                         raise osv.except_osv(_('External Operation'), _('Partner must be set on external location on operation !'))
-                
+
         notes += _('Products delivered:') + '\n\n'
         for prod in next_operation.components_used_ids:
             notes += (prod.name or '') + ' ' + str(prod.product_qty) + ' ' + prod.product_uom.name + '\n'
         notes += ((next_operation.product_id and next_operation.product_id.name) or '') + ' ' + str(next_operation.semi_prod_qty or 0) + ' ' + ((next_operation.semi_prod_uom and next_operation.semi_prod_uom.name) or '')
-        
+
         po_id = po_obj.create(cr, uid, {
             'origin': next_operation.production_id.name + '/' + next_operation.name,
             'partner_id': next_operation.location_id.address_id.partner_id.id,
@@ -876,17 +878,16 @@
             'notes': notes,
             'state': 'draft',
         })
-        
-        
+
         if not next_operation.workcenter_id.product_id:
             raise osv.except_osv(_('User error'), _('There is no product assigned for the external Work Center!'))
-        
+
         seller_delay = 0
         if next_operation.workcenter_id.product_id.seller_ids:
             for s in next_operation.workcenter_id.product_id.seller_ids:
                 if s.name.id == next_operation.location_id.address_id.partner_id:
                     seller_delay = s.delay
-        
+
         po_lines_obj.create(cr, uid, {
             'name': next_operation.workcenter_id.product_id.name,
             'product_id': next_operation.workcenter_id.product_id.id,
@@ -897,7 +898,7 @@
             'order_id': po_id,
         })
         return True
-    
+
     def create_operator(self, cr, uid, operation):
         user_obj = self.pool.get('mrp.production.users')
         for user in operation.workcenter_id.user_ids:

=== modified file 'mrp_master_extension/mrp_routing.py'
--- mrp_master_extension/mrp_routing.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/mrp_routing.py	2013-07-23 13:13:30 +0000
@@ -26,30 +26,31 @@
     _name = 'routing.fixed.cost'
     _description = 'Routing fixed costs'
     _columns = {
-                'name':fields.char('Description', size = 256),
-                'amount':fields.float('Amount'),
-                'estimated':fields.float('Estimated amount'),
-                'routing_id':fields.many2one('mrp.routing','Routing')
+                'name': fields.char('Description', size = 256),
+                'amount': fields.float('Amount'),
+                'estimated': fields.float('Estimated amount'),
+                'routing_id': fields.many2one('mrp.routing', 'Routing')
                 }
+
 routing_fixed_cost()
 
 
 class mrp_routing(osv.osv):
-    _description = 'Routing'   
+    _description = 'Routing'
     _inherit = 'mrp.routing'
-    
-    _columns = {      
-        'routing_line_ids': fields.one2many('mrp.production.workcenter.line', 'routing_id', 'Operations', required= True),        
-        'fixed_costs':fields.one2many('routing.fixed.cost','routing_id','Fixed costs'),
+
+    _columns = {
+        'routing_line_ids': fields.one2many('mrp.production.workcenter.line', 'routing_id', 'Operations', required = True),
+        'fixed_costs': fields.one2many('routing.fixed.cost','routing_id','Fixed costs'),
     }
-  
+
 mrp_routing()
 
 # The name of this class has to be changed!! This class is not related with production but routing.
 class mrp_production_workcenter_line(osv.osv):
     _inherit='mrp.production.workcenter.line'
     _description = 'Work Order'
-    
+
     _columns = {
         'name': fields.char('Code', size= 64),
         'descript': fields.text('Description', size = 64),
@@ -64,19 +65,19 @@
         'hour': lambda *a: 0,
         'cycle': lambda *a: 0,
     }
-    
+
     def wc_onchange(self, cr, uid, ids, workcenter_id):
         value = {}
         if workcenter_id:
             wc = self.pool.get('mrp.workcenter').browse(cr, uid, workcenter_id)
             value['location_id'] = wc.location_id.id
         return {'value': value}
-    
+
     def opt_onchange(self, cr, uid, ids, operation_id):
         value = {}
         if operation_id:
             opt = self.pool.get('mrp.operation').browse(cr, uid, operation_id)
             value['name'] = opt.cod
         return {'value': value}
-    
+
 mrp_production_workcenter_line()

=== modified file 'mrp_master_extension/mrp_workcenter.py'
--- mrp_master_extension/mrp_workcenter.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/mrp_workcenter.py	2013-07-23 13:13:30 +0000
@@ -18,14 +18,15 @@
 #
 ##############################################################################
 
-from osv import fields,osv
+from osv import fields, osv
 from tools.translate import _
-    
-class mrp_workcenter(osv.osv):   
-     _description = 'Work Center Inheritance'
-     _inherit = 'mrp.workcenter'
-     
-     _columns = {
+
+
+class mrp_workcenter(osv.osv):
+    _description = 'Work Center Inheritance'
+    _inherit = 'mrp.workcenter'
+
+    _columns = {
                 'location_id': fields.many2one('stock.location', 'Location', required= True, domain=[('usage','in',('internal','supplier'))]),
                 'purchase_date': fields.date('Purchase Date', size = 32, help = "The machine's purchase date"),
                 'warranty_date': fields.date('Warranty Date', size = 32, help = "Warranty limit date of the Work Center"),
@@ -37,43 +38,33 @@
                 'operations_product_ids': fields.one2many('mrp.bom.operations.product', 'workcenter_id', 'Work Center', required= True),
                 'user_ids': fields.many2many('res.users', 'mrp_wc_user_rel', 'workcenter_id', 'user_id'),
             }
-     
-     def _check_location_product(self, cr, uid, ids, context=None):
+
+    def _check_location_product(self, cr, uid, ids, context=None):
         for wc in self.browse(cr, uid, ids, context=context):
             product_id = wc.product_id and wc.product_id.id
             location_usage = wc.location_id and wc.location_id.usage
-            
             if location_usage == 'supplier' and not product_id:
                 return False
         return True
-    
-     _constraints = [
+
+    _constraints = [
         (_check_location_product, 'If location usage is of type supplier then product cant be null.', ['location_id','product_id']),
         ]
-     
-     def cycle_onchange(self, cr, uid, ids, time_cycle, costs_hour):
+
+    def cycle_onchange(self, cr, uid, ids, time_cycle, costs_hour):
         value = {}
         costh = costs_hour * time_cycle
         value['costs_cycle'] = costh
         return {'value':value}
-    
-     def default_get(self, cr, uid, fields_list, context=None):
 
+    def default_get(self, cr, uid, fields_list, context=None):
         if context == None:
-
             context = {}
-
         res = super(mrp_workcenter, self).default_get(cr, uid, fields_list, context)
-
         if 'factory' in context.keys():
-
             if context['factory']:
-
                 ids = self.pool.get('mrp.factory').search(cr, uid, [('name', '=', context['factory'])])
-
                 res.update({'factory_id': ids[0]})
- 
         return res
-     
-     
+
 mrp_workcenter()
\ No newline at end of file

=== modified file 'mrp_master_extension/procurement_order_ext.py'
--- mrp_master_extension/procurement_order_ext.py	2013-06-21 12:35:14 +0000
+++ mrp_master_extension/procurement_order_ext.py	2013-07-23 13:13:30 +0000
@@ -23,10 +23,10 @@
 from tools.translate import _
 import decimal_precision as dp
 
+
 class procurement_order(osv.osv):
-
     _inherit = 'procurement.order'
-    
+
     def make_mo(self, cr, uid, ids, context=None):
         production_obj = self.pool.get('mrp.production')
         res = super(procurement_order,self).make_mo(cr, uid, ids, context)
@@ -38,13 +38,8 @@
                         if ids:
                             for production in production_obj.browse(cr,uid,production_ids):
                                 production_obj.write(cr,uid,[production.id],{'sale_order_id': procurement.move_id.sale_line_id.order_id.id})
-                    
-            
-        
-        
         return res
-        
-        
+        # KGB Dead code WIP?
         """ Make Manufacturing(production) order from procurement
         @return: New created Production Orders procurement wise 
         """
@@ -82,6 +77,4 @@
                         {'location_id': procurement.location_id.id})
         return res
 
-
-      
 procurement_order()
\ No newline at end of file

=== modified file 'mrp_master_extension/product/product.py'
--- mrp_master_extension/product/product.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/product/product.py	2013-07-23 13:13:30 +0000
@@ -20,15 +20,16 @@
 
 from osv import fields,osv
 from tools.translate import _
-    
+
+
 class product_product(osv.osv):
-     _name = 'product.product'
-     _description = 'MRP Product Extension'
-     _inherit = 'product.product'
-     
-     _columns = {
+    _name = 'product.product'
+    _description = 'MRP Product Extension'
+    _inherit = 'product.product'
+
+    _columns = {
                 'default_location':fields.many2one('stock.location', 'Default Location', help='Default real location of the product'),
                 'mrp_bom_fp_id': fields.many2one('mrp.bom.operations.product', 'bom final products' ),
             }
-     
-product_product()
\ No newline at end of file
+
+product_product()

=== modified file 'mrp_master_extension/res/res_users.py'
--- mrp_master_extension/res/res_users.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/res/res_users.py	2013-07-23 13:13:30 +0000
@@ -21,10 +21,9 @@
 from osv import osv
 from osv import fields
 
+
 class users(osv.osv):
-
     _inherit = 'res.users'
- 
     _columns = {
             'workcenter_ids': fields.many2many('mrp.workcenter', 'mrp_wc_user_rel', 'user_id', 'workcenter_id'),
     }

=== added directory 'mrp_master_extension/security'
=== added file 'mrp_master_extension/security/ir.model.access.csv'
--- mrp_master_extension/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ mrp_master_extension/security/ir.model.access.csv	2013-07-23 13:13:30 +0000
@@ -0,0 +1,23 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_mrp_factory_mrp_manager,mrp_factory mrp_manager,model_mrp_factory,mrp.group_mrp_manager,1,1,1,1
+access_mrp_factory_mrp_user,mrp_factory mrp_user,model_mrp_factory,mrp.group_mrp_user,1,0,0,0
+access_bom_fixed_cost_mrp_manager,bom_fixed_cost mrp_manager,model_bom_fixed_cost,mrp.group_mrp_manager,1,1,1,1
+access_bom_fixed_cost_mrp_user,bom_fixed_cost mrp_user,model_bom_fixed_cost,mrp.group_mrp_user,1,0,0,0
+access_routing_fixed_cost_mrp_manager,routing_fixed_cost mrp_manager,model_routing_fixed_cost,mrp.group_mrp_manager,1,1,1,1
+access_routing_fixed_cost_mrp_user,routing_fixed_cost mrp_user,model_routing_fixed_cost,mrp.group_mrp_user,1,0,0,0
+access_mrp_fixed_cost_mrp_manager,mrp_fixed_cost mrp_manager,model_mrp_fixed_cost,mrp.group_mrp_manager,1,1,1,1
+access_mrp_fixed_cost_cost_mrp_user,mrp_fixed_cost mrp_user,model_mrp_fixed_cost,mrp.group_mrp_user,1,0,0,0
+access_mrp_production_operation_mrp_manager,mrp_production_operation mrp_manager,model_mrp_production_operation,mrp.group_mrp_manager,1,1,1,1
+access_mrp_production_operation_mrp_user,mrp_production_operation mrp_user,model_mrp_production_operation,mrp.group_mrp_user,1,0,0,0
+access_mrp_production_final_product_manager,mrp_production_final_product mrp_manager,model_mrp_production_final_product,mrp.group_mrp_manager,1,1,1,1
+access_mrp_production_final_product_mrp_user,mrp_production_final_product mrp_user,model_mrp_production_final_product,mrp.group_mrp_user,1,0,0,0
+access_mrp_production_users_mrp_manager,mrp_production_users mrp_manager,model_mrp_production_users,mrp.group_mrp_manager,1,1,1,1
+access_mrp_production_users_mrp_user,mrp_production_users mrp_user,model_mrp_production_users,mrp.group_mrp_user,1,0,0,0
+access_mrp_operation_mrp_manager,mrp_operation mrp_manager,model_mrp_operation,mrp.group_mrp_manager,1,1,1,1
+access_mrp_operation_mrp_user,mrp_operation mrp_user,model_mrp_operation,mrp.group_mrp_user,1,0,0,0
+access_mrp_bom_operations_product_mrp_manager,mrp_bom_operations_product mrp_manager,model_mrp_bom_operations_product,mrp.group_mrp_manager,1,1,1,1
+access_mrp_bom_operations_product_mrp_user,mrp_bom_operations_product mrp_user,model_mrp_bom_operations_product,mrp.group_mrp_user,1,0,0,0
+access_mrp_bom_operations_product_mrp_manager,mrp_bom_operations_product mrp_manager,model_mrp_bom_operations_product,mrp.group_mrp_manager,1,1,1,1
+access_mrp_bom_operations_product_mrp_user,mrp_bom_operations_product mrp_user,model_mrp_bom_operations_product,mrp.group_mrp_user,1,0,0,0
+access_mrp_bom_final_product_mrp_manager,mrp_bom_final_product mrp_manager,model_mrp_bom_final_product,mrp.group_mrp_manager,1,1,1,1
+access_mrp_bom_final_product_mrp_user,mrp_bom_final_product mrp_user,model_mrp_bom_final_product,mrp.group_mrp_user,1,0,0,0
\ No newline at end of file

=== modified file 'mrp_master_extension/stock/stock.py'
--- mrp_master_extension/stock/stock.py	2012-10-15 09:01:48 +0000
+++ mrp_master_extension/stock/stock.py	2013-07-23 13:13:30 +0000
@@ -22,31 +22,31 @@
 import decimal_precision as dp
 from tools.translate import _
 
+
 class stock_picking(osv.osv):
-    
-    _inherit = 'stock.picking' 
-    
+    _inherit = 'stock.picking'
     _columns = {
-            'internal_type':fields.selection([('input','Production Input'),('output','Production Output')], 'Type'),
+            'internal_type': fields.selection([
+                                               ('input', 'Production Input'),
+                                               ('output', 'Production Output')
+                                              ], 'Type'),
     }
-    
 stock_picking()
 
+
 class StockMove(osv.osv):
-    
     _inherit = 'stock.move'
-    
     _columns = {
         'operation_id': fields.many2one('mrp.production.operation', 'Production Operation'),
         'bom_prop': fields.float('BOM Proportion'),
     }
-    
-    _defaults = {  
+
+    _defaults = {
         'bom_prop': lambda *a: 1.0,
     }
 
     #funcion basada en action_consume de stock.move
-    
+
     def action_produce(self, cr, uid, ids, quantity, location_id=False, context=None):
         if context is None:
             context = {}
@@ -87,14 +87,14 @@
 
             else:
                 quantity_rest = quantity
-                uos_qty_rest =  uos_qty
+                uos_qty_rest = uos_qty
                 if (not move.prodlot_id.id) and (move.product_id.track_production and location_id):
                     res += self.action_split(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
                 else:
                     res += [move.id]
                     update_val = {
-                        'product_qty' : quantity_rest,
-                        'product_uos_qty' : uos_qty_rest,
+                        'product_qty': quantity_rest,
+                        'product_uos_qty': uos_qty_rest,
                         'location_id': location_id or move.location_id.id
                     }
                     self.write(cr, uid, [move.id], update_val)


Follow ups