When filling a Sales Order applicability rule line, the financial account prefix is useless, as it will not be used. Thus we can make it invisible in the case of business_domain corresponding to sales and purchases. task-3040927 closes odoo/odoo#105014 Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
23 lines
729 B
Python
23 lines
729 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models, api
|
|
|
|
|
|
class AccountAnalyticApplicability(models.Model):
|
|
_inherit = 'account.analytic.applicability'
|
|
_description = "Analytic Plan's Applicabilities"
|
|
|
|
business_domain = fields.Selection(
|
|
selection_add=[
|
|
('expense', 'Expense'),
|
|
],
|
|
ondelete={'expense': 'cascade'},
|
|
)
|
|
|
|
@api.depends('business_domain')
|
|
def _compute_display_account_prefix(self):
|
|
super()._compute_display_account_prefix()
|
|
for applicability in self.filtered(lambda rec: rec.business_domain == 'expense'):
|
|
applicability.display_account_prefix = True
|