Files
manufacture/mrp_production_request/models/stock_move.py
2020-09-30 12:22:11 +02:00

21 lines
642 B
Python

# Copyright 2017 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class StockMove(models.Model):
_inherit = "stock.move"
created_mrp_production_request_id = fields.Many2one(
comodel_name="mrp.production.request", string="Created Production Request"
)
@api.model
def create(self, vals):
if "production_id" in vals:
production = self.env["mrp.production"].browse(vals["production_id"])
if production.mrp_production_request_id:
vals["propagate_cancel"] = False
return super().create(vals)