[FIX] sale_crm: move code reverted at revision 9452 to the sale_crm module instead of project_mrp

bzr revid: mat@openerp.com-20130918073333-xikarmzmmmdzp3ia
This commit is contained in:
Martin Trigaux 2013-09-18 09:33:33 +02:00
parent 54c4fe7f01
commit eb26358196
1 changed files with 13 additions and 0 deletions

View File

@ -69,6 +69,19 @@ class mrp_production(osv.osv):
res[production.id] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
return res
def _hook_create_post_procurement(self, cr, uid, production, procurement_id, context=None):
def get_parent_move(move):
if move.move_dest_id:
return get_parent_move(move.move_dest_id)
return move
res = super(mrp_production, self)._hook_create_post_procurement(cr, uid, production, procurement_id, context)
if production.move_prod_id:
parent_move_line = get_parent_move(production.move_prod_id)
if parent_move_line and parent_move_line.sale_line_id:
self.pool.get('procurement.order').write(cr, uid, procurement_id, {'sale_line_id': parent_move_line.sale_line_id.id})
return res
_columns = {
'sale_name': fields.function(_ref_calc, multi='sale_name', type='char', string='Sale Name', help='Indicate the name of sales order.'),
'sale_ref': fields.function(_ref_calc, multi='sale_name', type='char', string='Sale Reference', help='Indicate the Customer Reference from sales order.'),