+
Exchange Rate
diff --git a/addons/l10n_ar/models/account_fiscal_position.py b/addons/l10n_ar/models/account_fiscal_position.py
index db42d2ce3d7..c032a689285 100644
--- a/addons/l10n_ar/models/account_fiscal_position.py
+++ b/addons/l10n_ar/models/account_fiscal_position.py
@@ -39,7 +39,7 @@ class AccountFiscalPosition(models.Model):
@api.onchange('l10n_ar_afip_responsibility_type_ids', 'country_group_id', 'country_id', 'zip_from', 'zip_to')
def _onchange_afip_responsibility(self):
- if self.company_id.country_id.code == "AR":
+ if self.company_id.account_fiscal_country_id.code == "AR":
if self.l10n_ar_afip_responsibility_type_ids and any(['country_group_id', 'country_id', 'zip_from', 'zip_to']):
return {'warning': {
'title': _("Warning"),
diff --git a/addons/l10n_ar/models/account_journal.py b/addons/l10n_ar/models/account_journal.py
index 0974ebaa5c6..235758f3501 100644
--- a/addons/l10n_ar/models/account_journal.py
+++ b/addons/l10n_ar/models/account_journal.py
@@ -107,7 +107,7 @@ class AccountJournal(models.Model):
'l10n_latam_use_documents')
def _check_afip_configurations(self):
""" Do not let the user update the journal if it already contains confirmed invoices """
- journals = self.filtered(lambda x: x.company_id.country_id.code == "AR" and x.type in ['sale', 'purchase'])
+ journals = self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.type in ['sale', 'purchase'])
invoices = self.env['account.move'].search([('journal_id', 'in', journals.ids), ('posted_before', '=', True)], limit=1)
if invoices:
raise ValidationError(
@@ -118,7 +118,7 @@ class AccountJournal(models.Model):
def _check_afip_pos_number(self):
to_review = self.filtered(
lambda x: x.type == 'sale' and x.l10n_latam_use_documents and
- x.company_id.country_id.code == "AR")
+ x.company_id.account_fiscal_country_id.code == "AR")
if to_review.filtered(lambda x: x.l10n_ar_afip_pos_number == 0):
raise ValidationError(_('Please define an AFIP POS number'))
diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py
index ca742205be9..ceef37d9671 100644
--- a/addons/l10n_ar/models/account_move.py
+++ b/addons/l10n_ar/models/account_move.py
@@ -38,7 +38,7 @@ class AccountMove(models.Model):
@api.constrains('move_type', 'journal_id')
def _check_moves_use_documents(self):
""" Do not let to create not invoices entries in journals that use documents """
- not_invoices = self.filtered(lambda x: x.company_id.country_id.code == "AR" and x.journal_id.type in ['sale', 'purchase'] and x.l10n_latam_use_documents and not x.is_invoice())
+ not_invoices = self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.journal_id.type in ['sale', 'purchase'] and x.l10n_latam_use_documents and not x.is_invoice())
if not_invoices:
raise ValidationError(_("The selected Journal can't be used in this transaction, please select one that doesn't use documents as these are just for Invoices."))
@@ -62,7 +62,7 @@ class AccountMove(models.Model):
@api.depends('invoice_line_ids', 'invoice_line_ids.product_id', 'invoice_line_ids.product_id.type', 'journal_id')
def _compute_l10n_ar_afip_concept(self):
- recs_afip = self.filtered(lambda x: x.company_id.country_id.code == "AR" and x.l10n_latam_use_documents)
+ recs_afip = self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.l10n_latam_use_documents)
for rec in recs_afip:
rec.l10n_ar_afip_concept = rec._get_concept()
remaining = self - recs_afip
@@ -89,7 +89,7 @@ class AccountMove(models.Model):
def _get_l10n_latam_documents_domain(self):
self.ensure_one()
domain = super()._get_l10n_latam_documents_domain()
- if self.journal_id.company_id.country_id.code == "AR":
+ if self.journal_id.company_id.account_fiscal_country_id.code == "AR":
letters = self.journal_id._get_journal_letter(counterpart_partner=self.partner_id.commercial_partner_id)
domain += ['|', ('l10n_ar_letter', '=', False), ('l10n_ar_letter', 'in', letters)]
codes = self.journal_id._get_journal_codes()
@@ -125,7 +125,7 @@ class AccountMove(models.Model):
@api.onchange('partner_id')
def _onchange_afip_responsibility(self):
- if self.company_id.country_id.code == 'AR' and self.l10n_latam_use_documents and self.partner_id \
+ if self.company_id.account_fiscal_country_id.code == 'AR' and self.l10n_latam_use_documents and self.partner_id \
and not self.partner_id.l10n_ar_afip_responsibility_type_id:
return {'warning': {
'title': _('Missing Partner Configuration'),
@@ -136,7 +136,7 @@ class AccountMove(models.Model):
def _onchange_partner_journal(self):
""" This method is used when the invoice is created from the sale or subscription """
expo_journals = ['FEERCEL', 'FEEWS', 'FEERCELP']
- for rec in self.filtered(lambda x: x.company_id.country_id.code == "AR" and x.journal_id.type == 'sale'
+ for rec in self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.journal_id.type == 'sale'
and x.l10n_latam_use_documents and x.partner_id.l10n_ar_afip_responsibility_type_id):
res_code = rec.partner_id.l10n_ar_afip_responsibility_type_id.code
domain = [('company_id', '=', rec.company_id.id), ('l10n_latam_use_documents', '=', True), ('type', '=', 'sale')]
@@ -158,7 +158,7 @@ class AccountMove(models.Model):
raise RedirectWarning(msg, action.id, _('Go to Journals'))
def _post(self, soft=True):
- ar_invoices = self.filtered(lambda x: x.company_id.country_id.code == "AR" and x.l10n_latam_use_documents)
+ ar_invoices = self.filtered(lambda x: x.company_id.account_fiscal_country_id.code == "AR" and x.l10n_latam_use_documents)
for rec in ar_invoices:
rec.l10n_ar_afip_responsibility_type_id = rec.commercial_partner_id.l10n_ar_afip_responsibility_type_id.id
if rec.company_id.currency_id == rec.currency_id:
@@ -220,7 +220,7 @@ class AccountMove(models.Model):
def _get_last_sequence_domain(self, relaxed=False):
where_string, param = super(AccountMove, self)._get_last_sequence_domain(relaxed)
- if self.company_id.country_id.code == "AR" and self.l10n_latam_use_documents:
+ if self.company_id.account_fiscal_country_id.code == "AR" and self.l10n_latam_use_documents:
if not self.journal_id.l10n_ar_share_sequences:
where_string += " AND l10n_latam_document_type_id = %(l10n_latam_document_type_id)s"
param['l10n_latam_document_type_id'] = self.l10n_latam_document_type_id.id or 0
@@ -286,6 +286,6 @@ class AccountMove(models.Model):
def _get_name_invoice_report(self):
self.ensure_one()
- if self.l10n_latam_use_documents and self.company_id.country_id.code == 'AR':
+ if self.l10n_latam_use_documents and self.company_id.account_fiscal_country_id.code == 'AR':
return 'l10n_ar.report_invoice_document'
return super()._get_name_invoice_report()
diff --git a/addons/l10n_ar/views/report_invoice.xml b/addons/l10n_ar/views/report_invoice.xml
index 78a27108e19..0d57085e636 100644
--- a/addons/l10n_ar/views/report_invoice.xml
+++ b/addons/l10n_ar/views/report_invoice.xml
@@ -184,7 +184,7 @@
-
:
+
:
diff --git a/addons/l10n_ca/views/report_invoice.xml b/addons/l10n_ca/views/report_invoice.xml
index 6c79c7aa7d0..80338c7eafd 100644
--- a/addons/l10n_ca/views/report_invoice.xml
+++ b/addons/l10n_ca/views/report_invoice.xml
@@ -1,7 +1,7 @@
diff --git a/addons/l10n_ch/models/account_bank_statement.py b/addons/l10n_ch/models/account_bank_statement.py
index 53c144f3893..da63c6eb654 100644
--- a/addons/l10n_ch/models/account_bank_statement.py
+++ b/addons/l10n_ch/models/account_bank_statement.py
@@ -9,7 +9,7 @@ class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"
def _find_or_create_bank_account(self):
- if self.company_id.country_id.code == 'CH' and _is_l10n_ch_postal(self.account_number):
+ if self.company_id.account_fiscal_country_id.code == 'CH' and _is_l10n_ch_postal(self.account_number):
bank_account = self.env['res.partner.bank'].search(
[('company_id', '=', self.company_id.id),
('sanitized_acc_number', 'like', self.account_number + '%'),
diff --git a/addons/l10n_ch/models/account_invoice.py b/addons/l10n_ch/models/account_invoice.py
index fdc900287ae..07f087e7292 100644
--- a/addons/l10n_ch/models/account_invoice.py
+++ b/addons/l10n_ch/models/account_invoice.py
@@ -244,7 +244,7 @@ class AccountMove(models.Model):
@api.depends('move_type', 'partner_bank_id', 'payment_reference')
def _compute_l10n_ch_isr_needs_fixing(self):
for inv in self:
- if inv.move_type == 'in_invoice' and inv.company_id.country_id.code == "CH":
+ if inv.move_type == 'in_invoice' and inv.company_id.account_fiscal_country_id.code == "CH":
partner_bank = inv.partner_bank_id
needs_isr_ref = partner_bank._is_qr_iban() or partner_bank._is_isr_issuer()
if needs_isr_ref and not inv._has_isr_ref():
diff --git a/addons/l10n_ch/models/res_bank.py b/addons/l10n_ch/models/res_bank.py
index cd0e8c6a1ef..d583a0b743f 100644
--- a/addons/l10n_ch/models/res_bank.py
+++ b/addons/l10n_ch/models/res_bank.py
@@ -52,7 +52,7 @@ class ResPartnerBank(models.Model):
# fields to configure ISR payment slip generation
l10n_ch_isr_subscription_chf = fields.Char(string='CHF ISR Subscription Number', help='The subscription number provided by the bank or Postfinance to identify the bank, used to generate ISR in CHF. eg. 01-162-8')
l10n_ch_isr_subscription_eur = fields.Char(string='EUR ISR Subscription Number', help='The subscription number provided by the bank or Postfinance to identify the bank, used to generate ISR in EUR. eg. 03-162-5')
- l10n_ch_show_subscription = fields.Boolean(compute='_compute_l10n_ch_show_subscription', default=lambda self: self.env.company.country_id.code == 'CH')
+ l10n_ch_show_subscription = fields.Boolean(compute='_compute_l10n_ch_show_subscription', default=lambda self: self.env.company.account_fiscal_country_id.code == 'CH')
def _is_isr_issuer(self):
return (_is_l10n_ch_isr_issuer(self.l10n_ch_postal, 'CHF')
@@ -92,9 +92,9 @@ class ResPartnerBank(models.Model):
if bank.partner_id:
bank.l10n_ch_show_subscription = bool(bank.partner_id.ref_company_ids)
elif bank.company_id:
- bank.l10n_ch_show_subscription = bank.company_id.country_id.code == 'CH'
+ bank.l10n_ch_show_subscription = bank.company_id.account_fiscal_country_id.code == 'CH'
else:
- bank.l10n_ch_show_subscription = self.env.company.country_id.code == 'CH'
+ bank.l10n_ch_show_subscription = self.env.company.account_fiscal_country_id.code == 'CH'
@api.depends('acc_number', 'acc_type')
def _compute_sanitized_acc_number(self):
diff --git a/addons/l10n_cl/models/account_chart_template.py b/addons/l10n_cl/models/account_chart_template.py
index ef5864518fa..4996bad35dc 100644
--- a/addons/l10n_cl/models/account_chart_template.py
+++ b/addons/l10n_cl/models/account_chart_template.py
@@ -10,6 +10,6 @@ class AccountChartTemplate(models.Model):
def _load(self, sale_tax_rate, purchase_tax_rate, company):
""" Set tax calculation rounding method required in Chilean localization"""
res = super()._load(sale_tax_rate, purchase_tax_rate, company)
- if company.country_id.code == 'CL':
+ if company.account_fiscal_country_id.code == 'CL':
company.write({'tax_calculation_rounding_method': 'round_globally'})
return res
diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py
index 1227af0116b..c8bfb8d0ef7 100644
--- a/addons/l10n_cl/models/account_move.py
+++ b/addons/l10n_cl/models/account_move.py
@@ -17,7 +17,7 @@ class AccountMove(models.Model):
def _get_l10n_latam_documents_domain(self):
self.ensure_one()
- if self.journal_id.company_id.country_id != self.env.ref('base.cl') or not \
+ if self.journal_id.company_id.account_fiscal_country_id != self.env.ref('base.cl') or not \
self.journal_id.l10n_latam_use_documents:
return super()._get_l10n_latam_documents_domain()
if self.journal_id.type == 'sale':
@@ -46,7 +46,7 @@ class AccountMove(models.Model):
def _check_document_types_post(self):
for rec in self.filtered(
- lambda r: r.company_id.country_id.code == "CL" and
+ lambda r: r.company_id.account_fiscal_country_id.code == "CL" and
r.journal_id.type in ['sale', 'purchase']):
tax_payer_type = rec.partner_id.l10n_cl_sii_taxpayer_type
vat = rec.partner_id.vat
@@ -104,14 +104,14 @@ class AccountMove(models.Model):
def _get_starting_sequence(self):
""" If use documents then will create a new starting sequence using the document type code prefix and the
journal document number with a 6 padding number """
- if self.journal_id.l10n_latam_use_documents and self.env.company.country_id.code == "CL":
+ if self.journal_id.l10n_latam_use_documents and self.env.company.account_fiscal_country_id.code == "CL":
if self.l10n_latam_document_type_id:
return self._l10n_cl_get_formatted_sequence()
return super()._get_starting_sequence()
def _get_last_sequence_domain(self, relaxed=False):
where_string, param = super(AccountMove, self)._get_last_sequence_domain(relaxed)
- if self.company_id.country_id.code == "CL" and self.l10n_latam_use_documents:
+ if self.company_id.account_fiscal_country_id.code == "CL" and self.l10n_latam_use_documents:
where_string = where_string.replace('journal_id = %(journal_id)s AND', '')
where_string += ' AND l10n_latam_document_type_id = %(l10n_latam_document_type_id)s AND ' \
'company_id = %(company_id)s AND move_type IN (\'out_invoice\', \'out_refund\')'
@@ -121,6 +121,6 @@ class AccountMove(models.Model):
def _get_name_invoice_report(self):
self.ensure_one()
- if self.l10n_latam_use_documents and self.company_id.country_id.code == 'CL':
+ if self.l10n_latam_use_documents and self.company_id.account_fiscal_country_id.code == 'CL':
return 'l10n_cl.report_invoice_document'
return super()._get_name_invoice_report()
diff --git a/addons/l10n_cl/models/res_company.py b/addons/l10n_cl/models/res_company.py
index 8821be52e20..28155f9cfc2 100644
--- a/addons/l10n_cl/models/res_company.py
+++ b/addons/l10n_cl/models/res_company.py
@@ -9,4 +9,4 @@ class ResCompany(models.Model):
def _localization_use_documents(self):
""" Chilean localization use documents """
self.ensure_one()
- return self.country_id.code == "CL" or super()._localization_use_documents()
+ return self.account_fiscal_country_id.code == "CL" or super()._localization_use_documents()
diff --git a/addons/l10n_cl/views/report_invoice.xml b/addons/l10n_cl/views/report_invoice.xml
index c9771603ca4..20b3f0560a1 100644
--- a/addons/l10n_cl/views/report_invoice.xml
+++ b/addons/l10n_cl/views/report_invoice.xml
@@ -92,7 +92,7 @@
- :
+ :
diff --git a/addons/l10n_de/models/chart_template.py b/addons/l10n_de/models/chart_template.py
index b62a5c2d313..48b07460a60 100644
--- a/addons/l10n_de/models/chart_template.py
+++ b/addons/l10n_de/models/chart_template.py
@@ -8,7 +8,7 @@ class AccountChartTemplate(models.Model):
@api.model
def _prepare_transfer_account_for_direct_creation(self, name, company):
res = super(AccountChartTemplate, self)._prepare_transfer_account_for_direct_creation(name, company)
- if company.country_id.code == 'DE':
+ if company.account_fiscal_country_id.code == 'DE':
xml_id = self.env.ref('l10n_de.tag_de_asset_bs_B_III_2').id
res.setdefault('tag_ids', [])
res['tag_ids'].append((4, xml_id))
@@ -17,7 +17,7 @@ class AccountChartTemplate(models.Model):
# 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)
- if company.country_id.code == 'DE':
+ if company.account_fiscal_country_id.code == 'DE':
company.write({'external_report_layout_id': self.env.ref('l10n_de.external_layout_din5008').id,
'paperformat_id': self.env.ref('l10n_de.paperformat_euro_din').id})
return res
diff --git a/addons/l10n_de/models/datev.py b/addons/l10n_de/models/datev.py
index d2e0f8cbd64..fad71b034de 100644
--- a/addons/l10n_de/models/datev.py
+++ b/addons/l10n_de/models/datev.py
@@ -26,7 +26,7 @@ class AccountMove(models.Model):
for invoice in self.filtered(lambda move: move.is_invoice()):
for line in invoice.invoice_line_ids:
account_tax = line.account_id.tax_ids.ids
- if account_tax and invoice.company_id.country_id.code == 'DE':
+ if account_tax and invoice.company_id.account_fiscal_country_id.code == 'DE':
account_name = line.account_id.name
for tax in line.tax_ids:
if tax.id not in account_tax:
@@ -43,7 +43,7 @@ class ProductTemplate(models.Model):
invoicing to not be blocked by the above constraint"""
result = super(ProductTemplate, self)._get_product_accounts()
company = self.env.company
- if company.country_id.code == "DE":
+ if company.account_fiscal_country_id.code == "DE":
if not self.property_account_income_id:
taxes = self.taxes_id.filtered(lambda t: t.company_id == company)
if not result['income'] or (result['income'].tax_ids and taxes and taxes[0] not in result['income'].tax_ids):
diff --git a/addons/l10n_de/report/din5008_report.xml b/addons/l10n_de/report/din5008_report.xml
index 8dabcac1fb2..d54be2d96d8 100644
--- a/addons/l10n_de/report/din5008_report.xml
+++ b/addons/l10n_de/report/din5008_report.xml
@@ -98,7 +98,7 @@
- :
+ :
diff --git a/addons/l10n_dk/models/account_chart_template.py b/addons/l10n_dk/models/account_chart_template.py
index 51cc2ed97d2..2e39bc00401 100644
--- a/addons/l10n_dk/models/account_chart_template.py
+++ b/addons/l10n_dk/models/account_chart_template.py
@@ -10,7 +10,7 @@ class AccountChartTemplate(models.Model):
@api.model
def _prepare_transfer_account_for_direct_creation(self, name, company):
res = super(AccountChartTemplate, self)._prepare_transfer_account_for_direct_creation(name, company)
- if company.country_id.code == 'DK':
+ if company.account_fiscal_country_id.code == 'DK':
account_tag_liquidity = self.env.ref('l10n_dk.account_tag_liquidity')
res['tag_ids'] = [(6, 0, account_tag_liquidity.ids)]
res['name'] = 'Bank i transfer'
diff --git a/addons/l10n_dk/models/account_journal.py b/addons/l10n_dk/models/account_journal.py
index e4ffc538eb4..571dcf289eb 100644
--- a/addons/l10n_dk/models/account_journal.py
+++ b/addons/l10n_dk/models/account_journal.py
@@ -12,7 +12,7 @@ class AccountJournal(models.Model):
# OVERRIDE
account_vals = super()._prepare_liquidity_account_vals(company, code, vals)
- if company.country_id.code == 'DK':
+ if company.account_fiscal_country_id.code == 'DK':
# Ensure the newly liquidity accounts have the right account tag in order to be part
# of the Danish financial reports.
account_vals.setdefault('tag_ids', [])
diff --git a/addons/l10n_do/models/chart_template.py b/addons/l10n_do/models/chart_template.py
index 50efc5954cc..3fc2c20d856 100644
--- a/addons/l10n_do/models/chart_template.py
+++ b/addons/l10n_do/models/chart_template.py
@@ -9,7 +9,7 @@ class AccountChartTemplate(models.Model):
@api.model
def _get_default_bank_journals_data(self):
- if self.env.company.country_id and self.env.company.country_id.code.upper() == 'DO':
+ if self.env.company.account_fiscal_country_id.code == 'DO':
return [
{'acc_name': _('Cash'), 'account_type': 'cash'},
{'acc_name': _('Caja Chica'), 'account_type': 'cash'},
diff --git a/addons/l10n_eu_service/models/res_config_settings.py b/addons/l10n_eu_service/models/res_config_settings.py
index 190124cda58..89cff355491 100644
--- a/addons/l10n_eu_service/models/res_config_settings.py
+++ b/addons/l10n_eu_service/models/res_config_settings.py
@@ -11,4 +11,4 @@ class ResConfigSettings(models.TransientModel):
@api.depends('company_id')
def _compute_l10n_eu_services_european_country(self):
- self.l10n_eu_services_eu_country = self.company_id.country_id in self.env.ref('base.europe').country_ids
+ self.l10n_eu_services_eu_country = self.company_id.account_fiscal_country_id in self.env.ref('base.europe').country_ids
diff --git a/addons/l10n_eu_service/wizard/wizard.py b/addons/l10n_eu_service/wizard/wizard.py
index a81445fffee..c95e8168fd1 100644
--- a/addons/l10n_eu_service/wizard/wizard.py
+++ b/addons/l10n_eu_service/wizard/wizard.py
@@ -36,7 +36,7 @@ class l10n_eu_service(models.TransientModel):
def _default_done_country_ids(self):
user = self.env.user
eu_country_group = self._get_eu_res_country_group()
- return eu_country_group.country_ids - self._default_todo_country_ids() - user.company_id.country_id
+ return eu_country_group.country_ids - self._default_todo_country_ids() - user.company_id.account_fiscal_country_id
def _default_todo_country_ids(self):
user = self.env.user
@@ -45,7 +45,7 @@ class l10n_eu_service(models.TransientModel):
[('country_id', 'in', eu_country_group.country_ids.ids),
('vat_required', '=', False), ('auto_apply', '=', True),
('company_id', '=', user.company_id.id)])
- return eu_country_group.country_ids - eu_fiscal.mapped('country_id') - user.company_id.country_id
+ return eu_country_group.country_ids - eu_fiscal.mapped('country_id') - user.company_id.account_fiscal_country_id
company_id = fields.Many2one(
'res.company', string='Company', required=True, default=_get_default_company_id)
diff --git a/addons/l10n_fr/models/account_chart_template.py b/addons/l10n_fr/models/account_chart_template.py
index 9af2615a40a..fd61551aa6f 100644
--- a/addons/l10n_fr/models/account_chart_template.py
+++ b/addons/l10n_fr/models/account_chart_template.py
@@ -11,7 +11,7 @@ class AccountChartTemplate(models.Model):
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
journal_data = super(AccountChartTemplate, self)._prepare_all_journals(
acc_template_ref, company, journals_dict)
- if company.country_id.code != 'FR':
+ if company.account_fiscal_country_id.code != 'FR':
return journal_data
for journal in journal_data:
diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py
index d80c07d57ec..4b60bd32736 100644
--- a/addons/l10n_fr_fec/wizard/account_fr_fec.py
+++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py
@@ -91,7 +91,7 @@ class AccountFrFec(models.TransientModel):
http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom
"""
dom_tom_group = self.env.ref('l10n_fr.dom-tom')
- is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped('code')
+ is_dom_tom = company.account_fiscal_country_id.code in dom_tom_group.country_ids.mapped('code')
if not is_dom_tom and not company.vat:
raise UserError(_("Missing VAT number for company %s", company.name))
if not is_dom_tom and company.vat[0:2] != 'FR':
diff --git a/addons/l10n_in/models/account.py b/addons/l10n_in/models/account.py
index bdc6e36d0a3..f07c50afaf2 100644
--- a/addons/l10n_in/models/account.py
+++ b/addons/l10n_in/models/account.py
@@ -18,7 +18,7 @@ class AccountJournal(models.Model):
"""
result = super().name_get()
result_dict = dict(result)
- indian_journals = self.filtered(lambda j: j.company_id.country_id.code == 'IN' and
+ indian_journals = self.filtered(lambda j: j.company_id.account_fiscal_country_id.code == 'IN' and
j.l10n_in_gstin_partner_id and j.l10n_in_gstin_partner_id.vat)
for journal in indian_journals:
name = result_dict[journal.id]
@@ -32,7 +32,7 @@ class AccountMoveLine(models.Model):
@api.depends('move_id.line_ids', 'move_id.line_ids.tax_line_id', 'move_id.line_ids.debit', 'move_id.line_ids.credit')
def _compute_tax_base_amount(self):
- aml = self.filtered(lambda l: l.company_id.country_id.code == 'IN' and l.tax_line_id and l.product_id)
+ aml = self.filtered(lambda l: l.company_id.account_fiscal_country_id.code == 'IN' and l.tax_line_id and l.product_id)
for move_line in aml:
base_lines = move_line.move_id.line_ids.filtered(lambda line: move_line.tax_line_id in line.tax_ids and move_line.product_id == line.product_id)
move_line.tax_base_amount = abs(sum(base_lines.mapped('balance')))
@@ -49,7 +49,7 @@ class AccountTax(models.Model):
def get_grouping_key(self, invoice_tax_val):
""" Returns a string that will be used to group account.invoice.tax sharing the same properties"""
key = super(AccountTax, self).get_grouping_key(invoice_tax_val)
- if self.company_id.country_id.code == 'IN':
+ if self.company_id.account_fiscal_country_id.code == 'IN':
key += "-%s-%s"% (invoice_tax_val.get('l10n_in_product_id', False),
invoice_tax_val.get('l10n_in_uom_id', False))
return key
diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py
index fce81216c24..cd6e18ee7ba 100644
--- a/addons/l10n_in/models/account_invoice.py
+++ b/addons/l10n_in/models/account_invoice.py
@@ -24,7 +24,6 @@ class AccountMove(models.Model):
('deemed_export', 'Deemed Export')
], string="GST Treatment", readonly=True, states={'draft': [('readonly', False)]})
l10n_in_state_id = fields.Many2one('res.country.state', string="Location of supply")
- l10n_in_company_country_code = fields.Char(related='company_id.country_id.code', string="Country code")
l10n_in_gstin = fields.Char(string="GSTIN")
# For Export invoice this data is need in GSTR report
l10n_in_shipping_bill_number = fields.Char('Shipping bill number', readonly=True, states={'draft': [('readonly', False)]})
@@ -35,7 +34,7 @@ class AccountMove(models.Model):
@api.onchange('partner_id')
def _onchange_partner_id(self):
"""Use journal type to define document type because not miss state in any entry including POS entry"""
- if self.l10n_in_company_country_code == 'IN':
+ if self.country_code == 'IN':
self.l10n_in_gst_treatment = self.partner_id.l10n_in_gst_treatment
return super()._onchange_partner_id()
@@ -56,7 +55,7 @@ class AccountMove(models.Model):
def _get_tax_grouping_key_from_tax_line(self, tax_line):
# OVERRIDE to group taxes also by product.
res = super()._get_tax_grouping_key_from_tax_line(tax_line)
- if tax_line.move_id.journal_id.company_id.country_id.code == 'IN':
+ if tax_line.move_id.journal_id.company_id.account_fiscal_country_id.code == 'IN':
res['product_id'] = tax_line.product_id.id
return res
@@ -64,7 +63,7 @@ class AccountMove(models.Model):
def _get_tax_grouping_key_from_base_line(self, base_line, tax_vals):
# OVERRIDE to group taxes also by product.
res = super()._get_tax_grouping_key_from_base_line(base_line, tax_vals)
- if base_line.move_id.journal_id.company_id.country_id.code == 'IN':
+ if base_line.move_id.journal_id.company_id.account_fiscal_country_id.code == 'IN':
res['product_id'] = base_line.product_id.id
return res
@@ -92,7 +91,7 @@ class AccountMove(models.Model):
posted = super()._post(soft)
gst_treatment_name_mapping = {k: v for k, v in
self._fields['l10n_in_gst_treatment']._description_selection(self.env)}
- for move in posted.filtered(lambda m: m.l10n_in_company_country_code == 'IN'):
+ for move in posted.filtered(lambda m: m.country_code == 'IN'):
"""Check state is set in company/sub-unit"""
company_unit_partner = move.journal_id.l10n_in_gstin_partner_id or move.journal_id.company_id
if not company_unit_partner.state_id:
diff --git a/addons/l10n_in/views/account_invoice_views.xml b/addons/l10n_in/views/account_invoice_views.xml
index f2f55f341e9..9ae868540d3 100644
--- a/addons/l10n_in/views/account_invoice_views.xml
+++ b/addons/l10n_in/views/account_invoice_views.xml
@@ -6,9 +6,9 @@
-
+
+ attrs="{'invisible': ['|', ('country_code', '!=', 'IN'), ('move_type', '=', 'entry')], 'required': [('country_code', '=', 'IN'), ('move_type', '!=', 'entry')]}"/>
@@ -25,7 +25,7 @@
diff --git a/addons/l10n_in/views/report_invoice.xml b/addons/l10n_in/views/report_invoice.xml
index f77aa0134df..ee79eb95617 100644
--- a/addons/l10n_in/views/report_invoice.xml
+++ b/addons/l10n_in/views/report_invoice.xml
@@ -3,13 +3,13 @@
- o.company_id.country_id.code != 'IN'
+ o.company_id.account_fiscal_country_id.code != 'IN'
-
+
-
+
Destination of supply:
@@ -19,7 +19,7 @@
-
+
Total (In Words):
@@ -28,13 +28,13 @@
-
+
HSN/SAC |
-
+ |
|
diff --git a/addons/l10n_in_pos/models/pos_order.py b/addons/l10n_in_pos/models/pos_order.py
index 7b0caba644d..a35e7a9fedc 100644
--- a/addons/l10n_in_pos/models/pos_order.py
+++ b/addons/l10n_in_pos/models/pos_order.py
@@ -11,7 +11,7 @@ class PosOrder(models.Model):
def _get_account_move_line_group_data_type_key(self, data_type, values, options={}):
res = super(PosOrder, self)._get_account_move_line_group_data_type_key(data_type, values, options)
if data_type == 'tax' and res:
- if self.env['account.tax'].browse(values['tax_line_id']).company_id.country_id.code == 'IN':
+ if self.env['account.tax'].browse(values['tax_line_id']).company_id.account_fiscal_country_id.code == 'IN':
return res + (values['product_uom_id'], values['product_id'])
return res
diff --git a/addons/l10n_in_purchase/models/purchase_order.py b/addons/l10n_in_purchase/models/purchase_order.py
index d20db2cb479..10d8419c1ba 100644
--- a/addons/l10n_in_purchase/models/purchase_order.py
+++ b/addons/l10n_in_purchase/models/purchase_order.py
@@ -19,7 +19,7 @@ class PurchaseOrder(models.Model):
('special_economic_zone', 'Special Economic Zone'),
('deemed_export', 'Deemed Export')
], string="GST Treatment", states=Purchase.READONLY_STATES)
- l10n_in_company_country_code = fields.Char(related='company_id.country_id.code', string="Country code")
+ l10n_in_company_country_code = fields.Char(related='company_id.account_fiscal_country_id.code', string="Country code")
@api.onchange('company_id')
def l10n_in_onchange_company_id(self):
diff --git a/addons/l10n_in_purchase/views/report_purchase_order.xml b/addons/l10n_in_purchase/views/report_purchase_order.xml
index f2ffc0844ff..2882cd76acf 100644
--- a/addons/l10n_in_purchase/views/report_purchase_order.xml
+++ b/addons/l10n_in_purchase/views/report_purchase_order.xml
@@ -5,7 +5,7 @@
-
+
HSN/SAC Code:
@@ -19,7 +19,7 @@
-
+
HSN/SAC Code:
diff --git a/addons/l10n_in_sale/models/sale_order.py b/addons/l10n_in_sale/models/sale_order.py
index a945d52cdf7..5e93a0c8050 100644
--- a/addons/l10n_in_sale/models/sale_order.py
+++ b/addons/l10n_in_sale/models/sale_order.py
@@ -19,7 +19,7 @@ class SaleOrder(models.Model):
('special_economic_zone', 'Special Economic Zone'),
('deemed_export', 'Deemed Export'),
], string="GST Treatment", readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, compute="_compute_l10n_in_gst_treatment", store=True)
- l10n_in_company_country_code = fields.Char(related='company_id.country_id.code', string="Country code")
+ l10n_in_company_country_code = fields.Char(related='company_id.account_fiscal_country_id.code', string="Country code")
@api.depends('partner_id')
def _compute_l10n_in_gst_treatment(self):
diff --git a/addons/l10n_in_stock/views/report_stockpicking_operations.xml b/addons/l10n_in_stock/views/report_stockpicking_operations.xml
index cb6fb012d2c..5c8de46c68c 100644
--- a/addons/l10n_in_stock/views/report_stockpicking_operations.xml
+++ b/addons/l10n_in_stock/views/report_stockpicking_operations.xml
@@ -3,7 +3,7 @@
- HSN/SAC Code:
+ HSN/SAC Code:
diff --git a/addons/l10n_it_stock_ddt/models/account_invoice.py b/addons/l10n_it_stock_ddt/models/account_invoice.py
index b7713b27914..0a089b6509d 100644
--- a/addons/l10n_it_stock_ddt/models/account_invoice.py
+++ b/addons/l10n_it_stock_ddt/models/account_invoice.py
@@ -57,7 +57,7 @@ class AccountMove(models.Model):
@api.depends('invoice_line_ids', 'invoice_line_ids.sale_line_ids')
def _compute_ddt_ids(self):
- it_out_invoices = self.filtered(lambda i: i.move_type == 'out_invoice' and i.company_id.country_id.code == 'IT')
+ it_out_invoices = self.filtered(lambda i: i.move_type == 'out_invoice' and i.company_id.account_fiscal_country_id.code == 'IT')
for invoice in it_out_invoices:
invoice_line_pickings = invoice._get_ddt_values()
pickings = self.env['stock.picking']
diff --git a/addons/l10n_it_stock_ddt/models/stock_picking.py b/addons/l10n_it_stock_ddt/models/stock_picking.py
index 0dede776162..ac0c371a826 100644
--- a/addons/l10n_it_stock_ddt/models/stock_picking.py
+++ b/addons/l10n_it_stock_ddt/models/stock_picking.py
@@ -20,7 +20,7 @@ class StockPicking(models.Model):
default="sender", string='Transport Method')
l10n_it_transport_method_details = fields.Char('Transport Note')
l10n_it_parcels = fields.Integer(string="Parcels", default=1)
- l10n_it_country_code = fields.Char(related="company_id.country_id.code")
+ l10n_it_country_code = fields.Char(related="company_id.account_fiscal_country_id.code")
l10n_it_ddt_number = fields.Char('DDT Number', readonly=True)
def _action_done(self):
diff --git a/addons/l10n_it_stock_ddt/report/l10n_it_ddt_report.xml b/addons/l10n_it_stock_ddt/report/l10n_it_ddt_report.xml
index 42d84e08173..5e228aababb 100644
--- a/addons/l10n_it_stock_ddt/report/l10n_it_ddt_report.xml
+++ b/addons/l10n_it_stock_ddt/report/l10n_it_ddt_report.xml
@@ -24,7 +24,7 @@
Customer Address:
- :
+ :
diff --git a/addons/l10n_latam_base/models/res_partner.py b/addons/l10n_latam_base/models/res_partner.py
index 10396dbbf17..71728cf010a 100644
--- a/addons/l10n_latam_base/models/res_partner.py
+++ b/addons/l10n_latam_base/models/res_partner.py
@@ -23,7 +23,7 @@ class ResPartner(models.Model):
@api.onchange('country_id')
def _onchange_country(self):
- country = self.country_id or self.company_id.country_id or self.env.company.country_id
+ country = self.country_id or self.company_id.account_fiscal_country_id or self.env.company.account_fiscal_country_id
identification_type = self.l10n_latam_identification_type_id
if not identification_type or (identification_type.country_id != country):
self.l10n_latam_identification_type_id = self.env['l10n_latam.identification.type'].search(
diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py
index 78612a090fe..c341ef53171 100644
--- a/addons/l10n_latam_invoice_document/models/account_move.py
+++ b/addons/l10n_latam_invoice_document/models/account_move.py
@@ -203,7 +203,7 @@ class AccountMove(models.Model):
internal_types = ['credit_note']
else:
internal_types = ['invoice', 'debit_note']
- return [('internal_type', 'in', internal_types), ('country_id', '=', self.company_id.country_id.id)]
+ return [('internal_type', 'in', internal_types), ('country_id', '=', self.company_id.account_fiscal_country_id.id)]
@api.depends('journal_id', 'partner_id', 'company_id', 'move_type')
def _compute_l10n_latam_available_document_types(self):
diff --git a/addons/l10n_lu/models/account_chart_template.py b/addons/l10n_lu/models/account_chart_template.py
index 2d9b3f4cf45..8d4ca35463c 100644
--- a/addons/l10n_lu/models/account_chart_template.py
+++ b/addons/l10n_lu/models/account_chart_template.py
@@ -12,6 +12,6 @@ class AccountChartTemplate(models.Model):
journal_data = super(AccountChartTemplate, self)._prepare_all_journals(
acc_template_ref, company, journals_dict)
for journal in journal_data:
- if journal['type'] in ('sale', 'purchase') and company.country_id.code == "LU":
+ if journal['type'] in ('sale', 'purchase') and company.account_fiscal_country_id.code == "LU":
journal.update({'refund_sequence': True})
return journal_data
diff --git a/addons/l10n_mx/models/account.py b/addons/l10n_mx/models/account.py
index 7c038c127d6..ba4f1956942 100644
--- a/addons/l10n_mx/models/account.py
+++ b/addons/l10n_mx/models/account.py
@@ -13,7 +13,7 @@ class AccountJournal(models.Model):
# OVERRIDE
account_vals = super()._prepare_liquidity_account_vals(company, code, vals)
- if company.country_id.code == 'MX':
+ if company.account_fiscal_country_id.code == 'MX':
# When preparing the values to use when creating the default debit and credit accounts of a
# liquidity journal, set the correct tags for the mexican localization.
account_vals.setdefault('tag_ids', [])
diff --git a/addons/l10n_mx/models/chart_template.py b/addons/l10n_mx/models/chart_template.py
index d267febb4f2..dbd33d9350b 100644
--- a/addons/l10n_mx/models/chart_template.py
+++ b/addons/l10n_mx/models/chart_template.py
@@ -42,7 +42,7 @@ class AccountChartTemplate(models.Model):
@api.model
def _prepare_transfer_account_for_direct_creation(self, name, company):
res = super(AccountChartTemplate, self)._prepare_transfer_account_for_direct_creation(name, company)
- if company.country_id.code == 'MX':
+ if company.account_fiscal_country_id.code == 'MX':
xml_id = self.env.ref('l10n_mx.account_tag_102_01').id
res.setdefault('tag_ids', [])
res['tag_ids'].append((4, xml_id))
diff --git a/addons/l10n_nl/models/account_chart_template.py b/addons/l10n_nl/models/account_chart_template.py
index bd196fdbc0d..e6d8dda657f 100644
--- a/addons/l10n_nl/models/account_chart_template.py
+++ b/addons/l10n_nl/models/account_chart_template.py
@@ -9,7 +9,7 @@ class AccountChartTemplate(models.Model):
def _load(self, sale_tax_rate, purchase_tax_rate, company):
# Add tag to 999999 account
res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
- if company.country_id.code == 'NL':
+ if company.account_fiscal_country_id.code == 'NL':
account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.company.id)])
if account:
account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)]
@@ -18,7 +18,7 @@ class AccountChartTemplate(models.Model):
@api.model
def _prepare_transfer_account_for_direct_creation(self, name, company):
res = super(AccountChartTemplate, self)._prepare_transfer_account_for_direct_creation(name, company)
- if company.country_id.code == 'NL':
+ if company.account_fiscal_country_id.code == 'NL':
xml_id = self.env.ref('l10n_nl.account_tag_25').id
res.setdefault('tag_ids', [])
res['tag_ids'].append((4, xml_id))
diff --git a/addons/l10n_nl/models/account_journal.py b/addons/l10n_nl/models/account_journal.py
index 91c05218f72..05b0b51649c 100644
--- a/addons/l10n_nl/models/account_journal.py
+++ b/addons/l10n_nl/models/account_journal.py
@@ -11,7 +11,7 @@ class AccountJournal(models.Model):
# OVERRIDE
account_vals = super()._prepare_liquidity_account_vals(company, code, vals)
- if company.country_id.code == 'NL':
+ if company.account_fiscal_country_id.code == 'NL':
# Ensure the newly liquidity accounts have the right account tag in order to be part
# of the Dutch financial reports.
account_vals.setdefault('tag_ids', [])
diff --git a/addons/l10n_se/models/res_company.py b/addons/l10n_se/models/res_company.py
index af2ca1872b8..1768f3cd8fe 100644
--- a/addons/l10n_se/models/res_company.py
+++ b/addons/l10n_se/models/res_company.py
@@ -13,7 +13,7 @@ class ResCompany(models.Model):
@api.depends('vat')
def _compute_org_number(self):
for company in self:
- if company.country_id.code == "SE" and company.vat:
+ if company.account_fiscal_country_id.code == "SE" and company.vat:
org_number = re.sub(r'\D', '', company.vat)[:-2]
org_number = org_number[:6] + '-' + org_number[6:]
diff --git a/addons/purchase/report/purchase_order_templates.xml b/addons/purchase/report/purchase_order_templates.xml
index c815e2de9b4..3cf7f5167f4 100644
--- a/addons/purchase/report/purchase_order_templates.xml
+++ b/addons/purchase/report/purchase_order_templates.xml
@@ -6,7 +6,7 @@
- :
+ :
diff --git a/addons/purchase/report/purchase_quotation_templates.xml b/addons/purchase/report/purchase_quotation_templates.xml
index 958de3e159c..9a8bb4a5424 100644
--- a/addons/purchase/report/purchase_quotation_templates.xml
+++ b/addons/purchase/report/purchase_quotation_templates.xml
@@ -6,7 +6,7 @@
- :
+ :
diff --git a/addons/sale/report/sale_report_templates.xml b/addons/sale/report/sale_report_templates.xml
index 861c257bdd7..f9bba65dac8 100644
--- a/addons/sale/report/sale_report_templates.xml
+++ b/addons/sale/report/sale_report_templates.xml
@@ -6,7 +6,7 @@
- :
+ :
| |