Skip to content

Commit

Permalink
ADD Removes sale_id and configured_bom_id
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzPoize committed Feb 14, 2024
1 parent e54d0aa commit 48962c6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 42 deletions.
4 changes: 2 additions & 2 deletions mrp_bom_configurable/models/demo_input_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def populate_bom_data_preview(self):
{
"product_tmpl_id": bom.product_tmpl_id.id,
"product_id": bom.product_id.id,
"product_qty": self.count,
"product_qty": 1,
"product_uom_id": bom.product_uom_id.id,
"configuration_type": "configured",
"bom_line_ids": [
Expand All @@ -55,7 +55,7 @@ def populate_bom_data_preview(self):
0,
{
"product_id": line.product_id.id,
"product_qty": self.count * line.product_qty,
"product_qty": line.product_qty,
"product_uom_id": line.product_uom_id.id,
},
)
Expand Down
4 changes: 0 additions & 4 deletions mrp_bom_configurable/models/input_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class InputConfig(models.Model):
default="draft",
ondelete={"pending": "draft", "confirmed": "draft"},
)
sale_id = fields.Many2one(comodel_name="sale.order")
partner_id = fields.Many2one(
comodel_name="res.partner", related="sale_id.partner_id.commercial_partner_id"
)
line_ids = fields.One2many(comodel_name="input.line", inverse_name="config_id")
line_count = fields.Integer(string="Lines", compute="_compute_line_count")

Expand Down
12 changes: 3 additions & 9 deletions mrp_bom_configurable/models/input_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ class Inputline(models.Model):
name = fields.Char()
sequence = fields.Integer()
bom_id = fields.Many2one(
comodel_name="mrp.bom",
required=True,
)
configured_bom_id = fields.Many2one(
comodel_name="mrp.bom",
string="Configured BoM",
comodel_name="mrp.bom", required=True, related="config_id.bom_id"
)
config_id = fields.Many2one(comodel_name="input.config", required=True)
count = fields.Integer(default=1)
alert = fields.Text(help="Outside limit configuration is reported here")
checked = fields.Boolean(
compute="_compute_check",
Expand Down Expand Up @@ -143,7 +137,7 @@ def create_bom_from_line(self):
new_bom = self.env["mrp.bom"].create(

Check warning on line 137 in mrp_bom_configurable/models/input_line.py

View check run for this annotation

Codecov / codecov/patch

mrp_bom_configurable/models/input_line.py#L137

Added line #L137 was not covered by tests
{
"configuration_type": "configured",
"product_qty": self.count,
"product_qty": 1,
"product_tmpl_id": new_product.id,
}
)
Expand Down Expand Up @@ -183,6 +177,6 @@ def action_show_configured_bom(self):
"target": "new",
}

@api.depends("bom_id", "count")
@api.depends("bom_id")
def _compute_check(self):
"You need to override this method in your custom config to trigger adhoc checks"
18 changes: 0 additions & 18 deletions mrp_bom_configurable/views/input_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@
<group>
<field name="date" />
</group>
<group>
<field name="sale_id" />
<field
name="partner_id"
attrs="{'invisible': [('sale_id', '=', False)]}"
/>
</group>
</group>
<group name="config">
<group name="left">
Expand Down Expand Up @@ -72,7 +65,6 @@
<tree>
<field name="name" />
<field name="date" />
<field name="partner_id" optional="show" />
</tree>
</field>

Expand All @@ -87,23 +79,13 @@
string="Name"
filter_domain="[('name', 'ilike', self)]"
/>
<field
name="partner_id"
filter_domain="[('partner_id', 'child_of', self)]"
/>
<group expand="0" string="Group By">
<filter
string="Status"
name="status"
domain="[]"
context="{'group_by': 'state'}"
/>
<filter
string="Partner"
name="partner"
domain="[]"
context="{'group_by': 'partner_id'}"
/>
</group>
</search>
</field>
Expand Down
9 changes: 0 additions & 9 deletions mrp_bom_configurable/views/input_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<field name='model'>input.line</field>
<field name='arch' type='xml'>
<tree editable="bottom" multi_edit="1" class="input_line_tree">
<field name="configured_bom_id" invisible="1" />
<field name="sequence" widget="handle" />
<button name="ui_clone" class="fa fa-clone" type="object" title="Clone" />
<button
Expand All @@ -31,15 +30,7 @@
type="object"
title="Info"
/>
<button
name="action_show_configured_bom"
class="fa fa-cog"
type="object"
title="Info"
attrs="{'invisible': [('configured_bom_id', '=', False)]}"
/>
<field name="name" />
<field name="count" />
<field name="alert" optional="show" />
<field name="comment" optional="show" />
<field name="checked" optional="hide" />
Expand Down

0 comments on commit 48962c6

Please sign in to comment.