[FIX] account,analytic: keep analytic filter on auditing

Currently when we have an Analytic Filter applied on an accounting
report, we lose that filter when we click on any amount to audit the
journal items.

This fix makes sure that when auditing, we only view the journal items
filtered by the Analytic Filter.

In order to do that, we extend the search function in the analytic mixin
to allow searching on analytic account ids.

task-3718751

closes odoo/odoo#161873

X-original-commit: 2e3be9726514f74ea8c0c2314c9cdfeb6ed57915
Related: odoo/enterprise#60742
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
This commit is contained in:
Dylan Kiss (dyki)
2024-04-23 15:32:46 +00:00
parent 2f9978c85f
commit d6bdb05771
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -2449,6 +2449,7 @@ msgstr ""
#. module: account #. module: account
#: model:ir.ui.menu,name:account.account_analytic_def_account #: model:ir.ui.menu,name:account.account_analytic_def_account
#: model_terms:ir.ui.view,arch_db:account.view_account_move_line_filter
msgid "Analytic Accounts" msgid "Analytic Accounts"
msgstr "" msgstr ""
@@ -354,6 +354,7 @@
<filter string="Report Dates" name="date_between" domain="[('date', '&gt;=', context.get('date_from')), ('date', '&lt;=', context.get('date_to'))]" invisible="1"/> <filter string="Report Dates" name="date_between" domain="[('date', '&gt;=', context.get('date_from')), ('date', '&lt;=', context.get('date_to'))]" invisible="1"/>
<filter string="Report Dates" name="date_before" domain="[('date', '&lt;=', context.get('date_to'))]" invisible="1"/> <filter string="Report Dates" name="date_before" domain="[('date', '&lt;=', context.get('date_to'))]" invisible="1"/>
<separator/> <separator/>
<filter string="Analytic Accounts" name="analytic_accounts" domain="[('analytic_distribution', 'in', context.get('analytic_ids'))]" invisible="1"/>
<group expand="0" string="Group By"> <group expand="0" string="Group By">
<filter string="Journal Entry" name="group_by_move" domain="[]" context="{'group_by': 'move_name'}"/> <filter string="Journal Entry" name="group_by_move" domain="[]" context="{'group_by': 'move_name'}"/>
<filter string="Account" name="group_by_account" domain="[]" context="{'group_by': 'account_id'}"/> <filter string="Account" name="group_by_account" domain="[]" context="{'group_by': 'account_id'}"/>
+3 -1
View File
@@ -125,7 +125,9 @@ class AnalyticMixin(models.AbstractModel):
def _apply_analytic_distribution_domain(self, domain): def _apply_analytic_distribution_domain(self, domain):
return [ return [
('analytic_distribution_search', leaf[1], leaf[2]) if len(leaf) == 3 and leaf[0] == 'analytic_distribution' and isinstance(leaf[2], (str, tuple, list)) else leaf ('analytic_distribution_search', leaf[1], leaf[2])
if len(leaf) == 3 and leaf[0] == 'analytic_distribution' and isinstance(leaf[2], (str, tuple, list))
else leaf
for leaf in domain for leaf in domain
] ]