- Add repartition lines on taxes - Link account tags directly to account.move.line; remove the tag_ids field from account.tag - Add a new report engine dedicated to tax reports, directly generating account tags. It is called as an alternate mode of generic tax report, with a dedicated "Use tax grids" toggle. >> The biggest change lies in the way the new tax report computes its values. Everything is now aggregated directly using the tags set on the account move lines. Thanks to that, modifying the configuration of a tax today will not impact the report for the previous periods anymore. This is a big improvement, as it means the report will keep on reflecting the values that were submitted to the state before, whatever the configuration change. - Add an audit char field to account.move.line telling with tax grids are impacted by the line, with the corresponding amount - Modify the behavior of cash basis taxes: the cash basis account is now used as the transition account, while the regular account given in tax declaration is used to store the final entry (it was the opposite before) - Modify every l10n_* module in order to keep them consistent with these changes closes odoo/odoo#32833 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
65 lines
3.9 KiB
Python
65 lines
3.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo.tests.common import HttpCase
|
|
|
|
|
|
class AccountingTestTemplConsistency(HttpCase):
|
|
'''Test the templates consistency between some objects like account.account when account.account.template.
|
|
'''
|
|
|
|
def check_fields_consistency(self, model_from, model_to, exceptions=[]):
|
|
'''Check the consistency of fields from one model to another by comparing if all fields
|
|
in the model_from are present in the model_to.
|
|
:param model_from: The model to compare.
|
|
:param model_to: The compared model.
|
|
:param exceptions: Not copied model's fields.
|
|
'''
|
|
|
|
def get_fields(model, extra_domain=None):
|
|
# Retrieve fields to compare
|
|
domain = [('model', '=', model), ('state', '=', 'base'), ('related', '=', False),
|
|
('compute', '=', False), ('store', '=', True)]
|
|
if extra_domain:
|
|
domain += extra_domain
|
|
return self.env['ir.model.fields'].search(domain)
|
|
|
|
from_fields = get_fields(model_from, extra_domain=[('name', 'not in', exceptions)])
|
|
to_fields_set = set([f.name for f in get_fields(model_to)])
|
|
for field in from_fields:
|
|
assert field.name in to_fields_set,\
|
|
'Missing field "%s" from "%s" in model "%s".' % (field.name, model_from, model_to)
|
|
|
|
def test_account_account_fields(self):
|
|
'''Test fields consistency for ('account.account', 'account.account.template')
|
|
'''
|
|
self.check_fields_consistency(
|
|
'account.account.template', 'account.account', exceptions=['chart_template_id', 'nocreate'])
|
|
self.check_fields_consistency(
|
|
'account.account', 'account.account.template', exceptions=['company_id', 'deprecated', 'opening_debit', 'opening_credit'])
|
|
|
|
def test_account_tax_fields(self):
|
|
'''Test fields consistency for ('account.tax', 'account.tax.template')
|
|
'''
|
|
self.check_fields_consistency('account.tax.template', 'account.tax', exceptions=['chart_template_id'])
|
|
self.check_fields_consistency('account.tax', 'account.tax.template', exceptions=['company_id'])
|
|
self.check_fields_consistency('account.tax.repartition.line.template', 'account.tax.repartition.line', exceptions=['plus_report_line_ids', 'minus_report_line_ids'])
|
|
self.check_fields_consistency('account.tax.repartition.line', 'account.tax.repartition.line.template', exceptions=['tag_ids', 'country_id', 'company_id', 'sequence'])
|
|
|
|
def test_fiscal_position_fields(self):
|
|
'''Test fields consistency for ('account.fiscal.position', 'account.fiscal.position.template')
|
|
'''
|
|
#main
|
|
self.check_fields_consistency('account.fiscal.position.template', 'account.fiscal.position', exceptions=['chart_template_id'])
|
|
self.check_fields_consistency('account.fiscal.position', 'account.fiscal.position.template', exceptions=['active', 'company_id', 'states_count'])
|
|
#taxes
|
|
self.check_fields_consistency('account.fiscal.position.tax.template', 'account.fiscal.position.tax')
|
|
self.check_fields_consistency('account.fiscal.position.tax', 'account.fiscal.position.tax.template')
|
|
#accounts
|
|
self.check_fields_consistency('account.fiscal.position.account.template', 'account.fiscal.position.account')
|
|
self.check_fields_consistency('account.fiscal.position.account', 'account.fiscal.position.account.template')
|
|
|
|
def test_reconcile_model_fields(self):
|
|
'''Test fields consistency for ('account.reconcile.model', 'account.reconcile.model.template')
|
|
'''
|
|
self.check_fields_consistency('account.reconcile.model.template', 'account.reconcile.model', exceptions=['chart_template_id'])
|
|
self.check_fields_consistency('account.reconcile.model', 'account.reconcile.model.template', exceptions=['company_id', 'journal_id', 'analytic_account_id', 'second_journal_id', 'second_analytic_account_id', 'analytic_tag_ids', 'second_analytic_tag_ids'])
|