Files
stock-logistics-warehouse/stock_request_mrp/models/stock_rule.py
2020-09-02 10:56:22 +02:00

35 lines
806 B
Python

# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class StockRule(models.Model):
_inherit = "stock.rule"
def _prepare_mo_vals(
self,
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
bom,
):
res = super()._prepare_mo_vals(
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
bom,
)
if "stock_request_id" in values:
res["stock_request_ids"] = [(4, values["stock_request_id"])]
return res