In case of MTO (+buy) on products used in a MO, add the link between the MO source and the PO generated. Also add links between MO's when MTO+manufacturing. task-1913392 closes odoo/odoo#43366 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
15 lines
491 B
Python
15 lines
491 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
|
|
|
|
class StockMove(models.Model):
|
|
_inherit = 'stock.move'
|
|
|
|
def _prepare_phantom_move_values(self, bom_line, product_qty, quantity_done):
|
|
vals = super(StockMove, self)._prepare_phantom_move_values(bom_line, product_qty, quantity_done)
|
|
if self.purchase_line_id:
|
|
vals['purchase_line_id'] = self.purchase_line_id.id
|
|
return vals
|