[FIX] account: remove dead code complete_tax_set
This field was used in version 9.0 [1] to allow users to select their tax rate, but it was removed in version 12 [2] [1] https://github.com/odoo/odoo/commit/c04065abd8f62c9a211c8fa824f5eecf68e61b73 [2] https://github.com/odoo/odoo/commit/87f0d2eefb77bfc6a9a0fa7f7dcd1475c7c34639 closes odoo/odoo#80185 Related: odoo/enterprise#22441 Related: odoo/upgrade#3057 Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
@@ -94,9 +94,6 @@ class AccountChartTemplate(models.Model):
|
||||
currency_id = fields.Many2one('res.currency', string='Currency', required=True)
|
||||
use_anglo_saxon = fields.Boolean(string="Use Anglo-Saxon accounting", default=False)
|
||||
use_storno_accounting = fields.Boolean(string="Use Storno accounting", default=False)
|
||||
complete_tax_set = fields.Boolean(string='Complete Set of Taxes', default=True,
|
||||
help="This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list "
|
||||
"of taxes. This last choice assumes that the set of tax defined on this template is complete")
|
||||
account_ids = fields.One2many('account.account.template', 'chart_template_id', string='Associated Account Templates')
|
||||
tax_template_ids = fields.One2many('account.tax.template', 'chart_template_id', string='Tax Template List',
|
||||
help='List of all the taxes that have to be installed by the wizard')
|
||||
@@ -196,7 +193,7 @@ class AccountChartTemplate(models.Model):
|
||||
# If we don't have any chart of account on this company, install this chart of account
|
||||
if not company.chart_template_id and not self.existing_accounting(company):
|
||||
for template in self:
|
||||
template.with_context(default_company_id=company.id)._load(15.0, 15.0, company)
|
||||
template.with_context(default_company_id=company.id)._load(company)
|
||||
# Install the demo data when the first localization is instanciated on the company
|
||||
if install_demo and self.env.ref('base.module_account').demo:
|
||||
self.with_context(
|
||||
@@ -219,7 +216,7 @@ class AccountChartTemplate(models.Model):
|
||||
# Do not rollback installation of CoA if demo data failed
|
||||
_logger.exception('Error while loading accounting demo data')
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
def _load(self, company):
|
||||
""" Installs this chart of accounts on the current company, replacing
|
||||
the existing one if it had already one defined. If some accounting entries
|
||||
had already been made, this function fails instead, triggering a UserError.
|
||||
@@ -278,9 +275,6 @@ class AccountChartTemplate(models.Model):
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# If the floats for sale/purchase rates have been filled, create templates from them
|
||||
self._create_tax_templates_from_rates(company.id, sale_tax_rate, purchase_tax_rate)
|
||||
|
||||
# Install all the templates objects and generate the real objects
|
||||
acc_template_ref, taxes_ref = self._install_template(company, code_digits=self.code_digits)
|
||||
|
||||
@@ -359,28 +353,6 @@ class AccountChartTemplate(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _create_tax_templates_from_rates(self, company_id, sale_tax_rate, purchase_tax_rate):
|
||||
'''
|
||||
This function checks if this chart template is configured as containing a full set of taxes, and if
|
||||
it's not the case, it creates the templates for account.tax object accordingly to the provided sale/purchase rates.
|
||||
Then it saves the new tax templates as default taxes to use for this chart template.
|
||||
|
||||
:param company_id: id of the company for which the wizard is running
|
||||
:param sale_tax_rate: the rate to use for created sales tax
|
||||
:param purchase_tax_rate: the rate to use for created purchase tax
|
||||
:return: True
|
||||
'''
|
||||
self.ensure_one()
|
||||
obj_tax_temp = self.env['account.tax.template']
|
||||
all_parents = self._get_chart_parent_ids()
|
||||
# create tax templates from purchase_tax_rate and sale_tax_rate fields
|
||||
if not self.complete_tax_set:
|
||||
ref_taxs = obj_tax_temp.search([('type_tax_use', '=', 'sale'), ('chart_template_id', 'in', all_parents)], order="sequence, id desc", limit=1)
|
||||
ref_taxs.write({'amount': sale_tax_rate, 'name': _('Tax %.2f%%') % sale_tax_rate, 'description': '%.2f%%' % sale_tax_rate})
|
||||
ref_taxs = obj_tax_temp.search([('type_tax_use', '=', 'purchase'), ('chart_template_id', 'in', all_parents)], order="sequence, id desc", limit=1)
|
||||
ref_taxs.write({'amount': purchase_tax_rate, 'name': _('Tax %.2f%%') % purchase_tax_rate, 'description': '%.2f%%' % purchase_tax_rate})
|
||||
return True
|
||||
|
||||
def _get_chart_parent_ids(self):
|
||||
""" Returns the IDs of all ancestor charts, including the chart itself.
|
||||
(inverse of child_of operator)
|
||||
|
||||
@@ -157,7 +157,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
if self.env.company == self.company_id \
|
||||
and self.chart_template_id \
|
||||
and self.chart_template_id != self.company_id.chart_template_id:
|
||||
self.chart_template_id._load(15.0, 15.0, self.env.company)
|
||||
self.chart_template_id._load(self.env.company)
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_has_chart_of_accounts(self):
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<field name="transfer_account_code_prefix"/>
|
||||
<field name="code_digits" />
|
||||
<field name="visible" />
|
||||
<field name="complete_tax_set" />
|
||||
</group>
|
||||
<separator string="Default Taxes" colspan="4"/>
|
||||
<field name="tax_template_ids" colspan="4" nolabel="1"/>
|
||||
|
||||
@@ -10,6 +10,5 @@
|
||||
<field name="transfer_account_code_prefix">100</field>
|
||||
<field name="currency_id" ref="base.AED" />
|
||||
<field name="country_id" ref="base.ae"/>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -44,7 +44,7 @@ class AccountChartTemplate(models.Model):
|
||||
}
|
||||
return match.get(chart_template_id)
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
def _load(self, company):
|
||||
""" Set companies AFIP Responsibility and Country if AR CoA is installed, also set tax calculation rounding
|
||||
method required in order to properly validate match AFIP invoices.
|
||||
|
||||
@@ -64,7 +64,7 @@ class AccountChartTemplate(models.Model):
|
||||
# the default VAT type.
|
||||
company.partner_id.l10n_latam_identification_type_id = self.env.ref('l10n_ar.it_cuit')
|
||||
|
||||
res = super()._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
res = super()._load(company)
|
||||
|
||||
# If Responsable Monotributista remove the default purchase tax
|
||||
if self == self.env.ref('l10n_ar.l10nar_base_chart_template') or \
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<!-- Vorlagen: Kontenplan -->
|
||||
<record id="l10n_at_chart_template" model="account.chart.template">
|
||||
<field name="name">Einheitskontenrahmen Österreich 2010</field>
|
||||
<field name="complete_tax_set" eval="True" />
|
||||
<field name="visible" eval="True" />
|
||||
|
||||
<field name="property_account_receivable_id" ref="chart_at_template_2000" />
|
||||
|
||||
@@ -6,8 +6,8 @@ class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
# Write paperformat and report template used on company
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
res = super(AccountChartTemplate, self)._load(company)
|
||||
if self == self.env.ref('l10n_at.l10n_at_chart_template'):
|
||||
company.write({
|
||||
'external_report_layout_id': self.env.ref('l10n_din5008.external_layout_din5008').id,
|
||||
|
||||
@@ -6,8 +6,8 @@ class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
# Write paperformat and report template used on company
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
res = super(AccountChartTemplate, self)._load(company)
|
||||
if self == self.env.ref('l10n_ch.l10nch_chart_template'):
|
||||
company.write({
|
||||
'external_report_layout_id': self.env.ref('l10n_din5008.external_layout_din5008').id,
|
||||
|
||||
@@ -7,9 +7,9 @@ from odoo.http import request
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
def _load(self, company):
|
||||
""" Set tax calculation rounding method required in Chilean localization"""
|
||||
res = super()._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
res = super()._load(company)
|
||||
if company.account_fiscal_country_id.code == 'CL':
|
||||
company.write({'tax_calculation_rounding_method': 'round_globally'})
|
||||
return res
|
||||
|
||||
@@ -6,8 +6,8 @@ class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
# Write paperformat and report template used on company
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
res = super(AccountChartTemplate, self)._load(company)
|
||||
if self in [
|
||||
self.env.ref('l10n_de_skr03.l10n_de_chart_template', raise_if_not_found=False),
|
||||
self.env.ref('l10n_de_skr04.l10n_chart_de_skr04', raise_if_not_found=False)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
<record id="account_chart_template_pymes" model="account.chart.template">
|
||||
<field name="name">PGCE PYMEs 2008</field>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="cash_account_code_prefix">570</field>
|
||||
<field name="bank_account_code_prefix">572</field>
|
||||
@@ -24,7 +23,6 @@
|
||||
|
||||
<record id="account_chart_template_assoc" model="account.chart.template">
|
||||
<field name="name">PGCE entidades sin ánimo de lucro 2008</field>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="cash_account_code_prefix">570</field>
|
||||
<field name="bank_account_code_prefix">572</field>
|
||||
@@ -35,7 +33,6 @@
|
||||
|
||||
<record id="account_chart_template_full" model="account.chart.template">
|
||||
<field name="name">PGCE completo 2008</field>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="cash_account_code_prefix">570</field>
|
||||
<field name="bank_account_code_prefix">572</field>
|
||||
|
||||
@@ -6,8 +6,8 @@ from odoo import models
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
rslt = super()._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
rslt = super()._load(company)
|
||||
|
||||
if company.account_fiscal_country_id in self.env.ref('base.europe').country_ids:
|
||||
company._map_eu_taxes()
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<field name="bank_account_code_prefix">512</field>
|
||||
<field name="cash_account_code_prefix">53</field>
|
||||
<field name="transfer_account_code_prefix">58</field>
|
||||
<field name="complete_tax_set" eval="True" />
|
||||
<field name="country_id" ref="base.fr"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<data>
|
||||
<!-- Chart template account links -->
|
||||
<record id="configurable_chart_template" model="account.chart.template">
|
||||
<field name="complete_tax_set" eval="False"/>
|
||||
<field name="use_anglo_saxon" eval="True"/>
|
||||
|
||||
<field name="property_account_receivable_id" ref="receivable"/>
|
||||
|
||||
@@ -12,8 +12,8 @@ _logger = logging.getLogger(__name__)
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
res = super(AccountChartTemplate, self)._load(company)
|
||||
# Copy chart of account translations when loading chart of account
|
||||
for chart_template in self.filtered('spoken_languages'):
|
||||
external_id = self.env['ir.model.data'].search([
|
||||
|
||||
@@ -58,8 +58,8 @@ class AccountChartTemplate(models.Model):
|
||||
res['tag_ids'] = [(6, 0, self.env.ref('l10n_mx.account_tag_102_01').ids)]
|
||||
return res
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
res = super()._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
def _load(self, company):
|
||||
res = super()._load(company)
|
||||
if self == self.env.ref('l10n_mx.mx_coa'):
|
||||
company.account_journal_payment_debit_account_id.tag_ids = [(6, 0, self.env.ref('l10n_mx.account_tag_102_01').ids)]
|
||||
company.account_journal_payment_credit_account_id.tag_ids = [(6, 0, self.env.ref('l10n_mx.account_tag_102_01').ids)]
|
||||
|
||||
@@ -6,9 +6,9 @@ from odoo import api, Command, models
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
def _load(self, company):
|
||||
# Add tag to 999999 account
|
||||
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
res = super(AccountChartTemplate, self)._load(company)
|
||||
if company.account_fiscal_country_id.code == 'NL':
|
||||
account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.company.id)])
|
||||
if account:
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<field name="property_account_payable_id" ref="ua_psbp_631"/>
|
||||
<field name="property_account_expense_categ_id" ref="ua_psbp_901"/>
|
||||
<field name="property_account_income_categ_id" ref="ua_psbp_701"/>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
<field name="use_anglo_saxon" eval="True"/>
|
||||
<field name="property_stock_account_input_categ_id" ref="ua_psbp_2812"/>
|
||||
<field name="property_stock_account_output_categ_id" ref="ua_psbp_2811"/>
|
||||
@@ -21,7 +20,6 @@
|
||||
<field name="property_account_payable_id" ref="ua_ias_1200"/>
|
||||
<field name="property_account_expense_categ_id" ref="ua_ias_2200"/>
|
||||
<field name="property_account_income_categ_id" ref="ua_ias_2000"/>
|
||||
<field name="complete_tax_set" eval="True"/>
|
||||
<field name="use_anglo_saxon" eval="True"/>
|
||||
<field name="property_stock_account_input_categ_id" ref="ua_ias_1201"/>
|
||||
<field name="property_stock_account_output_categ_id" ref="ua_ias_1121"/>
|
||||
|
||||
@@ -5,7 +5,7 @@ from odoo import api, models
|
||||
class AccountChartTemplate(models.Model):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, sale_tax_rate, purchase_tax_rate, company):
|
||||
def _load(self, company):
|
||||
"""Remove the payment methods that are created for the company before installing the chart of accounts.
|
||||
|
||||
Keeping these existing pos.payment.method records interferes with the installation of chart of accounts
|
||||
@@ -13,6 +13,6 @@ class AccountChartTemplate(models.Model):
|
||||
deleted during the loading of chart of accounts.
|
||||
"""
|
||||
self.env['pos.payment.method'].search([('company_id', '=', company.id)]).unlink()
|
||||
result = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
|
||||
result = super(AccountChartTemplate, self)._load(company)
|
||||
self.env['pos.config'].post_install_pos_localisation(companies=company)
|
||||
return result
|
||||
|
||||
@@ -335,7 +335,7 @@ class TestPurchaseToInvoice(AccountTestInvoicingCommon):
|
||||
company_b = self.env['res.company'].create({
|
||||
'name': 'Company B',
|
||||
})
|
||||
self.env.ref('l10n_generic_coa.configurable_chart_template')._load(15.0, 15.0, company_b)
|
||||
self.env.ref('l10n_generic_coa.configurable_chart_template')._load(company_b)
|
||||
|
||||
partner = self.env['res.partner'].create({
|
||||
'name': 'AAAAA',
|
||||
|
||||
Reference in New Issue
Block a user