[WIP] Add link with sale order by duplicating. That way sale order will be delivered when procurement is done
This commit is contained in:
parent
bd5550e832
commit
1a9eb52341
|
@ -93,11 +93,11 @@ class StockMove(osv.osv):
|
|||
'procurement_id': move.procurement_id.id,
|
||||
'split_from': move.id, #Needed in order to keep purchase connection, but will be removed by unlink
|
||||
}
|
||||
mid = move_obj.copy(cr, uid, move.id, default=valdef)
|
||||
mid = move_obj.copy(cr, uid, move.id, default=valdef, context=context)
|
||||
to_explode_again_ids.append(mid)
|
||||
else:
|
||||
if prod_obj.need_procurement(cr, uid, [product.id], context=context):
|
||||
vals = {
|
||||
valdef = {
|
||||
'name': move.rule_id and move.rule_id.name or "/",
|
||||
'origin': move.origin,
|
||||
'company_id': move.company_id and move.company_id.id or False,
|
||||
|
@ -110,16 +110,22 @@ class StockMove(osv.osv):
|
|||
'group_id': move.group_id.id,
|
||||
'priority': move.priority,
|
||||
'partner_dest_id': move.partner_id.id,
|
||||
'move_dest_id': move.id,
|
||||
}
|
||||
proc = proc_obj.create(cr, uid, vals, context=context)
|
||||
if move.procurement_id:
|
||||
proc = proc_obj.copy(cr, uid, move.procurement_id.id, default=valdef, context=context)
|
||||
else:
|
||||
proc = proc_obj.create(cr, uid, valdef, context=context)
|
||||
proc_obj.run(cr, uid, [proc], context=context)
|
||||
|
||||
#delete the move with original product which is not relevant anymore
|
||||
move_obj.unlink(cr, SUPERUSER_ID, [move.id], context=context)
|
||||
|
||||
#check if new moves needs to be exploded
|
||||
if to_explode_again_ids:
|
||||
for new_move in self.browse(cr, uid, to_explode_again_ids, context=context):
|
||||
processed_ids.extend(self._action_explode(cr, uid, new_move, context=context))
|
||||
|
||||
#delete the move with original product which is not relevant anymore
|
||||
move_obj.unlink(cr, SUPERUSER_ID, [move.id], context=context)
|
||||
#return list of newly created move or the move id otherwise
|
||||
return processed_ids or [move.id]
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ class procurement_order(osv.osv):
|
|||
_inherit = "procurement.order"
|
||||
_columns = {
|
||||
'task_id': fields.many2one('project.task', 'Task', copy=False),
|
||||
'sale_line_id': fields.many2one('sale.order.line', 'Sales order line', copy=False)
|
||||
}
|
||||
|
||||
def _is_procurement_task(self, cr, uid, procurement, context=None):
|
||||
|
|
Loading…
Reference in New Issue