Compare commits
2 Commits
14.0-imp-m
...
14.0-imp-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6416957ad1 | ||
|
|
05374c4b4a |
@@ -12,16 +12,20 @@ class ProductTemplate(models.Model):
|
|||||||
only one BoM form or a list of BoMs."""
|
only one BoM form or a list of BoMs."""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.bom_count == 1:
|
if self.bom_count == 1:
|
||||||
action = self.env.ref("mrp.mrp_bom_form_action").read()[0]
|
action_xml_id = "mrp.mrp_bom_form_action"
|
||||||
|
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
||||||
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
||||||
action.update({
|
action.update(
|
||||||
"context": {"default_product_tmpl_id": self.id},
|
{
|
||||||
"views": False,
|
"context": {"default_product_tmpl_id": self.id},
|
||||||
"view_mode": "form,tree",
|
"views": False,
|
||||||
"res_id": bom.id,
|
"view_mode": "form,tree",
|
||||||
})
|
"res_id": bom.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
action = self.env.ref("mrp.template_open_bom").read()[0]
|
action_xml_id = "mrp.template_open_bom"
|
||||||
|
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
@@ -32,9 +36,11 @@ class ProductProduct(models.Model):
|
|||||||
action = super().action_view_bom()
|
action = super().action_view_bom()
|
||||||
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
||||||
if len(bom_target_ids) == 1:
|
if len(bom_target_ids) == 1:
|
||||||
action.update({
|
action.update(
|
||||||
"views": False,
|
{
|
||||||
"view_mode": "form,tree",
|
"views": False,
|
||||||
"res_id": bom_target_ids[0].id,
|
"view_mode": "form,tree",
|
||||||
})
|
"res_id": bom_target_ids[0].id,
|
||||||
|
}
|
||||||
|
)
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -7,24 +7,24 @@
|
|||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!--
|
|
||||||
<record id="account_invoice_form" model="ir.ui.view">
|
<record id="account_invoice_form" model="ir.ui.view">
|
||||||
<field name="name">sale_usability.customer.invoice.form</field>
|
<field name="name">sale_usability.customer.invoice.form</field>
|
||||||
<field name="model">account.invoice</field>
|
<field name="model">account.move</field>
|
||||||
<field name="inherit_id" ref="sale.account_invoice_form"/>
|
<field name="inherit_id" ref="sale.account_invoice_form" />
|
||||||
|
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_manager'))]" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<div name="button_box" position="inside">
|
<div name="button_box" position="inside">
|
||||||
<button name="show_sale_orders"
|
<button
|
||||||
type="object"
|
name="show_sale_orders"
|
||||||
class="oe_stat_button"
|
type="object"
|
||||||
icon="fa-pencil-square-o"
|
class="oe_stat_button"
|
||||||
attrs="{'invisible': [('sale_count', '=', 0)]}">
|
icon="fa-pencil-square-o"
|
||||||
<field name="sale_count" widget="statinfo" string="Sale Orders"/>
|
attrs="{'invisible': [('sale_count', '=', 0)]}">
|
||||||
|
<field name="sale_count" widget="statinfo" string="Sale Orders" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
-->
|
|
||||||
|
|
||||||
<record id="view_move_form" model="ir.ui.view">
|
<record id="view_move_form" model="ir.ui.view">
|
||||||
<field name="name">sale_usability.account.move.form</field>
|
<field name="name">sale_usability.account.move.form</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user