[FIX] account: move group visible search to inherited view

Make sure your user does not have the "Analytic Accounting" group,
access the Invoices Management Report, traceback.

The problem is linked to groups. When they are used on model field, the
field is removed by the ORM. When they are used in view field, the field
is set as invisible. As both fields were restricted to the group, the
frontend was trying to render an invisible field using a removed field
causing the traceback.

The problematic field has been moved to a dedicated inherited view with
the group applied on the entire view. This cause the field not to be
rendered when the user does not have the group.

closes odoo/odoo#36122

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Julien Castiaux
2019-08-27 11:11:10 +00:00
parent c3ebc0b987
commit 24c92d8b95
@@ -87,7 +87,6 @@
<filter string="Partner" name="partner_id" context="{'group_by':'partner_id','residual_visible':True}"/>
<filter string="Product Category" name="category_product" context="{'group_by':'product_categ_id','residual_invisible':True}"/>
<filter string="Status" name="status" context="{'group_by':'state'}"/>
<filter string="Analytic Account" name="analytic_account_id" context="{'group_by':'analytic_account_id'}" groups="analytic.group_analytic_accounting" />
<filter string="Company" name="company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical" />
<filter string="Date" name="invoice_date" context="{'group_by':'invoice_date'}"/>
@@ -97,6 +96,18 @@
</field>
</record>
<record id="view_account_invoice_report_search_analytic_accounting" model="ir.ui.view">
<field name="name">account.invoice.report.search_analytic_accounting</field>
<field name="model">account.invoice.report</field>
<field name="inherit_id" ref="account.view_account_invoice_report_search"/>
<field name="groups_id" eval="[(4, ref('analytic.group_analytic_accounting'))]"/>
<field name="arch" type="xml">
<filter name="status" position="after">
<filter string="Analytic Account" name="analytic_account_id" context="{'group_by':'analytic_account_id'}"/>
</filter>
</field>
</record>
<record id="action_account_invoice_report_all_supp" model="ir.actions.act_window">
<field name="name">Invoices Analysis</field>
<field name="res_model">account.invoice.report</field>