[REF] mrp: Changes made according to pep-8 standards. Improved coding i.e. removed self.pool.get from inside the loops.
bzr revid: uco@tinyerp.co.in-20100406085706-9zotp2ele4e6udss
This commit is contained in:
@@ -26,23 +26,23 @@ class mrp_installer(osv.osv_memory):
|
||||
|
||||
_columns = {
|
||||
# Manufacturing Resource Planning
|
||||
'stock_location':fields.boolean('Advanced Routes',
|
||||
'stock_location': fields.boolean('Advanced Routes',
|
||||
help="Manages product routes and paths within and between "
|
||||
"locations (e.g. warehouses)"),
|
||||
'mrp_jit':fields.boolean('Just In Time Scheduling',
|
||||
'mrp_jit': fields.boolean('Just In Time Scheduling',
|
||||
help="Enables Just In Time computation of procurement orders."
|
||||
"\n\nWhile it's more resource intensive than the default "
|
||||
"setup, the JIT computer avoids having to wait for the "
|
||||
"procurement scheduler to run or having to run the "
|
||||
"procurement scheduler manually."),
|
||||
'mrp_operations':fields.boolean('Manufacturing Operations',
|
||||
'mrp_operations': fields.boolean('Manufacturing Operations',
|
||||
help="Enhances production orders with readiness states as well "
|
||||
"as the dates of start and end of execution of the order."),
|
||||
'mrp_subproduct':fields.boolean('MRP Subproducts',
|
||||
'mrp_subproduct': fields.boolean('MRP Subproducts',
|
||||
help="Enables multiple product output from a single production "
|
||||
"order: without this, a productio order can have only one "
|
||||
"output product."),
|
||||
'mrp_repair':fields.boolean('Repairs',
|
||||
'mrp_repair': fields.boolean('Repairs',
|
||||
help="Enables warranty and repair management (and their impact "
|
||||
"on stocks and invoicing)."),
|
||||
}
|
||||
|
||||
+92
-87
@@ -161,15 +161,16 @@ class mrp_bom(osv.osv):
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
result = {}
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
for bom in self.browse(cr, uid, ids, context=context):
|
||||
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
|
||||
if bom.bom_lines:
|
||||
continue
|
||||
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
|
||||
if bom.type=='phantom' or ok:
|
||||
sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
|
||||
sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
|
||||
if sids:
|
||||
bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context)
|
||||
bom2 = bom_obj.browse(cr, uid, sids[0], context=context)
|
||||
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
|
||||
|
||||
return result
|
||||
@@ -182,13 +183,13 @@ class mrp_bom(osv.osv):
|
||||
"""
|
||||
res = dict(map(lambda x: (x,''), ids))
|
||||
for line in self.browse(cr, uid, ids):
|
||||
if line.type=='phantom' and not line.bom_id:
|
||||
if line.type == 'phantom' and not line.bom_id:
|
||||
res[line.id] = 'set'
|
||||
continue
|
||||
if line.bom_lines or line.type=='phantom':
|
||||
if line.bom_lines or line.type == 'phantom':
|
||||
continue
|
||||
if line.product_id.supply_method=='produce':
|
||||
if line.product_id.procure_method=='make_to_stock':
|
||||
if line.product_id.supply_method == 'produce':
|
||||
if line.product_id.procure_method == 'make_to_stock':
|
||||
res[line.id] = 'stock'
|
||||
else:
|
||||
res[line.id] = 'order'
|
||||
@@ -220,9 +221,9 @@ class mrp_bom(osv.osv):
|
||||
'property_ids': fields.many2many('mrp.property', 'mrp_bom_property_rel', 'bom_id','property_id', 'Properties'),
|
||||
'revision_ids': fields.one2many('mrp.bom.revision', 'bom_id', 'BoM Revisions'),
|
||||
'revision_type': fields.selection([('numeric','numeric indices'),('alpha','alphabetical indices')], 'Index type'),
|
||||
'child_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
|
||||
'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
|
||||
'company_id': fields.many2one('res.company','Company',required=True),
|
||||
'child_ids': fields.function(_child_compute, relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
|
||||
'child_complete_ids': fields.function(_child_compute, relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'multi_level_bom': fields.boolean('Multi-level BoM'),
|
||||
|
||||
}
|
||||
@@ -262,8 +263,8 @@ class mrp_bom(osv.osv):
|
||||
@return: Dictionary of changed values
|
||||
"""
|
||||
if product_id:
|
||||
prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0]
|
||||
v = {'product_uom':prod.uom_id.id}
|
||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
|
||||
v = {'product_uom': prod.uom_id.id}
|
||||
if not name:
|
||||
v['name'] = prod.name
|
||||
return {'value': v}
|
||||
@@ -286,8 +287,8 @@ class mrp_bom(osv.osv):
|
||||
prop = 0
|
||||
for prop_id in bom.property_ids:
|
||||
if prop_id.id in properties:
|
||||
prop+=1
|
||||
if (prop>max_prop) or ((max_prop==0) and not result):
|
||||
prop += 1
|
||||
if (prop > max_prop) or ((max_prop == 0) and not result):
|
||||
result = bom.id
|
||||
max_prop = prop
|
||||
return result
|
||||
@@ -304,20 +305,20 @@ class mrp_bom(osv.osv):
|
||||
"""
|
||||
factor = factor / (bom.product_efficiency or 1.0)
|
||||
factor = rounding(factor, bom.product_rounding)
|
||||
if factor<bom.product_rounding:
|
||||
if factor < bom.product_rounding:
|
||||
factor = bom.product_rounding
|
||||
result = []
|
||||
result2 = []
|
||||
phantom=False
|
||||
if bom.type=='phantom' and not bom.bom_lines:
|
||||
phantom = False
|
||||
if bom.type == 'phantom' and not bom.bom_lines:
|
||||
newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties)
|
||||
if newbom:
|
||||
res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10)
|
||||
result = result + res[0]
|
||||
result2 = result2 + res[1]
|
||||
phantom=True
|
||||
phantom = True
|
||||
else:
|
||||
phantom=False
|
||||
phantom = False
|
||||
if not phantom:
|
||||
if addthis and not bom.bom_lines:
|
||||
result.append(
|
||||
@@ -348,7 +349,7 @@ class mrp_bom(osv.osv):
|
||||
result2 = result2 + res[1]
|
||||
return result, result2
|
||||
|
||||
def set_indices(self, cr, uid, ids, context = {}):
|
||||
def set_indices(self, cr, uid, ids, context={}):
|
||||
""" Sets Indices.
|
||||
@return: True
|
||||
"""
|
||||
@@ -361,10 +362,10 @@ class mrp_bom(osv.osv):
|
||||
bom_rev_obj = self.pool.get('mrp.bom.revision')
|
||||
for rev_id in rev_ids:
|
||||
if res[0]['revision_type'] == 'numeric':
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice' : idx})
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice': idx})
|
||||
else:
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice' : "%c"%(idx+96,)})
|
||||
idx+=1
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice': "%c" %(idx+96,)})
|
||||
idx += 1
|
||||
return True
|
||||
|
||||
mrp_bom()
|
||||
@@ -372,6 +373,7 @@ mrp_bom()
|
||||
class mrp_bom_revision(osv.osv):
|
||||
_name = 'mrp.bom.revision'
|
||||
_description = 'Bill of material revisions'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Modification name', size=64, required=True),
|
||||
'description': fields.text('Description'),
|
||||
@@ -383,7 +385,7 @@ class mrp_bom_revision(osv.osv):
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'author_id': lambda x,y,z,c: z,
|
||||
'author_id': lambda x, y, z, c: z,
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
@@ -443,7 +445,7 @@ class mrp_production(osv.osv):
|
||||
|
||||
def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}):
|
||||
""" Calculates total hours and total no. of cycles for a production order.
|
||||
@param prop:
|
||||
@param prop: Name of field.
|
||||
@param unknow_none:
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
@@ -541,10 +543,11 @@ class mrp_production(osv.osv):
|
||||
'state': lambda *a: 'draft',
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
|
||||
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
|
||||
}
|
||||
_order = 'date_planned asc, priority desc';
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
productions = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
@@ -587,8 +590,8 @@ class mrp_production(osv.osv):
|
||||
return {}
|
||||
res = self.pool.get('product.product').read(cr, uid, [product], ['uom_id'])[0]
|
||||
uom = res['uom_id'] and res['uom_id'][0]
|
||||
result = {'product_uom':uom}
|
||||
return {'value':result}
|
||||
result = {'product_uom': uom}
|
||||
return {'value': result}
|
||||
|
||||
def bom_id_change(self, cr, uid, ids, product):
|
||||
""" Finds routing for changed BoM.
|
||||
@@ -599,14 +602,14 @@ class mrp_production(osv.osv):
|
||||
return {}
|
||||
res = self.pool.get('mrp.bom').read(cr, uid, [product], ['routing_id'])[0]
|
||||
routing_id = res['routing_id'] and res['routing_id'][0]
|
||||
result = {'routing_id':routing_id}
|
||||
return {'value':result}
|
||||
result = {'routing_id': routing_id}
|
||||
return {'value': result}
|
||||
|
||||
def action_picking_except(self, cr, uid, ids):
|
||||
""" Changes the state to Exception.
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state':'picking_except'})
|
||||
self.write(cr, uid, ids, {'state': 'picking_except'})
|
||||
return True
|
||||
|
||||
def action_compute(self, cr, uid, ids, properties=[]):
|
||||
@@ -657,7 +660,7 @@ class mrp_production(osv.osv):
|
||||
if production.move_created_ids:
|
||||
move_obj.action_cancel(cr, uid, [x.id for x in production.move_created_ids])
|
||||
move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines])
|
||||
self.write(cr, uid, ids, {'state':'cancel'}) #,'move_lines':[(6,0,[])]})
|
||||
self.write(cr, uid, ids, {'state': 'cancel'}) #,'move_lines':[(6,0,[])]})
|
||||
return True
|
||||
|
||||
#XXX: may be a bug here; lot_lines are unreserved for a few seconds;
|
||||
@@ -667,11 +670,11 @@ class mrp_production(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
move_obj = self.pool.get('stock.move')
|
||||
self.write(cr, uid, ids, {'state':'ready'})
|
||||
self.write(cr, uid, ids, {'state': 'ready'})
|
||||
for production in self.browse(cr, uid, ids):
|
||||
if production.move_prod_id:
|
||||
move_obj.write(cr, uid, [production.move_prod_id.id],
|
||||
{'location_id':production.location_dest_id.id})
|
||||
{'location_id': production.location_dest_id.id})
|
||||
return True
|
||||
|
||||
def action_production_end(self, cr, uid, ids):
|
||||
@@ -680,7 +683,7 @@ class mrp_production(osv.osv):
|
||||
"""
|
||||
for production in self.browse(cr, uid, ids):
|
||||
self._costs_generate(cr, uid, production)
|
||||
return self.write(cr, uid, ids, {'state': 'done', 'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return self.write(cr, uid, ids, {'state': 'done', 'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
def test_production_done(self, cr, uid, ids):
|
||||
""" Tests whether production is done or not.
|
||||
@@ -765,7 +768,7 @@ class mrp_production(osv.osv):
|
||||
if final_product.id not in parent_move_ids:
|
||||
new_parent_ids.append(final_product.id)
|
||||
for new_parent_id in new_parent_ids:
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids':[(4,new_parent_id)]})
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids': [(4,new_parent_id)]})
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce_done', cr)
|
||||
@@ -786,7 +789,7 @@ class mrp_production(osv.osv):
|
||||
if value and account:
|
||||
amount += value
|
||||
analytic_line_obj.create(cr, uid, {
|
||||
'name': wc_line.name+' (H)',
|
||||
'name': wc_line.name + ' (H)',
|
||||
'amount': value,
|
||||
'account_id': account,
|
||||
'general_account_id': wc.costs_general_account_id.id,
|
||||
@@ -813,7 +816,7 @@ class mrp_production(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
move_ids = []
|
||||
self.write(cr, uid, ids, {'state': 'in_production','date_start':time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
self.write(cr, uid, ids, {'state': 'in_production', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return True
|
||||
|
||||
def test_if_product(self, cr, uid, ids):
|
||||
@@ -834,12 +837,13 @@ class mrp_production(osv.osv):
|
||||
""" Confirms production order.
|
||||
@return: Newly generated picking Id.
|
||||
"""
|
||||
picking_id=False
|
||||
picking_id = False
|
||||
proc_ids = []
|
||||
seq_obj = self.pool.get('ir.sequence')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
proc_obj = self.pool.get('mrp.procurement')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for production in self.browse(cr, uid, ids):
|
||||
if not production.product_lines:
|
||||
self.action_compute(cr, uid, [production.id])
|
||||
@@ -849,14 +853,14 @@ class mrp_production(osv.osv):
|
||||
address_id = False
|
||||
if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
|
||||
routing_loc = production.bom_id.routing_id.location_id
|
||||
if routing_loc.usage<>'internal':
|
||||
if routing_loc.usage <> 'internal':
|
||||
pick_type = 'out'
|
||||
address_id = routing_loc.address_id and routing_loc.address_id.id or False
|
||||
routing_loc = routing_loc.id
|
||||
pick_name = seq_obj.get(cr, uid, 'stock.picking.'+pick_type)
|
||||
pick_name = seq_obj.get(cr, uid, 'stock.picking.' + pick_type)
|
||||
picking_id = pick_obj.create(cr, uid, {
|
||||
'name': pick_name,
|
||||
'origin': (production.origin or '').split(':')[0] +':'+production.name,
|
||||
'origin': (production.origin or '').split(':')[0] + ':' + production.name,
|
||||
'type': pick_type,
|
||||
'move_type': 'one',
|
||||
'state': 'auto',
|
||||
@@ -867,7 +871,7 @@ class mrp_production(osv.osv):
|
||||
|
||||
source = production.product_id.product_tmpl_id.property_stock_production.id
|
||||
data = {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'date_planned': production.date_planned,
|
||||
'product_id': production.product_id.id,
|
||||
'product_qty': production.product_qty,
|
||||
@@ -885,11 +889,11 @@ class mrp_production(osv.osv):
|
||||
self.write(cr, uid, [production.id], {'move_created_ids': [(6, 0, [res_final_id])]})
|
||||
moves = []
|
||||
for line in production.product_lines:
|
||||
move_id=False
|
||||
move_id = False
|
||||
newdate = production.date_planned
|
||||
if line.product_id.type in ('product', 'consu'):
|
||||
res_dest_id = move_obj.create(cr, uid, {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'date_planned': production.date_planned,
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.product_qty,
|
||||
@@ -904,7 +908,7 @@ class mrp_production(osv.osv):
|
||||
})
|
||||
moves.append(res_dest_id)
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'picking_id':picking_id,
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.product_qty,
|
||||
@@ -932,12 +936,10 @@ class mrp_production(osv.osv):
|
||||
'move_id': move_id,
|
||||
'company_id': production.company_id.id,
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
|
||||
proc_ids.append(proc_id)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
self.write(cr, uid, [production.id], {'picking_id':picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
|
||||
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
|
||||
return picking_id
|
||||
|
||||
def force_production(self, cr, uid, ids, *args):
|
||||
@@ -955,6 +957,7 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
_name = 'mrp.production.workcenter.line'
|
||||
_description = 'Work Orders'
|
||||
_order = 'sequence'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Work Order', size=64, required=True),
|
||||
'workcenter_id': fields.many2one('mrp.workcenter', 'Work Center', required=True),
|
||||
@@ -973,6 +976,7 @@ mrp_production_workcenter_line()
|
||||
class mrp_production_product_line(osv.osv):
|
||||
_name = 'mrp.production.product.line'
|
||||
_description = 'Production scheduled products'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True),
|
||||
@@ -998,6 +1002,7 @@ class mrp_procurement(osv.osv):
|
||||
_name = "mrp.procurement"
|
||||
_description = "Procurement"
|
||||
_order = 'priority,date_planned'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Reason', size=64, required=True, help='Requisition name.'),
|
||||
'origin': fields.char('Source Document', size=64,
|
||||
@@ -1038,7 +1043,7 @@ class mrp_procurement(osv.osv):
|
||||
('waiting','Waiting')], 'State', required=True,
|
||||
help='When a procurement is created the state is set to \'Draft\'.\n If the procurement is confirmed, the state is set to \'Confirmed\'.\
|
||||
\nAfter confirming the state is set to \'Running\'.\n If any exception arises in the order then the state is set to \'Exception\'.\n Once the exception is removed the state becomes \'Ready\'.\n It is in \'Waiting\'. state when the procurement is waiting for another one to finish.'),
|
||||
'note' : fields.text('Note'),
|
||||
'note': fields.text('Note'),
|
||||
'company_id': fields.many2one('res.company','Company',required=True),
|
||||
}
|
||||
_defaults = {
|
||||
@@ -1047,7 +1052,7 @@ class mrp_procurement(osv.osv):
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'close_move': lambda *a: 0,
|
||||
'procure_method': lambda *a: 'make_to_order',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
|
||||
}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
@@ -1066,10 +1071,10 @@ class mrp_procurement(osv.osv):
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if product_id:
|
||||
w=self.pool.get('product.product').browse(cr,uid,product_id, context)
|
||||
w = self.pool.get('product.product').browse(cr, uid, product_id, context)
|
||||
v = {
|
||||
'product_uom':w.uom_id.id,
|
||||
'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id
|
||||
'product_uom': w.uom_id.id,
|
||||
'product_uos': w.uos_id and w.uos_id.id or w.uom_id.id
|
||||
}
|
||||
return {'value': v}
|
||||
return {}
|
||||
@@ -1092,7 +1097,7 @@ class mrp_procurement(osv.osv):
|
||||
for procurement in self.browse(cr, uid, ids, context):
|
||||
if procurement.move_id:
|
||||
ok = True
|
||||
if not procurement.move_id.state=='cancel':
|
||||
if not procurement.move_id.state == 'cancel':
|
||||
res = False
|
||||
return res and ok
|
||||
|
||||
@@ -1103,7 +1108,7 @@ class mrp_procurement(osv.osv):
|
||||
res = True
|
||||
for proc in self.browse(cr, uid, ids, context):
|
||||
if proc.move_id:
|
||||
if not proc.move_id.state=='done':
|
||||
if not proc.move_id.state == 'done':
|
||||
res = False
|
||||
return res
|
||||
|
||||
@@ -1116,7 +1121,7 @@ class mrp_procurement(osv.osv):
|
||||
@param proc: Current procurement.
|
||||
@return: Quantity or False.
|
||||
"""
|
||||
if proc.product_id.type=='product':
|
||||
if proc.product_id.type == 'product':
|
||||
if proc.move_id.product_uos:
|
||||
return proc.move_id.product_uos_qty
|
||||
return False
|
||||
@@ -1126,7 +1131,7 @@ class mrp_procurement(osv.osv):
|
||||
@param proc: Current procurement.
|
||||
@return: UoS or False.
|
||||
"""
|
||||
if proc.product_id.type=='product':
|
||||
if proc.product_id.type == 'product':
|
||||
if proc.move_id.product_uos:
|
||||
return proc.move_id.product_uos.id
|
||||
return False
|
||||
@@ -1160,7 +1165,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True or False
|
||||
"""
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.move_id and procurement.move_id.state=='auto':
|
||||
if procurement.move_id and procurement.move_id.state == 'auto':
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1185,7 +1190,7 @@ class mrp_procurement(osv.osv):
|
||||
"""
|
||||
ok = True
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.product_id.type=='service':
|
||||
if procurement.product_id.type == 'service':
|
||||
ok = ok and self._check_make_to_stock_service(cr, uid, procurement, context)
|
||||
else:
|
||||
ok = ok and self._check_make_to_stock_product(cr, uid, procurement, context)
|
||||
@@ -1198,7 +1203,7 @@ class mrp_procurement(osv.osv):
|
||||
res = True
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid)
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.product_id.product_tmpl_id.supply_method<>'produce':
|
||||
if procurement.product_id.product_tmpl_id.supply_method <> 'produce':
|
||||
if procurement.product_id.seller_ids:
|
||||
partner = procurement.product_id.seller_ids[0].name
|
||||
if user.company_id and user.company_id.partner_id:
|
||||
@@ -1220,7 +1225,7 @@ class mrp_procurement(osv.osv):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid)
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.product_id.product_tmpl_id.supply_method<>'buy':
|
||||
if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
|
||||
return False
|
||||
if not procurement.product_id.seller_ids:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
|
||||
@@ -1240,7 +1245,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True or False
|
||||
"""
|
||||
for record in self.browse(cr, uid, ids):
|
||||
if record.move_id and record.move_id.state=='cancel':
|
||||
if record.move_id and record.move_id.state == 'cancel':
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1255,32 +1260,32 @@ class mrp_procurement(osv.osv):
|
||||
if procurement.product_id.type in ('product', 'consu'):
|
||||
if not procurement.move_id:
|
||||
source = procurement.location_id.id
|
||||
if procurement.procure_method=='make_to_order':
|
||||
if procurement.procure_method == 'make_to_order':
|
||||
source = procurement.product_id.product_tmpl_id.property_stock_procurement.id
|
||||
id = move_obj.create(cr, uid, {
|
||||
'name': 'PROC:'+procurement.name,
|
||||
'name': 'PROC:' + procurement.name,
|
||||
'location_id': source,
|
||||
'location_dest_id': procurement.location_id.id,
|
||||
'product_id': procurement.product_id.id,
|
||||
'product_qty':procurement.product_qty,
|
||||
'product_qty': procurement.product_qty,
|
||||
'product_uom': procurement.product_uom.id,
|
||||
'date_planned': procurement.date_planned,
|
||||
'state':'confirmed',
|
||||
'state': 'confirmed',
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move':1})
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1})
|
||||
else:
|
||||
# TODO: check this
|
||||
if procurement.procure_method=='make_to_stock' and procurement.move_id.state in ('waiting',):
|
||||
if procurement.procure_method == 'make_to_stock' and procurement.move_id.state in ('waiting',):
|
||||
id = move_obj.write(cr, uid, [procurement.move_id.id], {'state':'confirmed'})
|
||||
self.write(cr, uid, ids, {'state':'confirmed','message':''})
|
||||
self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
|
||||
return True
|
||||
|
||||
def action_move_assigned(self, cr, uid, ids, context={}):
|
||||
""" Changes procurement state to Running and writes message.
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state':'running','message':_('from stock: products assigned.')})
|
||||
self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')})
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context={}):
|
||||
@@ -1306,7 +1311,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
self.write(cr, uid, [procurement.id], {'state':'running'})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
return True
|
||||
|
||||
def action_produce_assign_product(self, cr, uid, ids, context={}):
|
||||
@@ -1346,12 +1351,12 @@ class mrp_procurement(osv.osv):
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
res[procurement.id] = produce_id
|
||||
self.write(cr, uid, [procurement.id], {'state':'running'})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
bom_result = production_obj.action_compute(cr, uid,
|
||||
[produce_id], properties=[x.id for x in procurement.property_ids])
|
||||
wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
|
||||
move_obj.write(cr, uid, [res_id],
|
||||
{'location_id':procurement.location_id.id})
|
||||
{'location_id': procurement.location_id.id})
|
||||
return res
|
||||
|
||||
def action_po_assign(self, cr, uid, ids, context={}):
|
||||
@@ -1385,7 +1390,7 @@ class mrp_procurement(osv.osv):
|
||||
|
||||
qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
|
||||
if procurement.product_id.seller_ids[0].qty:
|
||||
qty=max(qty,procurement.product_id.seller_ids[0].qty)
|
||||
qty = max(qty,procurement.product_id.seller_ids[0].qty)
|
||||
|
||||
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
|
||||
|
||||
@@ -1394,9 +1399,9 @@ class mrp_procurement(osv.osv):
|
||||
newdate = newdate - procurement.product_id.seller_ids[0].delay
|
||||
|
||||
#Passing partner_id to context for purchase order line integrity of Line name
|
||||
context.update({'lang':partner.lang, 'partner_id':partner_id})
|
||||
context.update({'lang': partner.lang, 'partner_id': partner_id})
|
||||
|
||||
product = prod_obj.browse(cr,uid,procurement.product_id.id,context=context)
|
||||
product = prod_obj.browse(cr, uid, procurement.product_id.id, context=context)
|
||||
|
||||
line = {
|
||||
'name': product.partner_ref,
|
||||
@@ -1406,13 +1411,13 @@ class mrp_procurement(osv.osv):
|
||||
'price_unit': price,
|
||||
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'move_dest_id': res_id,
|
||||
'notes':product.description_purchase,
|
||||
'notes': product.description_purchase,
|
||||
}
|
||||
|
||||
taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
|
||||
taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
|
||||
line.update({
|
||||
'taxes_id':[(6,0,taxes)]
|
||||
'taxes_id': [(6,0,taxes)]
|
||||
})
|
||||
purchase_id = po_obj.create(cr, uid, {
|
||||
'origin': procurement.origin,
|
||||
@@ -1425,7 +1430,7 @@ class mrp_procurement(osv.osv):
|
||||
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False
|
||||
})
|
||||
res[procurement.id] = purchase_id
|
||||
self.write(cr, uid, [procurement.id], {'state':'running', 'purchase_id':purchase_id})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': purchase_id})
|
||||
return res
|
||||
|
||||
def action_cancel(self, cr, uid, ids):
|
||||
@@ -1437,16 +1442,16 @@ class mrp_procurement(osv.osv):
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for proc in self.browse(cr, uid, ids):
|
||||
if proc.close_move:
|
||||
if proc.move_id.state not in ('done','cancel'):
|
||||
if proc.move_id.state not in ('done', 'cancel'):
|
||||
todo2.append(proc.move_id.id)
|
||||
else:
|
||||
if proc.move_id and proc.move_id.state=='waiting':
|
||||
if proc.move_id and proc.move_id.state == 'waiting':
|
||||
todo.append(proc.move_id.id)
|
||||
if len(todo2):
|
||||
move_obj.action_cancel(cr, uid, todo2)
|
||||
if len(todo):
|
||||
move_obj.write(cr, uid, todo, {'state':'assigned'})
|
||||
self.write(cr, uid, ids, {'state':'cancel'})
|
||||
move_obj.write(cr, uid, todo, {'state': 'assigned'})
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||
@@ -1461,7 +1466,7 @@ class mrp_procurement(osv.osv):
|
||||
"""
|
||||
ok = False
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.move_id.state=='assigned' or procurement.move_id.state=='done':
|
||||
if procurement.move_id.state == 'assigned' or procurement.move_id.state == 'done':
|
||||
self.action_done(cr, uid, [procurement.id])
|
||||
ok = True
|
||||
return ok
|
||||
@@ -1470,7 +1475,7 @@ class mrp_procurement(osv.osv):
|
||||
""" Changes procurement state to Ready.
|
||||
@return: True
|
||||
"""
|
||||
res = self.write(cr, uid, ids, {'state':'ready'})
|
||||
res = self.write(cr, uid, ids, {'state': 'ready'})
|
||||
return res
|
||||
|
||||
def action_done(self, cr, uid, ids):
|
||||
@@ -1482,7 +1487,7 @@ class mrp_procurement(osv.osv):
|
||||
if procurement.move_id:
|
||||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||
move_obj.action_done(cr, uid, [procurement.move_id.id])
|
||||
res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
|
||||
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||
|
||||
@@ -867,6 +867,7 @@
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="state" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By" colspan="4" col="8">
|
||||
<filter string="Product" icon="terp-mrp" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Reason" icon="terp-mrp" domain="[]" context="{'group_by':'name'}"/>
|
||||
|
||||
+13
-21
@@ -27,13 +27,9 @@ class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
|
||||
def get_product_accounts(self, cr, uid, product_id, context={}):
|
||||
|
||||
"""
|
||||
To get the stock input account, stock output account and stock journal related to product.
|
||||
|
||||
@param product_id : product id
|
||||
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
|
||||
|
||||
""" To get the stock input account, stock output account and stock journal related to product.
|
||||
@param product_id: product id
|
||||
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
|
||||
"""
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
|
||||
|
||||
@@ -55,14 +51,10 @@ class product_product(osv.osv):
|
||||
return res
|
||||
|
||||
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
|
||||
"""
|
||||
Changes the Standard Price of Product and parent products and creates an account move accordingly.
|
||||
|
||||
@param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return:
|
||||
|
||||
""" Changes the Standard Price of Product and parent products and creates an account move accordingly.
|
||||
@param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
#TODO : TO Check
|
||||
res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context)
|
||||
@@ -73,15 +65,15 @@ class product_product(osv.osv):
|
||||
if bom.bom_id.bom_lines :
|
||||
for bom_line in bom.bom_id.bom_lines :
|
||||
prod_price = self.read(cr, uid, bom_line.product_id.id, ['standard_price'])['standard_price']
|
||||
price += bom_line.product_qty * prod_price
|
||||
price += bom_line.product_qty * prod_price
|
||||
|
||||
accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id , context)
|
||||
accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id, context)
|
||||
|
||||
datas = {
|
||||
'new_price' : price,
|
||||
'stock_output_account' : accounts['stock_account_output'],
|
||||
'stock_input_account' : accounts['stock_account_input'],
|
||||
'stock_journal' : accounts['stock_journal']
|
||||
'new_price': price,
|
||||
'stock_output_account': accounts['stock_account_output'],
|
||||
'stock_input_account': accounts['stock_account_input'],
|
||||
'stock_journal': accounts['stock_journal']
|
||||
}
|
||||
super(product_product, self).do_change_standard_price(cr, uid, [bom.bom_id.product_id.id], datas, context)
|
||||
_compute_price(bom.bom_id)
|
||||
|
||||
@@ -60,7 +60,7 @@ class mrp_procurement(osv.osv):
|
||||
cr.execute('select id from mrp_procurement where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
for proc in procurement_obj.browse(cr, uid, ids):
|
||||
if (maxdate.strftime('%Y-%m-%d')>=proc.date_planned):
|
||||
if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
|
||||
else:
|
||||
offset += 1
|
||||
@@ -81,7 +81,7 @@ class mrp_procurement(osv.osv):
|
||||
ids = []
|
||||
while True:
|
||||
report_ids = []
|
||||
ids = self.pool.get('mrp.procurement').search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
|
||||
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
|
||||
for proc in procurement_obj.browse(cr, uid, ids):
|
||||
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
|
||||
@@ -140,7 +140,7 @@ class mrp_procurement(osv.osv):
|
||||
|
||||
for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context):
|
||||
context['warehouse'] = warehouse
|
||||
for product in self.pool.get('product.product').browse(cr, uid, products_id, context=context):
|
||||
for product in product_obj.browse(cr, uid, products_id, context=context):
|
||||
if product.virtual_available >= 0.0:
|
||||
continue
|
||||
|
||||
|
||||
+33
-21
@@ -34,6 +34,7 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
"""
|
||||
_name = "stock.warehouse.orderpoint"
|
||||
_description = "Orderpoint minimum rule"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=32, required=True),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
|
||||
@@ -59,28 +60,31 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
'qty_multiple': lambda *a: 1,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
|
||||
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
|
||||
}
|
||||
|
||||
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
|
||||
""" Finds location id for changed warehouse.
|
||||
@param warehouse_id: Changed id of warehouse.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if warehouse_id:
|
||||
w=self.pool.get('stock.warehouse').browse(cr,uid,warehouse_id, context)
|
||||
v = {'location_id':w.lot_stock_id.id}
|
||||
w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
|
||||
v = {'location_id': w.lot_stock_id.id}
|
||||
return {'value': v}
|
||||
return {}
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
|
||||
""" Finds UoM for changed product.
|
||||
@param product_id: Changed id of product.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if product_id:
|
||||
prod=self.pool.get('product.product').browse(cr,uid,product_id)
|
||||
v = {'product_uom':prod.uom_id.id}
|
||||
prod = self.pool.get('product.product').browse(cr,uid,product_id)
|
||||
v = {'product_uom': prod.uom_id.id}
|
||||
return {'value': v}
|
||||
return {}
|
||||
|
||||
def copy(self, cr, uid, id, default=None,context={}):
|
||||
if not default:
|
||||
default = {}
|
||||
@@ -88,14 +92,17 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
|
||||
})
|
||||
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
|
||||
|
||||
stock_warehouse_orderpoint()
|
||||
|
||||
class StockMove(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
_columns = {
|
||||
'production_id': fields.many2one('mrp.production', 'Production', select=True),
|
||||
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Requisitions'),
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
default = default or {}
|
||||
default['procurements'] = []
|
||||
@@ -106,19 +113,24 @@ class StockMove(osv.osv):
|
||||
@param move: Stock moves
|
||||
@return: True
|
||||
"""
|
||||
if move.product_id.supply_method=='produce' and move.product_id.procure_method=='make_to_order':
|
||||
bis = self.pool.get('mrp.bom').search(cr, uid, [
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
procurement_obj = self.pool.get('mrp.procurement')
|
||||
product_obj = self.pool.get('product.product')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
|
||||
bis = bom_obj.search(cr, uid, [
|
||||
('product_id','=',move.product_id.id),
|
||||
('bom_id','=',False),
|
||||
('type','=','phantom')])
|
||||
if bis:
|
||||
factor = move.product_qty
|
||||
bom_point = self.pool.get('mrp.bom').browse(cr, uid, bis[0])
|
||||
res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor, [])
|
||||
bom_point = bom_obj.browse(cr, uid, bis[0])
|
||||
res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
|
||||
dest = move.product_id.product_tmpl_id.property_stock_production.id
|
||||
state = 'confirmed'
|
||||
if move.state=='assigned':
|
||||
state='assigned'
|
||||
if move.state == 'assigned':
|
||||
state = 'assigned'
|
||||
for line in res[0]:
|
||||
valdef = {
|
||||
'picking_id': move.picking_id.id,
|
||||
@@ -135,9 +147,9 @@ class StockMove(osv.osv):
|
||||
'move_history_ids2': [(6,0,[])],
|
||||
'procurements': [],
|
||||
}
|
||||
mid = self.pool.get('stock.move').copy(cr, uid, move.id, default=valdef)
|
||||
prodobj = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=context)
|
||||
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
||||
mid = move_obj.copy(cr, uid, move.id, default=valdef)
|
||||
prodobj = product_obj.browse(cr, uid, line['product_id'], context=context)
|
||||
proc_id = procurement_obj.create(cr, uid, {
|
||||
'name': (move.picking_id.origin or ''),
|
||||
'origin': (move.picking_id.origin or ''),
|
||||
'date_planned': move.date_planned,
|
||||
@@ -151,21 +163,18 @@ class StockMove(osv.osv):
|
||||
'move_id': mid,
|
||||
'company_id': line['company_id'],
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
|
||||
self.pool.get('stock.move').write(cr, uid, [move.id], {
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'location_id': move.location_dest_id.id,
|
||||
'auto_validate': True,
|
||||
'picking_id': False,
|
||||
'location_id': dest,
|
||||
'state': 'waiting'
|
||||
})
|
||||
for m in self.pool.get('mrp.procurement').search(cr, uid, [('move_id','=',move.id)], context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
|
||||
return True
|
||||
|
||||
|
||||
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
|
||||
""" Consumed product with specific quatity from specific source location.
|
||||
@param product_qty: Consumed product quantity
|
||||
@@ -232,8 +241,9 @@ class StockPicking(osv.osv):
|
||||
@param *args: Arguments
|
||||
@return: Picking ids.
|
||||
"""
|
||||
for move in self.pool.get('stock.move').browse(cr, uid, picks):
|
||||
self.pool.get('stock.move')._action_explode(cr, uid, move)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for move in move_obj.browse(cr, uid, picks):
|
||||
move_obj._action_explode(cr, uid, move)
|
||||
return picks
|
||||
|
||||
StockPicking()
|
||||
@@ -241,6 +251,7 @@ StockPicking()
|
||||
|
||||
class spilt_in_production_lot(osv.osv_memory):
|
||||
_inherit = "stock.move.split"
|
||||
|
||||
def split(self, cr, uid, ids, move_ids, context=None):
|
||||
""" Splits move lines into given quantities.
|
||||
@param move_ids: Stock moves.
|
||||
@@ -255,5 +266,6 @@ class spilt_in_production_lot(osv.osv_memory):
|
||||
for new_move in new_moves:
|
||||
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
|
||||
return res
|
||||
|
||||
spilt_in_production_lot()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user