mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] mrp_component_operation: filter by picking type
This commit is contained in:
@@ -6,6 +6,7 @@ from odoo import fields, models
|
|||||||
class MrpComponentOperation(models.Model):
|
class MrpComponentOperation(models.Model):
|
||||||
_name = "mrp.component.operation"
|
_name = "mrp.component.operation"
|
||||||
_description = "Component Operation"
|
_description = "Component Operation"
|
||||||
|
_order = "sequence,id"
|
||||||
|
|
||||||
name = fields.Char(help="Component Operation Reference", required=True)
|
name = fields.Char(help="Component Operation Reference", required=True)
|
||||||
|
|
||||||
@@ -58,3 +59,14 @@ class MrpComponentOperation(models.Model):
|
|||||||
default="no",
|
default="no",
|
||||||
required=True,
|
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",
|
||||||
|
)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class MrpProduction(models.Model):
|
|||||||
"default_mo_id": self.id,
|
"default_mo_id": self.id,
|
||||||
"product_ids": self.move_raw_ids.move_line_ids.product_id.mapped("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"),
|
"lot_ids": self.move_raw_ids.move_line_ids.lot_id.mapped("id"),
|
||||||
|
"default_picking_type_id": self.picking_type_id.id,
|
||||||
},
|
},
|
||||||
"target": "new",
|
"target": "new",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<field name="name" string="Reference" />
|
<field name="name" string="Reference" />
|
||||||
</h1>
|
</h1>
|
||||||
|
<group name="picking_type" string="Operation Type">
|
||||||
|
<field name="picking_type_id" />
|
||||||
|
</group>
|
||||||
<group name="operations" string="Operations">
|
<group name="operations" string="Operations">
|
||||||
<field name="outgoing_operation" />
|
<field name="outgoing_operation" />
|
||||||
<field name="incoming_operation" />
|
<field name="incoming_operation" />
|
||||||
@@ -39,11 +42,26 @@
|
|||||||
attrs="{'invisible': [('outgoing_operation', '!=', 'scrap')], 'required': [('outgoing_operation', '=', 'scrap')]}"
|
attrs="{'invisible': [('outgoing_operation', '!=', 'scrap')], 'required': [('outgoing_operation', '=', 'scrap')]}"
|
||||||
/>
|
/>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="view_mrp_component_operation_tree" model="ir.ui.view">
|
||||||
|
<field name="name">view_mrp_component_operation_tree</field>
|
||||||
|
<field name="model">mrp.component.operation</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="sequence" widget="handle" />
|
||||||
|
<field name="name" string="Reference" />
|
||||||
|
<field name="picking_type_id" />
|
||||||
|
<field name="outgoing_operation" />
|
||||||
|
<field name="incoming_operation" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="action_menu_mrp_component_operation" model="ir.actions.act_window">
|
<record id="action_menu_mrp_component_operation" model="ir.actions.act_window">
|
||||||
<field name="name">Component Operation</field>
|
<field name="name">Component Operation</field>
|
||||||
<field name="res_model">mrp.component.operation</field>
|
<field name="res_model">mrp.component.operation</field>
|
||||||
|
|||||||
@@ -23,7 +23,14 @@ class MrpComponentOperate(models.Model):
|
|||||||
|
|
||||||
mo_id = fields.Many2one("mrp.production", ondelete="cascade", required=True)
|
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(
|
incoming_operation = fields.Selection(
|
||||||
related="operation_id.incoming_operation",
|
related="operation_id.incoming_operation",
|
||||||
@@ -35,6 +42,11 @@ class MrpComponentOperate(models.Model):
|
|||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
picking_type_id = fields.Many2one(
|
||||||
|
"stock.picking.type",
|
||||||
|
"Operation Type",
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange("operation_id")
|
@api.onchange("operation_id")
|
||||||
def _onchange_operation_id(self):
|
def _onchange_operation_id(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
attrs="{'readonly': ['|',('tracking', '=', 'serial'),('product_id', '=', False)]}"
|
attrs="{'readonly': ['|',('tracking', '=', 'serial'),('product_id', '=', False)]}"
|
||||||
/>
|
/>
|
||||||
<field name="operation_id" />
|
<field name="operation_id" />
|
||||||
|
<field name="picking_type_id" invisible="1" />
|
||||||
<field name="tracking" invisible="1" />
|
<field name="tracking" invisible="1" />
|
||||||
</group>
|
</group>
|
||||||
<group
|
<group
|
||||||
|
|||||||
Reference in New Issue
Block a user