Files
odoo_source/addons/l10n_do/models/chart_template.py
T
oco-odoo 17610e8ca9 [IMP] account, account_edi, l10n_*, purchase, sale: Generalize the use of account_fiscal_country_id
Before, account_fiscal_country_id was only use for tax operations; and country_id was used for all the other accounting stuff. Now, with the new ability to use foreign tax reports (with foreign VAT fiscal positions), we can generalize the fiscal country, sot that it is the one that needs to be used for the whole accounting. Since foreign tax reports were not supported before, account_fiscal_country_id is already set on existing database as the country for the "main" accounting, so the impact of this change is small.

closes odoo/odoo#68349

Related: odoo/upgrade#2322
Related: odoo/enterprise#17299
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-01 12:09:20 +00:00

51 lines
1.8 KiB
Python

# coding: utf-8
# Copyright 2016 iterativo (https://www.iterativo.do) <info@iterativo.do>
from odoo import models, api, _
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
@api.model
def _get_default_bank_journals_data(self):
if self.env.company.account_fiscal_country_id.code == 'DO':
return [
{'acc_name': _('Cash'), 'account_type': 'cash'},
{'acc_name': _('Caja Chica'), 'account_type': 'cash'},
{'acc_name': _('Cheques Clientes'), 'account_type': 'cash'},
{'acc_name': _('Bank'), 'account_type': 'bank'}
]
return super(AccountChartTemplate, self)._get_default_bank_journals_data()
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
"""Create fiscal journals for buys"""
res = super(AccountChartTemplate, self)._prepare_all_journals(
acc_template_ref, company, journals_dict=journals_dict)
if not self == self.env.ref('l10n_do.do_chart_template'):
return res
for journal in res:
if journal['code'] == 'FACT':
journal['name'] = _('Compras Fiscales')
res += [{
'type': 'purchase',
'name': _('Gastos No Deducibles'),
'code': 'GASTO',
'company_id': company.id,
'show_on_dashboard': True
}, {
'type': 'purchase',
'name': _('Migración CxP'),
'code': 'CXP',
'company_id': company.id,
'show_on_dashboard': True
}, {
'type': 'sale',
'name': _('Migración CxC'),
'code': 'CXC',
'company_id': company.id,
'show_on_dashboard': True
}]
return res