diff --git a/mrp_component_operation/models/mrp_component_operation.py b/mrp_component_operation/models/mrp_component_operation.py index 5332e5229..1ffeb7a59 100644 --- a/mrp_component_operation/models/mrp_component_operation.py +++ b/mrp_component_operation/models/mrp_component_operation.py @@ -6,6 +6,7 @@ from odoo import fields, models class MrpComponentOperation(models.Model): _name = "mrp.component.operation" _description = "Component Operation" + _order = "sequence,id" name = fields.Char(help="Component Operation Reference", required=True) @@ -58,3 +59,14 @@ class MrpComponentOperation(models.Model): default="no", required=True, ) + + picking_type_id = fields.Many2one( + "stock.picking.type", + "Operation Type", + domain="[('code', '=', 'mrp_operation')]", + ) + + sequence = fields.Integer( + string="Sequence", + help="Gives the sequence order when displaying the list of component operations", + ) diff --git a/mrp_component_operation/models/mrp_production.py b/mrp_component_operation/models/mrp_production.py index ca4e09e43..c55e8833e 100644 --- a/mrp_component_operation/models/mrp_production.py +++ b/mrp_component_operation/models/mrp_production.py @@ -20,6 +20,7 @@ class MrpProduction(models.Model): "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"), + "default_picking_type_id": self.picking_type_id.id, }, "target": "new", } diff --git a/mrp_component_operation/views/mrp_component_operation_views.xml b/mrp_component_operation/views/mrp_component_operation_views.xml index cfac9a50c..91e553192 100644 --- a/mrp_component_operation/views/mrp_component_operation_views.xml +++ b/mrp_component_operation/views/mrp_component_operation_views.xml @@ -9,6 +9,9 @@

+ + + @@ -39,11 +42,26 @@ attrs="{'invisible': [('outgoing_operation', '!=', 'scrap')], 'required': [('outgoing_operation', '=', 'scrap')]}" /> + + + view_mrp_component_operation_tree + mrp.component.operation + + + + + + + + + + + Component Operation mrp.component.operation diff --git a/mrp_component_operation/wizards/mrp_component_operate.py b/mrp_component_operation/wizards/mrp_component_operate.py index efbf566f0..a1655f5fe 100644 --- a/mrp_component_operation/wizards/mrp_component_operate.py +++ b/mrp_component_operation/wizards/mrp_component_operate.py @@ -23,7 +23,14 @@ class MrpComponentOperate(models.Model): mo_id = fields.Many2one("mrp.production", ondelete="cascade", required=True) - operation_id = fields.Many2one("mrp.component.operation", required=True) + operation_id = fields.Many2one( + "mrp.component.operation", + required=True, + domain="[" + "'|'," + "('picking_type_id', '=', picking_type_id), " + "('picking_type_id', '=', False)]", + ) incoming_operation = fields.Selection( related="operation_id.incoming_operation", @@ -35,6 +42,11 @@ class MrpComponentOperate(models.Model): required=True, ) + picking_type_id = fields.Many2one( + "stock.picking.type", + "Operation Type", + ) + @api.onchange("operation_id") def _onchange_operation_id(self): for rec in self: diff --git a/mrp_component_operation/wizards/mrp_component_operate_wizard.xml b/mrp_component_operation/wizards/mrp_component_operate_wizard.xml index cf481d434..91e396ec5 100644 --- a/mrp_component_operation/wizards/mrp_component_operate_wizard.xml +++ b/mrp_component_operation/wizards/mrp_component_operate_wizard.xml @@ -23,6 +23,7 @@ attrs="{'readonly': ['|',('tracking', '=', 'serial'),('product_id', '=', False)]}" /> +