[FIX] mrp: cannot open product template view

When you don't have any mrp access rights and want to open a product
template form view, you get an access error. This is caused by the field
bom_count that tries to count the number of BOM without having the
access rights.

So we only add this field to the view, and the action that depends on it
when you have mrp access rights.

closes odoo/odoo#109636

X-original-commit: a655276d556f1d2bf92c3f3160a8306cc673a115
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Pierre Masereel
2023-01-11 19:26:48 +01:00
parent 5f1a77236a
commit 66f8901143
+2 -1
View File
@@ -8,7 +8,7 @@
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="arch" type="xml">
<xpath expr="//label[@for='sale_delay']" position="before">
<field name="bom_count" string="Bill of Materials" invisible="1"/>
<field name="bom_count" string="Bill of Materials" invisible="1" groups="mrp.group_mrp_user"/>
<label for="produce_delay" string="Manuf. Lead Time" attrs="{'invisible':[('type','=','service')]}"/>
<div attrs="{'invisible':[('type','=','service')]}">
<field name="produce_delay" class="oe_inline"/> days
@@ -17,6 +17,7 @@
<div attrs="{'invisible':[('type','=','service')]}">
<field name="days_to_prepare_mo" class="oe_inline"/> days
<button name="action_compute_bom_days" string="Compute from BoM" type="object" attrs="{'invisible':['|', ('type', '=', 'service'), ('bom_count', '=', 0)]}"
groups="mrp.group_mrp_user"
help="Compute the days required to resupply all components from BoM, by either buying or manufacturing the components and/or subassemblies."
class="oe_link pt-0"/>
</div>