[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>
This commit is contained in:
@@ -249,7 +249,7 @@ class AccountBankStatement(models.Model):
|
||||
is_valid_balance_start = fields.Boolean(string="Is Valid Balance Start", store=True,
|
||||
compute="_compute_is_valid_balance_start",
|
||||
help="Technical field to display a warning message in case starting balance is different than previous ending balance")
|
||||
country_code = fields.Char(related='company_id.country_id.code')
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code')
|
||||
|
||||
def write(self, values):
|
||||
res = super(AccountBankStatement, self).write(values)
|
||||
@@ -549,7 +549,7 @@ class AccountBankStatementLine(models.Model):
|
||||
compute='_compute_is_reconciled',
|
||||
help="Technical field indicating if the statement line is already reconciled.")
|
||||
state = fields.Selection(related='statement_id.state', string='Status', readonly=True)
|
||||
country_code = fields.Char(related='company_id.country_id.code')
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code')
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# HELPERS
|
||||
|
||||
@@ -118,7 +118,7 @@ class AccountJournal(models.Model):
|
||||
currency_id = fields.Many2one('res.currency', help='The currency used to enter statement', string="Currency")
|
||||
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, index=True, default=lambda self: self.env.company,
|
||||
help="Company related to this journal")
|
||||
country_code = fields.Char(related='company_id.country_id.code', readonly=True)
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code', readonly=True)
|
||||
|
||||
refund_sequence = fields.Boolean(string='Dedicated Credit Note Sequence', help="Check this box if you don't want to share the same sequence for invoices and credit notes made from this journal", default=False)
|
||||
sequence_override_regex = fields.Text(help="Technical field used to enforce complex sequence composition that the system would normally misunderstand.\n"\
|
||||
|
||||
@@ -184,7 +184,7 @@ class AccountMove(models.Model):
|
||||
string='Partner', change_default=True)
|
||||
commercial_partner_id = fields.Many2one('res.partner', string='Commercial Entity', store=True, readonly=True,
|
||||
compute='_compute_commercial_partner_id')
|
||||
country_code = fields.Char(related='company_id.country_id.code', readonly=True)
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code', readonly=True)
|
||||
user_id = fields.Many2one(string='User', related='invoice_user_id',
|
||||
help='Technical field used to fit the generic behavior in mail templates.')
|
||||
is_move_sent = fields.Boolean(
|
||||
|
||||
@@ -129,7 +129,7 @@ class AccountPayment(models.Model):
|
||||
require_partner_bank_account = fields.Boolean(
|
||||
compute='_compute_show_require_partner_bank',
|
||||
help="Technical field used to know whether the field `partner_bank_id` needs to be required or not in the payments form views")
|
||||
country_code = fields.Char(related='company_id.country_id.code')
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code')
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
|
||||
@@ -61,7 +61,7 @@ class AccountFiscalPosition(models.Model):
|
||||
raise ValidationError(_("You cannot create a fiscal position within your fiscal country with the same VAT number as the main one set on your company."))
|
||||
|
||||
if not record.state_ids:
|
||||
if record.company_id.country_id.state_ids:
|
||||
if record.company_id.account_fiscal_country_id.state_ids:
|
||||
raise ValidationError(_("You cannot create a fiscal position with a foreign VAT within your fiscal country without assigning it a state."))
|
||||
else:
|
||||
raise ValidationError(_("You cannot create a fiscal position with a foreign VAT within your fiscal country."))
|
||||
|
||||
@@ -134,7 +134,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
config_parameter='account.use_invoice_terms')
|
||||
|
||||
# Technical field to hide country specific fields from accounting configuration
|
||||
country_code = fields.Char(related='company_id.country_id.code', readonly=True)
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code', readonly=True)
|
||||
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<t t-set="address">
|
||||
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
|
||||
<div t-if="o.partner_id.vat" class="mt16">
|
||||
<t t-if="o.company_id.country_id.vat_label" t-esc="o.company_id.country_id.vat_label" id="inv_tax_id_label"/>
|
||||
<t t-if="o.company_id.account_fiscal_country_id.vat_label" t-esc="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
|
||||
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/></div>
|
||||
</t>
|
||||
<div class="page">
|
||||
|
||||
@@ -103,7 +103,7 @@ class AccountPaymentRegister(models.TransientModel):
|
||||
require_partner_bank_account = fields.Boolean(
|
||||
compute='_compute_show_require_partner_bank',
|
||||
help="Technical field used to know whether the field `partner_bank_id` needs to be required or not in the payments form views")
|
||||
country_code = fields.Char(related='company_id.country_id.code', readonly=True)
|
||||
country_code = fields.Char(related='company_id.account_fiscal_country_id.code', readonly=True)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# HELPERS
|
||||
@@ -353,12 +353,12 @@ class AccountPaymentRegister(models.TransientModel):
|
||||
# -------------------------------------------------------------------------
|
||||
# LOW-LEVEL METHODS
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
# OVERRIDE
|
||||
res = super().default_get(fields_list)
|
||||
|
||||
|
||||
if 'line_ids' in fields_list and 'line_ids' not in res:
|
||||
|
||||
# Retrieve moves to pay from the context.
|
||||
@@ -397,7 +397,7 @@ class AccountPaymentRegister(models.TransientModel):
|
||||
raise UserError(_("You can't register payments for journal items being either all inbound, either all outbound."))
|
||||
|
||||
res['line_ids'] = [(6, 0, available_lines.ids)]
|
||||
|
||||
|
||||
return res
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
@@ -37,7 +37,7 @@ class AccountJournal(models.Model):
|
||||
else:
|
||||
return super().write(vals)
|
||||
|
||||
@api.depends('type', 'company_id', 'company_id.country_id')
|
||||
@api.depends('type', 'company_id', 'company_id.account_fiscal_country_id')
|
||||
def _compute_compatible_edi_ids(self):
|
||||
edi_formats = self.env['account.edi.format'].search([])
|
||||
|
||||
@@ -45,7 +45,7 @@ class AccountJournal(models.Model):
|
||||
compatible_edis = edi_formats.filtered(lambda e: e._is_compatible_with_journal(journal))
|
||||
journal.compatible_edi_ids += compatible_edis
|
||||
|
||||
@api.depends('type', 'company_id', 'company_id.country_id')
|
||||
@api.depends('type', 'company_id', 'company_id.account_fiscal_country_id')
|
||||
def _compute_edi_format_ids(self):
|
||||
edi_formats = self.env['account.edi.format'].search([])
|
||||
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
<odoo>
|
||||
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//p[@name='payment_term']" position="after">
|
||||
<p t-if="o.company_id.country_id.code == 'AE' and o.partner_id.country_id.code != 'AE' and o.env.ref('l10n_ae.gcc_countries_group') in o.partner_id.country_id.country_group_ids">
|
||||
<p t-if="o.company_id.account_fiscal_country_id.code == 'AE' and o.partner_id.country_id.code != 'AE' and o.env.ref('l10n_ae.gcc_countries_group') in o.partner_id.country_id.country_group_ids">
|
||||
Supply between <b>United Arad Emirates</b> and <b><span t-field="o.partner_id.country_id.name"/></b>
|
||||
</p>
|
||||
</xpath>
|
||||
<xpath expr="//h2/span" position="before">
|
||||
<span t-if="o.company_id.country_id.code == 'AE' and o.move_type in ['out_invoice', 'out_refund']">Tax</span>
|
||||
<span t-if="o.company_id.account_fiscal_country_id.code == 'AE' and o.move_type in ['out_invoice', 'out_refund']">Tax</span>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[hasclass('clearfix')]" position="after">
|
||||
<div t-if="o.company_id.country_id.code == 'AE' and o.currency_id != o.company_id.currency_id" id="aed_amounts" class="row clearfix ml-auto my-3 text-nowrap table">
|
||||
<div t-if="o.company_id.account_fiscal_country_id.code == 'AE' and o.currency_id != o.company_id.currency_id" id="aed_amounts" class="row clearfix ml-auto my-3 text-nowrap table">
|
||||
<t t-set="aed_rate" t-value="o.env['res.currency']._get_conversion_rate(o.currency_id, o.company_id.currency_id, o.company_id, o.invoice_date or datetime.date.today())"/>
|
||||
<div name="exchange_rate" class="col-auto">
|
||||
<strong>Exchange Rate</strong>
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
<!-- (17) CUIT -->
|
||||
<t t-if="o.partner_id.vat and o.partner_id.l10n_latam_identification_type_id and o.partner_id.l10n_latam_identification_type_id.l10n_ar_afip_code != '99'">
|
||||
<br/><strong><t t-esc="o.partner_id.l10n_latam_identification_type_id.name or o.company_id.country_id.vat_label" id="inv_tax_id_label"/>:</strong> <span t-esc="o.partner_id.l10n_ar_formatted_vat if o.partner_id.l10n_latam_identification_type_id.is_vat else o.partner_id.vat"/>
|
||||
<br/><strong><t t-esc="o.partner_id.l10n_latam_identification_type_id.name or o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>:</strong> <span t-esc="o.partner_id.l10n_ar_formatted_vat if o.partner_id.l10n_latam_identification_type_id.is_vat else o.partner_id.vat"/>
|
||||
</t>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<odoo>
|
||||
<template id="l10n_ca_report_invoice_document_inherit" inherit_id="account.report_invoice_document">
|
||||
<div t-if="o.partner_id.vat" position="after">
|
||||
<t t-if="o.company_id.country_id.code == 'CA' and o.partner_id.l10n_ca_pst" class="mt16">
|
||||
<t t-if="o.company_id.account_fiscal_country_id.code == 'CA' and o.partner_id.l10n_ca_pst" class="mt16">
|
||||
<div>PST: <span t-field="o.partner_id.l10n_ca_pst"/></div>
|
||||
</t>
|
||||
</div>
|
||||
|
||||
@@ -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 + '%'),
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
<t t-if="o.partner_id.vat and o.partner_id.l10n_latam_identification_type_id">
|
||||
<strong>
|
||||
<t t-esc="o.partner_id.l10n_latam_identification_type_id.name or o.company_id.country_id.vat_label" id="inv_tax_id_label"/>:
|
||||
<t t-esc="o.partner_id.l10n_latam_identification_type_id.name or o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>:
|
||||
</strong>
|
||||
<span t-esc="o.partner_id.vat"/>
|
||||
<br/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<li t-if="company.phone"><i class="fa fa-phone"/> <span t-field="company.phone"/></li>
|
||||
<li t-if="company.email"><i class="fa fa-at"/> <span t-field="company.email"/></li>
|
||||
<li t-if="company.website"><i class="fa fa-globe"/> <span t-field="company.website"/></li>
|
||||
<li t-if="company.vat"><i class="fa fa-building-o"/><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
|
||||
<li t-if="company.vat"><i class="fa fa-building-o"/><t t-esc="company.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
|
||||
</ul>
|
||||
<div t-field="company.report_footer"/>
|
||||
</div>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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', [])
|
||||
|
||||
@@ -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'},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='ref']" position="after">
|
||||
<field name="l10n_in_company_country_code" invisible="1"/>
|
||||
<field name="country_code" invisible="1"/>
|
||||
<field name="l10n_in_gst_treatment"
|
||||
attrs="{'invisible': ['|', ('l10n_in_company_country_code', '!=', 'IN'), ('move_type', '=', 'entry')], 'required': [('l10n_in_company_country_code', '=', 'IN'), ('move_type', '!=', 'entry')]}"/>
|
||||
attrs="{'invisible': ['|', ('country_code', '!=', 'IN'), ('move_type', '=', 'entry')], 'required': [('country_code', '=', 'IN'), ('move_type', '!=', 'entry')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@id='other_tab']/group[@id='other_tab_group']" position="after">
|
||||
<group string="Export India" attrs="{'invisible': ['|', ('l10n_in_gst_treatment', 'not in', ['overseas', 'deemed_export']), ('move_type', 'not in', ['out_invoice', 'out_refund'])]}">
|
||||
@@ -25,7 +25,7 @@
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="l10n_in_reseller_partner_id"
|
||||
groups="l10n_in.group_l10n_in_reseller"
|
||||
attrs="{'invisible': ['|', '|',('move_type', 'not in', ('out_invoice', 'out_refund')), ('l10n_in_company_country_code', '!=', 'IN'), ('move_type', '=', 'entry')]}"
|
||||
attrs="{'invisible': ['|', '|',('move_type', 'not in', ('out_invoice', 'out_refund')), ('country_code', '!=', 'IN'), ('move_type', '=', 'entry')]}"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<template id="l10n_in_report_invoice_document_inherit" inherit_id="account.report_invoice_document">
|
||||
|
||||
<xpath expr="//span[@t-field='o.partner_id.vat']" position="attributes">
|
||||
<attribute name="t-if">o.company_id.country_id.code != 'IN'</attribute>
|
||||
<attribute name="t-if">o.company_id.account_fiscal_country_id.code != 'IN'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//span[@t-field='o.partner_id.vat']" position="after">
|
||||
<span t-field="o.l10n_in_gstin" t-if="o.company_id.country_id.code == 'IN'"/>
|
||||
<span t-field="o.l10n_in_gstin" t-if="o.company_id.account_fiscal_country_id.code == 'IN'"/>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-set='address']" position="inside">
|
||||
<t t-if="o.company_id.country_id.code == 'IN' and o.l10n_in_state_id" class="mt16">
|
||||
<t t-if="o.company_id.account_fiscal_country_id.code == 'IN' and o.l10n_in_state_id" class="mt16">
|
||||
<t t-if="o.move_type in ('in_invoice', 'in_refund')">
|
||||
Destination of supply: <span t-esc="o.l10n_in_state_id.name"/>
|
||||
</t>
|
||||
@@ -19,7 +19,7 @@
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//p[@t-if='o.narration']" position="before">
|
||||
<t t-if="o.company_id.country_id.code == 'IN'">
|
||||
<t t-if="o.company_id.account_fiscal_country_id.code == 'IN'">
|
||||
<p id="total_in_words" class="mb16">
|
||||
<strong>Total (In Words): </strong>
|
||||
<span t-field="o.amount_total_words"/>
|
||||
@@ -28,13 +28,13 @@
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//table[@name='invoice_line_table']/thead/tr/th[1]" position="after">
|
||||
<t t-if="o.company_id.country_id.code == 'IN'">
|
||||
<t t-if="o.company_id.account_fiscal_country_id.code == 'IN'">
|
||||
<th>HSN/SAC</th>
|
||||
</t>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//t[@name='account_invoice_line_accountable']/td[1]" position="after">
|
||||
<td t-if="o.company_id.country_id.code == 'IN'">
|
||||
<td t-if="o.company_id.account_fiscal_country_id.code == 'IN'">
|
||||
<span t-if="line.product_id.l10n_in_hsn_code" t-field="line.product_id.l10n_in_hsn_code"></span>
|
||||
</td>
|
||||
</xpath>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<xpath expr="//t[@t-foreach='o.order_line']//td[@id='product']" position="replace">
|
||||
<td>
|
||||
<span t-field="line.name"/>
|
||||
<t t-if="line.product_id.l10n_in_hsn_code and o.company_id.country_id.code == 'IN'">
|
||||
<t t-if="line.product_id.l10n_in_hsn_code and o.company_id.account_fiscal_country_id.code == 'IN'">
|
||||
<h6>
|
||||
<strong class="ml16">HSN/SAC Code:</strong>
|
||||
<span t-field="line.product_id.l10n_in_hsn_code"/>
|
||||
@@ -19,7 +19,7 @@
|
||||
<xpath expr="//t[@t-foreach='o.order_line']//td[@id='product']" position="replace">
|
||||
<td>
|
||||
<span t-field="order_line.name"/>
|
||||
<t t-if="order_line.product_id.l10n_in_hsn_code and o.company_id.country_id.code == 'IN'">
|
||||
<t t-if="order_line.product_id.l10n_in_hsn_code and o.company_id.account_fiscal_country_id.code == 'IN'">
|
||||
<h6>
|
||||
<strong class="ml16">HSN/SAC Code:</strong>
|
||||
<span t-field="order_line.product_id.l10n_in_hsn_code"/>
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<template id="gst_report_picking_inherit" inherit_id="stock.report_picking">
|
||||
<xpath expr="//span[@t-field='ml.product_id.description_picking']" position="after">
|
||||
<t t-if="ml.product_id and ml.product_id.l10n_in_hsn_code and o.company_id.country_id.code == 'IN'"><h6><strong class="ml16">HSN/SAC Code:</strong> <span t-field="ml.product_id.l10n_in_hsn_code"/></h6></t>
|
||||
<t t-if="ml.product_id and ml.product_id.l10n_in_hsn_code and o.company_id.account_fiscal_country_id.code == 'IN'"><h6><strong class="ml16">HSN/SAC Code:</strong> <span t-field="ml.product_id.l10n_in_hsn_code"/></h6></t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<span><strong>Customer Address:</strong></span>
|
||||
<div t-field="o.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'Pta IVA'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.account_fiscal_country_id.vat_label or 'Pta IVA'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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', [])
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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', [])
|
||||
|
||||
@@ -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:]
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<t t-set="address">
|
||||
<div t-field="o.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
</t>
|
||||
<t t-if="o.dest_address_id">
|
||||
<t t-set="information_block">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<t t-set="address">
|
||||
<div t-field="o.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></p>
|
||||
</t>
|
||||
<t t-if="o.dest_address_id">
|
||||
<t t-set="information_block">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<t t-set="address">
|
||||
<div t-field="doc.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
|
||||
<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="doc.partner_id.vat"/></p>
|
||||
<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="doc.partner_id.vat"/></p>
|
||||
</t>
|
||||
<t t-if="doc.partner_shipping_id == doc.partner_invoice_id
|
||||
and doc.partner_invoice_id != doc.partner_id
|
||||
|
||||
Reference in New Issue
Block a user