Files
manufacture/mrp_component_operation/models/mrp_production.py
2022-12-30 11:22:30 +01:00

26 lines
876 B
Python

# Copyright 2022 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 MrpProduction(models.Model):
_inherit = "mrp.production"
def button_operate_components(self):
return {
"name": _("Operate Component"),
"view_mode": "form",
"res_model": "mrp.component.operate",
"view_id": self.env.ref(
"mrp_component_operation.view_mrp_component_operate_form"
).id,
"type": "ir.actions.act_window",
"context": {
"default_mo_id": self.id,
"product_ids": self.move_raw_ids.move_line_ids.product_id.mapped("id"),
"lot_ids": self.move_raw_ids.move_line_ids.lot_id.mapped("id"),
},
"target": "new",
}