Because of the change in order of operations, for the main company when we install e.g. l10n_ec, the CoA installed is the Ecuadorian one, which makes the fiscal country EC, but the country_id still US. We suspect https://github.com/odoo/odoo/blob/7cb109e7b0ee2e46cef79ec7d3076d16715567f9/addons/account/models/chart_template.py#L278 for the change in behaviour as the generic coa does not have US as company anymore and that somehow led for the sales journal to require to use document types. (there we use the fiscal country which is set to Ecuador) The solution anyhow here, is that for the demo data, we should use the fiscal country as well to see if we need to add the document type to the demo invoices or not. closes odoo/odoo#92772 X-original-commit: 40dab08559d5b4c837589ce96d6d7ce23f14fd98 Signed-off-by: William André (wan) <wan@odoo.com>
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
|
|
from odoo import api, models
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class AccountChartTemplate(models.Model):
|
|
_inherit = "account.chart.template"
|
|
|
|
@api.model
|
|
def _get_demo_data_move(self):
|
|
ref = self.env.ref
|
|
cid = self.env.company.id
|
|
model, data = super()._get_demo_data_move()
|
|
if self.env.company.account_fiscal_country_id.code == 'EC':
|
|
document_type = ref('l10n_ec.ec_dt_18', False) and ref('l10n_ec.ec_dt_18').id or False
|
|
data[f'{cid}_demo_invoice_1']['l10n_latam_document_type_id'] = document_type
|
|
data[f'{cid}_demo_invoice_2']['l10n_latam_document_type_id'] = document_type
|
|
data[f'{cid}_demo_invoice_3']['l10n_latam_document_type_id'] = document_type
|
|
data[f'{cid}_demo_invoice_followup']['l10n_latam_document_type_id'] = document_type
|
|
data[f'{cid}_demo_invoice_5']['l10n_latam_document_number'] = '001-001-00001'
|
|
data[f'{cid}_demo_invoice_equipment_purchase']['l10n_latam_document_number'] = '001-001-00002'
|
|
return model, data
|