After the odoo/odoo#52949 , the registering of tracked component, in case of subcontracting, was broken. Fix and try to mimic the same flow than before. The produce wizard has been replaced by a clean MO form to register component and use backorder mechanisme of MO to manage tracked finished product + tracked component. task-2278147 closes odoo/odoo#54994 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
16 lines
573 B
Python
16 lines
573 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models, fields
|
|
|
|
|
|
class StockMoveLine(models.Model):
|
|
_inherit = 'stock.move.line'
|
|
|
|
def _should_bypass_reservation(self, location):
|
|
""" If the move line is subcontracted then ignore the reservation. """
|
|
should_bypass_reservation = super(StockMoveLine, self)._should_bypass_reservation(location)
|
|
if not should_bypass_reservation and self.move_id.is_subcontract:
|
|
return True
|
|
return should_bypass_reservation
|