[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) <jol@odoo.com>
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
This commit is contained in:
Gauthier Wala (gawa)
2024-03-26 08:20:22 +00:00
parent 03d7e0eb18
commit 48e4737534
4 changed files with 19 additions and 5 deletions
@@ -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)
@@ -20,5 +20,19 @@
</div>
</field>
</record>
<record id="account_analytic_account_view_list_inherit" model="ir.ui.view">
<field name="name">account.analytic.account.list.inherit</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_list"/>
<field name="arch" type="xml">
<field name="debit" position="attributes">
<attribute name="invisible">False</attribute>
</field>
<field name="credit" position="attributes">
<attribute name="invisible">False</attribute>
</field>
</field>
</record>
</data>
</odoo>
@@ -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(
@@ -60,8 +60,8 @@
<field name="plan_id"/>
<field name="active" column_invisible="True"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="debit" sum="Debit"/>
<field name="credit" sum="Credit"/>
<field name="debit" sum="Debit" invisible="1"/>
<field name="credit" sum="Credit" invisible="1"/>
<field name="balance" sum="Balance"/>
</tree>
</field>