-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
157 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class InputConstraint(models.Model): | ||
_name = "input.constraint" | ||
_inherit = ["mail.thread"] | ||
_rec_name = "bom_id" | ||
_description = "Contains input data constraints" | ||
|
||
bom_id = fields.Many2one(comodel_name="mrp.bom") | ||
bom_domain = fields.Binary(compute="_compute_bom_domain") | ||
|
||
@api.depends("bom_id") | ||
def _compute_bom_domain(self): | ||
domain = self.env["mrp.bom"]._get_bom_domain_for_config() | ||
boms = self.env["mrp.bom"].search(domain) | ||
for rec in self: | ||
ids = boms and boms.ids or [False] | ||
rec.bom_domain = [("id", "in", ids)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
input_config_base,Base input config,mrp_bom_configurable.model_input_config,base.group_user,1,1,1,1 | ||
input_line_base,Base input line,mrp_bom_configurable.model_input_line,base.group_user,1,1,1,1 | ||
input_constraint_base,Base input constraint,mrp_bom_configurable.model_input_constraint,base.group_user,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<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" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//form" position="attributes"> | ||
<attribute name="edit">1</attribute> | ||
</xpath> | ||
<xpath expr="//group" position="after"> | ||
<group name="domain" string="Domain"> | ||
<field | ||
name="domain" | ||
widget="domain" | ||
options="{'model': 'input.line'}" | ||
/> | ||
<field name="condition" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<odoo> | ||
|
||
|
||
<record id="input_constraint_form" model="ir.ui.view"> | ||
<field name="model">input.constraint</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<header /> | ||
<sheet> | ||
<group name="main"> | ||
<group name="left"> | ||
<field name="bom_domain" invisible="1" /> | ||
<field name="bom_id" domain="bom_domain" /> | ||
</group> | ||
<group name="right" /> | ||
</group> | ||
</sheet> | ||
<div class="oe_chatter"> | ||
<field name="message_follower_ids" widget="mail_followers" /> | ||
<field name="message_ids" widget="mail_thread" /> | ||
</div> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="input_constraint_tree" model="ir.ui.view"> | ||
<field name="model">input.constraint</field> | ||
<field name="arch" type="xml"> | ||
<tree> | ||
<field name="bom_id" /> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="input_constraint_search" model="ir.ui.view"> | ||
<field name="model">input.constraint</field> | ||
<field name="arch" type="xml"> | ||
<search> | ||
<field name="bom_id" /> | ||
<group expand="0" string="Group By"> | ||
<filter name="bom_id" context="{'group_by': 'bom_id'}" /> | ||
</group> | ||
</search> | ||
</field> | ||
</record> | ||
|
||
<record id="input_constraint_pivot" model="ir.ui.view"> | ||
<field name="model">input.constraint</field> | ||
<field name="arch" type="xml"> | ||
<pivot> | ||
<!-- customize with your own fields --> | ||
<field name="bom_id" type="row" /> | ||
</pivot> | ||
</field> | ||
</record> | ||
|
||
<record id="input_constraint_action" model="ir.actions.act_window"> | ||
<field name="name">Input Constraints</field> | ||
<field name="res_model">input.constraint</field> | ||
<field name="view_mode">tree,form,pivot</field> | ||
</record> | ||
|
||
<menuitem | ||
id="input_constraint_menu" | ||
sequence="15" | ||
parent="mrp_bom_configurable.configurator_menu" | ||
action="input_constraint_action" | ||
/> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters