[FIX] hr_expense: AccessError on product
- Install hr_expense and stock. - Add enough products which can be expensed so that a 'Search More...' option is proposed. - Restrict the rights of a user U to 'Employee' only. - As U, create an expense, and click on the 'Search More...' option when choosing the product An AccessError is raised on `stock.move`. The error is due to fields `qty_available` and `virtual_quantity`. These fields are not necessary in that context, so we define a specific tree view for this use case. opw-1891399 closes odoo/odoo#27561
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="product_id" context="{'default_can_be_expensed': 1}"/>
|
||||
<field name="product_id" context="{'default_can_be_expensed': 1, 'tree_view_ref': 'hr_expense.product_product_expense_tree_view'}"/>
|
||||
<field name="unit_amount" required="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<label for="quantity"/>
|
||||
<div>
|
||||
@@ -286,6 +286,22 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_product_expense_tree_view" model="ir.ui.view">
|
||||
<field name="name">product.product.expense.tree</field>
|
||||
<field name="model">product.product</field>
|
||||
<field eval="50" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product Variants">
|
||||
<field name="default_code"/>
|
||||
<field name="name"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" groups="product.group_product_variant"/>
|
||||
<field name="standard_price"/>
|
||||
<field name="uom_id" options="{'no_open': True, 'no_create': True}" groups="product.group_uom"/>
|
||||
<field name="barcode"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_product" model="ir.actions.act_window">
|
||||
<field name="name">Expense Products</field>
|
||||
<field name="res_model">product.product</field>
|
||||
|
||||
Reference in New Issue
Block a user