From 48e4737534f1dcebdb04089a44f464e904e50506 Mon Sep 17 00:00:00 2001 From: "Gauthier Wala (gawa)" Date: Mon, 4 Mar 2024 13:15:32 +0000 Subject: [PATCH] [FIX] analytic,account: groups are not defined in right module The fields in analytic have a group which is defined in account. We hide them in analytic module and show them in account with the right group. We also show balance now, even if you don't have the group 'readonly', because it's an information that is independent of credit/debit notion. Linked to runbot error 59222 (will need to remove the group in the test) closes odoo/odoo#159085 X-original-commit: e7e3ec8cb5e4f71ce1dbbd24485c3377c694e5eb Signed-off-by: John Laterre (jol) Signed-off-by: Wala Gauthier (gawa) --- addons/account/models/account_analytic_account.py | 3 +++ .../views/account_analytic_account_views.xml | 14 ++++++++++++++ addons/analytic/models/analytic_account.py | 3 --- addons/analytic/views/analytic_account_views.xml | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_analytic_account.py b/addons/account/models/account_analytic_account.py index e3021c85505..8ff99d8aacc 100644 --- a/addons/account/models/account_analytic_account.py +++ b/addons/account/models/account_analytic_account.py @@ -16,6 +16,9 @@ class AccountAnalyticAccount(models.Model): compute='_compute_vendor_bill_count', ) + debit = fields.Monetary(groups='account.group_account_readonly') + credit = fields.Monetary(groups='account.group_account_readonly') + @api.depends('line_ids') def _compute_invoice_count(self): sale_types = self.env['account.move'].get_sale_types(include_receipts=True) diff --git a/addons/account/views/account_analytic_account_views.xml b/addons/account/views/account_analytic_account_views.xml index e4787b12075..02b2d575c07 100644 --- a/addons/account/views/account_analytic_account_views.xml +++ b/addons/account/views/account_analytic_account_views.xml @@ -20,5 +20,19 @@ + + + account.analytic.account.list.inherit + account.analytic.account + + + + False + + + False + + + \ No newline at end of file diff --git a/addons/analytic/models/analytic_account.py b/addons/analytic/models/analytic_account.py index f611f3e8a7e..d6b26e9c49f 100644 --- a/addons/analytic/models/analytic_account.py +++ b/addons/analytic/models/analytic_account.py @@ -74,17 +74,14 @@ class AccountAnalyticAccount(models.Model): balance = fields.Monetary( compute='_compute_debit_credit_balance', string='Balance', - groups='account.group_account_readonly', ) debit = fields.Monetary( compute='_compute_debit_credit_balance', string='Debit', - groups='account.group_account_readonly', ) credit = fields.Monetary( compute='_compute_debit_credit_balance', string='Credit', - groups='account.group_account_readonly', ) currency_id = fields.Many2one( diff --git a/addons/analytic/views/analytic_account_views.xml b/addons/analytic/views/analytic_account_views.xml index 6cfa0aa5052..d774a647505 100644 --- a/addons/analytic/views/analytic_account_views.xml +++ b/addons/analytic/views/analytic_account_views.xml @@ -60,8 +60,8 @@ - - + +