19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:28 +01:00
parent ff721d030e
commit 7721452493
1826 changed files with 124775 additions and 274114 deletions

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import template_it
from . import account_report
from . import account_chart_template
from . import account_tax
from . import account_move

View file

@ -1,19 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
def _load(self, company):
""" Set tax calculation rounding method required in Italian localization
Also to avoid rounding errors when sent with FatturaPA"""
res = super()._load(company)
if company.account_fiscal_country_id.code == 'IT':
company.write({'tax_calculation_rounding_method': 'round_globally'})
vat_split_payment_account = self.env['account.account'].search([('company_id', '=', company.id), ('code', 'like', '2607%')])
split_payment_tax_group = self.env.ref('l10n_it.tax_group_split_payment').with_company(company)
split_payment_tax_group.property_tax_receivable_account_id = vat_split_payment_account
split_payment_tax_group.property_tax_payable_account_id = vat_split_payment_account
return res

View file

@ -0,0 +1,12 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class AccountMove(models.Model):
_inherit = 'account.move'
def _message_set_main_attachment_id(self, attachments, force=False, filter_xml=True):
if self.message_main_attachment_id.mimetype == "application/pkcs7-mime":
force = True
super()._message_set_main_attachment_id(attachments, force, filter_xml)

View file

@ -8,8 +8,8 @@ class AccountReportExpression(models.AbstractModel):
_inherit = "account.report.expression"
def _get_carryover_target_expression(self, options):
if self.report_line_id.code == 'VP14b' and fields.Date.from_string(options['date']['date_to']).month == 12:
if self.report_line_id.code == 'VP14' and fields.Date.from_string(options['date']['date_to']).month == 12:
# For this line, if we are between two years, we want to carry over to vp9 instead of the line set in the XML file (vp8)
return self.env.ref('l10n_it.tax_report_line_vp9_applied_carryover')
return self.env.ref('l10n_it.tax_monthly_report_line_vp9_applied_carryover')
return super()._get_carryover_target_expression(options)

View file

@ -0,0 +1,75 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_compare, html2plaintext
class AccountTax(models.Model):
_inherit = "account.tax"
l10n_it_exempt_reason = fields.Selection(
selection=[
("N1", "[N1] Escluse ex art. 15"),
("N2.1", "[N2.1] Non soggette ad IVA ai sensi degli artt. Da 7 a 7-septies del DPR 633/72"),
("N2.2", "[N2.2] Non soggette - altri casi"),
("N3.1", "[N3.1] Non imponibili - esportazioni"),
("N3.2", "[N3.2] Non imponibili - cessioni intracomunitarie"),
("N3.3", "[N3.3] Non imponibili - cessioni verso San Marino"),
("N3.4", "[N3.4] Non imponibili - operazioni assimilate alle cessioni all'esportazione"),
("N3.5", "[N3.5] Non imponibili - a seguito di dichiarazioni d'intento"),
("N3.6", "[N3.6] Non imponibili - altre operazioni che non concorrono alla formazione del plafond"),
("N4", "[N4] Esenti"),
("N5", "[N5] Regime del margine / IVA non esposta in fattura"),
("N6.1", "[N6.1] Inversione contabile - cessione di rottami e altri materiali di recupero"),
("N6.2", "[N6.2] Inversione contabile - cessione di oro e argento puro"),
("N6.3", "[N6.3] Inversione contabile - subappalto nel settore edile"),
("N6.4", "[N6.4] Inversione contabile - cessione di fabbricati"),
("N6.5", "[N6.5] Inversione contabile - cessione di telefoni cellulari"),
("N6.6", "[N6.6] Inversione contabile - cessione di prodotti elettronici"),
("N6.7", "[N6.7] Inversione contabile - prestazioni comparto edile esettori connessi"),
("N6.8", "[N6.8] Inversione contabile - operazioni settore energetico"),
("N6.9", "[N6.9] Inversione contabile - altri casi"),
("N7", "[N7] IVA assolta in altro stato UE (prestazione di servizi di telecomunicazioni, tele-radiodiffusione ed elettronici ex art. 7-octies, comma 1 lett. a, b, art. 74-sexies DPR 633/72)"),
],
string="Exoneration",
help="Exoneration type",
)
@api.constrains('l10n_it_exempt_reason',
'invoice_legal_notes',
'amount',
'invoice_repartition_line_ids',
'refund_repartition_line_ids')
def _l10n_it_edi_check_exoneration_with_no_tax(self):
for tax in self:
if tax.country_id.code == 'IT':
if tax.amount_type == 'percent' and tax.amount == 0 and not (tax.l10n_it_exempt_reason and html2plaintext(tax.invoice_legal_notes)):
raise ValidationError(_("If the tax amount is 0%, you must enter the exoneration code and the related legal notes."))
if tax.l10n_it_exempt_reason == 'N6' and tax._l10n_it_is_split_payment():
raise UserError(_("Split Payment is not compatible with exoneration of kind 'N6'"))
def _l10n_it_filter_kind(self, kind):
if kind == 'vat':
return self.flatten_taxes_hierarchy().filtered(lambda tax:
float_compare(tax.amount, 0, precision_digits=2) >= 0
)
return self.env['account.tax']
def _l10n_it_is_split_payment(self):
""" Split payment means that the Public Administration buyer will pay VAT
to the tax agency instead of the vendor
"""
self.ensure_one()
tax_tags = self.get_tax_tags(is_refund=False, repartition_type='tax') | self.get_tax_tags(is_refund=False, repartition_type='base')
if not tax_tags:
return False
it_tax_report_ve38_lines = self.env['account.report.line'].search([
('report_id.country_id.code', '=', 'IT'),
('code', '=', 'VE38'),
])
if not it_tax_report_ve38_lines:
return False
ve38_lines_tags = it_tax_report_ve38_lines.expression_ids._get_matching_tags()
return bool(tax_tags & ve38_lines_tags)

View file

@ -0,0 +1,45 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.addons.account.models.chart_template import template
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'
@template('it')
def _get_it_template_data(self):
return {
'property_account_receivable_id': '1501',
'property_account_payable_id': '2501',
}
@template('it', 'res.company')
def _get_it_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.it',
'bank_account_code_prefix': '182',
'cash_account_code_prefix': '180',
'transfer_account_code_prefix': '183',
'account_default_pos_receivable_account_id': '1508',
'income_currency_exchange_account_id': '3220',
'expense_currency_exchange_account_id': '4920',
'account_journal_early_pay_discount_loss_account_id': '4111',
'account_journal_early_pay_discount_gain_account_id': '3111',
'account_sale_tax_id': '22v',
'account_purchase_tax_id': '22am',
'expense_account_id': '4101',
'income_account_id': '3101',
'account_stock_journal_id': 'inventory_valuation',
'account_stock_valuation_id': '1404',
},
}
@template('it', 'account.account')
def _get_it_account_account(self):
return {
'1404': {
'account_stock_expense_id': '4101',
'account_stock_variation_id': '4131',
},
}