Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Aug 11, 2023
1 parent f43439e commit 5c84c6e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
1 change: 1 addition & 0 deletions mrp_bom_variable/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import mrp_bom
from . import mrp_bom_line
25 changes: 3 additions & 22 deletions mrp_bom_variable/models/mrp_bom.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
from odoo import fields, models


class MrpBomLine(models.Model):
_inherit = "mrp.bom.line"
class MrpBom(models.Model):
_inherit = "mrp.bom"

condition = fields.Text(
help="Mettre ici sous quelles conditions le composant sera "
"utilisé pour la configuration"
)
domain = fields.Text(help="Odoo syntax domain only")

def goto_variable_bom_report(self):
self.ensure_one()
# TODO add button
base_url = self.env["ir.config_parameter"].sudo().get_param("web.base.url")
url = "%s/report/html/mrp_bom_variable.report_bom_variable/%s" % (
base_url,
self.id,
)
return {
"model": "ir.actions._act_url",
"name": self.name,
"url": url,
"target": "new",
}
variable = fields.Boolean(help="Used as configurable process for product")
23 changes: 23 additions & 0 deletions mrp_bom_variable/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from odoo import fields, models


class MrpBomLine(models.Model):
_inherit = "mrp.bom.line"

domain = fields.Text(help="Odoo syntax domain only")
condition = fields.Text(help="Comment explaining domain if needed")

def goto_variable_bom_report(self):
self.ensure_one()
# TODO add button
base_url = self.env["ir.config_parameter"].sudo().get_param("web.base.url")
url = "%s/report/html/mrp_bom_variable.report_bom_variable/%s" % (
base_url,
self.id,
)
return {
"model": "ir.actions._act_url",
"name": self.name,
"url": url,
"target": "new",
}
18 changes: 16 additions & 2 deletions mrp_bom_variable/views/mrp_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@
<odoo>

<record id="mrp_bom_form_view" model="ir.ui.view">
<field name="name">mrp.bom.form - mrp_bom_location</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view" />
<field name="arch" type="xml">
<field name="type" position="after">
<field name="variable" />
</field>
<xpath
expr="//field[@name='bom_line_ids']/tree/field[@name='product_qty']"
position="after"
>
<field name="condition" />
<field name="domain" />
<field name="condition" />
</xpath>
</field>
</record>

<record id="mrp_bom_tree_view" model="ir.ui.view">
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_tree_view" />
<field name="arch" type="xml">
<field name="product_qty" position="before">
<field name="variable" optional="hide" />
<field name="condition" optional="hide" />
</field>
</field>
</record>

<record id="mrp_bom_line_view_form" model="ir.ui.view">
<field name="model">mrp.bom.line</field>
<field name="inherit_id" ref="mrp.mrp_bom_line_view_form" />
Expand All @@ -26,4 +39,5 @@
</field>
</record>


</odoo>

0 comments on commit 5c84c6e

Please sign in to comment.