Skip to content

Commit

Permalink
Merge branch 'OCA:16.0' into fix/narration-original-invoice-date
Browse files Browse the repository at this point in the history
  • Loading branch information
rlucia authored Jun 4, 2024
2 parents 1c51dae + 5995d0f commit d02725d
Show file tree
Hide file tree
Showing 182 changed files with 6,109 additions and 364 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ exclude: |
(l10n_it_account/tools/xsd)|
# external stylesheets
(l10n_it_fatturapa/data/Foglio_di_stile_fatturaordinaria_v1.2.2.xsl)|
(l10n_it_fatturapa/data/fatturasemplificata_v1.0.xsl)|
(l10n_it_fatturapa/data/FoglioStileAssoSoftware.xsl)|
(l10n_it_fatturapa/data/FoglioStileSouthTyrol-bilingue.xsl)|
# XML tests should not be reformatted
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ addon | version | maintainers | summary
[account_vat_period_end_statement](account_vat_period_end_statement/) | 16.0.1.2.2 | | Allow to create the 'VAT Statement'.
[currency_rate_update_boi](currency_rate_update_boi/) | 16.0.1.0.1 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Update exchange rates using www.bancaditalia.it
[l10n_it_abicab](l10n_it_abicab/) | 16.0.1.0.1 | [![Borruso](https://github.com/Borruso.png?size=30px)](https://github.com/Borruso) | Base Bank ABI/CAB codes
[l10n_it_account](l10n_it_account/) | 16.0.1.0.3 | | Modulo base usato come dipendenza di altri moduli contabili
[l10n_it_account](l10n_it_account/) | 16.0.1.1.0 | | Modulo base usato come dipendenza di altri moduli contabili
[l10n_it_account_stamp](l10n_it_account_stamp/) | 16.0.1.0.4 | | Gestione automatica dell'imposta di bollo
[l10n_it_account_tax_kind](l10n_it_account_tax_kind/) | 16.0.1.0.1 | | Gestione natura delle aliquote IVA
[l10n_it_appointment_code](l10n_it_appointment_code/) | 16.0.1.0.0 | | Aggiunge la tabella dei codici carica da usare nelle dichiarazioni fiscali italiane
[l10n_it_asset_management](l10n_it_asset_management/) | 16.0.1.0.0 | | Gestione Cespiti
[l10n_it_ateco](l10n_it_ateco/) | 16.0.1.1.1 | | ITA - Codici Ateco
[l10n_it_bill_of_entry](l10n_it_bill_of_entry/) | 16.0.1.0.0 | | ITA - Bolle doganali
[l10n_it_central_journal_reportlab](l10n_it_central_journal_reportlab/) | 16.0.1.0.3 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![Borruso](https://github.com/Borruso.png?size=30px)](https://github.com/Borruso) | ITA - Libro giornale - Reportlab
[l10n_it_declaration_of_intent](l10n_it_declaration_of_intent/) | 16.0.1.0.6 | | Gestione dichiarazioni di intento
[l10n_it_delivery_note](l10n_it_delivery_note/) | 16.0.1.4.1 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) | Crea, gestisce e fattura i DDT partendo dalle consegne
[l10n_it_central_journal_reportlab](l10n_it_central_journal_reportlab/) | 16.0.1.0.4 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![Borruso](https://github.com/Borruso.png?size=30px)](https://github.com/Borruso) | ITA - Libro giornale - Reportlab
[l10n_it_declaration_of_intent](l10n_it_declaration_of_intent/) | 16.0.1.0.7 | | Gestione dichiarazioni di intento
[l10n_it_delivery_note](l10n_it_delivery_note/) | 16.0.1.4.3 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) | Crea, gestisce e fattura i DDT partendo dalle consegne
[l10n_it_delivery_note_base](l10n_it_delivery_note_base/) | 16.0.1.0.2 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![Borruso](https://github.com/Borruso.png?size=30px)](https://github.com/Borruso) | Crea e gestisce tabelle principali per gestire i DDT
[l10n_it_delivery_note_batch](l10n_it_delivery_note_batch/) | 16.0.1.1.0 | [![MarcoCalcagni](https://github.com/MarcoCalcagni.png?size=30px)](https://github.com/MarcoCalcagni) [![TheMule71](https://github.com/TheMule71.png?size=30px)](https://github.com/TheMule71) [![Borruso](https://github.com/Borruso.png?size=30px)](https://github.com/Borruso) [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) | Crea i DDT partendo da gruppi di prelievi
[l10n_it_delivery_note_order_link](l10n_it_delivery_note_order_link/) | 16.0.1.0.0 | [![andreampiovesana](https://github.com/andreampiovesana.png?size=30px)](https://github.com/andreampiovesana) | Crea collegamento tra i DDT e ordine di vendita/acquisto
[l10n_it_fatturapa](l10n_it_fatturapa/) | 16.0.1.0.6 | | Fatture elettroniche
[l10n_it_fatturapa](l10n_it_fatturapa/) | 16.0.1.1.0 | | Fatture elettroniche
[l10n_it_fatturapa_export_zip](l10n_it_fatturapa_export_zip/) | 16.0.1.0.0 | [![sergiocorato](https://github.com/sergiocorato.png?size=30px)](https://github.com/sergiocorato) | Permette di esportare in uno ZIP diversi file XML di fatture elettroniche
[l10n_it_fatturapa_import_zip](l10n_it_fatturapa_import_zip/) | 16.0.1.0.3 | | Permette di importare in uno ZIP diversi file XML di fatture elettroniche
[l10n_it_fatturapa_in](l10n_it_fatturapa_in/) | 16.0.1.0.7 | | Ricezione fatture elettroniche
[l10n_it_fatturapa_in](l10n_it_fatturapa_in/) | 16.0.1.1.0 | | Ricezione fatture elettroniche
[l10n_it_fatturapa_in_purchase](l10n_it_fatturapa_in_purchase/) | 16.0.1.0.0 | | Modulo ponte tra ricezione fatture elettroniche e acquisti
[l10n_it_fatturapa_in_rc](l10n_it_fatturapa_in_rc/) | 16.0.1.0.0 | [![sergiocorato](https://github.com/sergiocorato.png?size=30px)](https://github.com/sergiocorato) | Modulo ponte tra e-fattura in acquisto e inversione contabile
[l10n_it_fatturapa_out](l10n_it_fatturapa_out/) | 16.0.1.0.20 | | Emissione fatture elettroniche
[l10n_it_fatturapa_out](l10n_it_fatturapa_out/) | 16.0.1.1.0 | | Emissione fatture elettroniche
[l10n_it_fatturapa_out_di](l10n_it_fatturapa_out_di/) | 16.0.1.0.0 | | Dichiarazioni d'intento in fatturapa
[l10n_it_fatturapa_out_oss](l10n_it_fatturapa_out_oss/) | 16.0.1.0.2 | | OSS in fatturapa
[l10n_it_fatturapa_out_rc](l10n_it_fatturapa_out_rc/) | 16.0.1.0.1 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Integrazione l10n_it_fatturapa_out e l10n_it_reverse_charge
Expand All @@ -65,20 +65,23 @@ addon | version | maintainers | summary
[l10n_it_pos_fiscalcode](l10n_it_pos_fiscalcode/) | 16.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Gestione codice fiscale del cliente all'interno dell'interfaccia del POS
[l10n_it_rea](l10n_it_rea/) | 16.0.1.0.0 | | Gestisce i campi del Repertorio Economico Amministrativo
[l10n_it_reverse_charge](l10n_it_reverse_charge/) | 16.0.1.0.3 | | Inversione contabile
[l10n_it_riba](l10n_it_riba/) | 16.0.1.2.1 | | Ricevute bancarie
[l10n_it_riba](l10n_it_riba/) | 16.0.1.2.3 | | Ricevute bancarie
[l10n_it_sdi_channel](l10n_it_sdi_channel/) | 16.0.1.0.0 | [![sergiocorato](https://github.com/sergiocorato.png?size=30px)](https://github.com/sergiocorato) | Aggiunge il canale di invio/ricezione dei file XML attraverso lo SdI
[l10n_it_split_payment](l10n_it_split_payment/) | 16.0.1.0.0 | | Scissione pagamenti
[l10n_it_vat_payability](l10n_it_vat_payability/) | 16.0.1.0.0 | | ITA - Esigibilità IVA
[l10n_it_vat_registries](l10n_it_vat_registries/) | 16.0.1.2.1 | | ITA - Registri IVA
[l10n_it_vat_registries_rc](l10n_it_vat_registries_rc/) | 16.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Integrazione l10n_it_vat_registries e l10n_it_reverse_charge
[l10n_it_vat_registries_split_payment](l10n_it_vat_registries_split_payment/) | 16.0.1.0.0 | | Modulo di congiunzione tra registri IVA e scissione dei pagamenti
[l10n_it_vat_settlement_date](l10n_it_vat_settlement_date/) | 16.0.1.0.0 | | Settlement date for VAT Statement
[l10n_it_vat_settlement_date_rc](l10n_it_vat_settlement_date_rc/) | 16.0.1.0.0 | | Use VAT Settlement Date in reverse charge.
[l10n_it_vat_statement_communication](l10n_it_vat_statement_communication/) | 16.0.1.0.0 | | Comunicazione liquidazione IVA ed esportazione file xmlconforme alle specifiche dell'Agenzia delle Entrate
[l10n_it_vat_statement_split_payment](l10n_it_vat_statement_split_payment/) | 16.0.1.0.0 | | Migliora la liquidazione dell'IVA tenendo in considerazione la scissione dei pagamenti
[l10n_it_website_portal_fatturapa](l10n_it_website_portal_fatturapa/) | 16.0.1.0.0 | | Add fatturapa fields and checks in frontend user's details
[l10n_it_website_portal_fiscalcode](l10n_it_website_portal_fiscalcode/) | 16.0.1.0.0 | | Add fiscal code to details of frontend user
[l10n_it_website_portal_ipa](l10n_it_website_portal_ipa/) | 16.0.1.0.1 | | Aggiunge l'indice PA (IPA) tra i dettagli dell'utente nel portale.
[l10n_it_website_sale_fiscalcode](l10n_it_website_sale_fiscalcode/) | 16.0.1.0.0 | | Website Sale FiscalCode
[l10n_it_withholding_tax](l10n_it_withholding_tax/) | 16.0.1.1.3 | | ITA - Ritenute d'acconto
[l10n_it_withholding_tax_payment](l10n_it_withholding_tax_payment/) | 16.0.1.0.3 | | Gestisce le ritenute sulle fatture e sui pagamenti
[l10n_it_withholding_tax_payment](l10n_it_withholding_tax_payment/) | 16.0.1.1.0 | | Gestisce le ritenute sulle fatture e sui pagamenti
[l10n_it_withholding_tax_reason](l10n_it_withholding_tax_reason/) | 16.0.1.0.0 | | ITA - Causali pagamento per ritenute d'acconto

[//]: # (end addons)
Expand Down
186 changes: 186 additions & 0 deletions account_vat_period_end_statement/tests/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Copyright 2015 Agile Business Group <http://www.agilebg.com>
# Copyright 2022 Simone Rubino - TAKOBI
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from datetime import date, datetime

from dateutil.rrule import MONTHLY

from odoo.tests import tagged
from odoo.tests.common import Form

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install", "-at_install")
class TestVATStatementCommon(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)

cls.range_type = cls.env["date.range.type"].create(
{"name": "Fiscal year", "company_id": False, "allow_overlap": False}
)
generator = cls.env["date.range.generator"]
current_datetime = datetime(2020, month=6, day=15)
generator = generator.create(
{
"date_start": "%s-01-01" % current_datetime.year,
"name_prefix": "%s-" % current_datetime.year,
"type_id": cls.range_type.id,
"duration_count": 1,
"unit_of_time": str(MONTHLY),
"count": 12,
}
)
generator.action_apply()
prev_year_generator = generator.create(
{
"date_start": "%s-01-01" % (current_datetime.year - 1),
"name_prefix": "%s-" % (current_datetime.year - 1),
"type_id": cls.range_type.id,
"duration_count": 1,
"unit_of_time": str(MONTHLY),
"count": 12,
}
)
prev_year_generator.action_apply()
cls.tax_model = cls.env["account.tax"]
cls.account_model = cls.env["account.account"]
cls.term_model = cls.env["account.payment.term"]
cls.term_line_model = cls.env["account.payment.term.line"]
cls.invoice_model = cls.env["account.move"]
cls.invoice_line_model = cls.env["account.move.line"]
current_date = current_datetime.date()
cls.current_period = cls.env["date.range"].search(
[("date_start", "<=", current_date), ("date_end", ">=", current_date)]
)
cls.last_year_date = date(
current_date.year - 1, current_date.month, current_date.day
)
cls.last_year_period = cls.env["date.range"].search(
[
("date_start", "<=", cls.last_year_date),
("date_end", ">=", cls.last_year_date),
]
)
cls.vat_statement_model = cls.env["account.vat.period.end.statement"]
cls.paid_vat_account = (
cls.env["account.account"]
.search(
[("account_type", "=", "asset_current")],
limit=1,
)
.id
)
cls.received_vat_account = (
cls.env["account.account"]
.search(
[("account_type", "=", "liability_current")],
limit=1,
)
.id
)

# ----- Set invoice date to recent date in the system
# ----- This solves problems with account_invoice_sequential_dates
cls.recent_date = (
cls.invoice_model.search(
[("invoice_date", "!=", False)], order="invoice_date desc", limit=1
).invoice_date
or current_date
)
cls.last_year_recent_date = date(
cls.recent_date.year - 1, cls.recent_date.month, cls.recent_date.day
)
cls.account_tax_22 = cls.company_data["default_tax_sale"].copy(
{
"name": "22%",
"amount": 22,
"amount_type": "percent",
"vat_statement_account_id": cls.received_vat_account,
"type_tax_use": "sale",
}
)
cls.account_tax_22_credit = cls.company_data["default_tax_purchase"].copy(
{
"name": "22% credit",
"amount": 22,
"amount_type": "percent",
"vat_statement_account_id": cls.paid_vat_account,
"type_tax_use": "purchase",
}
)

cls.vat_authority = cls.account_model.create(
{
"code": "VAT.AUTH",
"name": "VAT Authority",
"reconcile": True,
"account_type": "liability_payable",
}
)

cls.account_payment_term = cls.term_model.create(
{
"name": "16 Days End of Month",
"note": "16 Days End of Month",
}
)
cls.term_line_model.create(
{
"value": "balance",
"days": 16,
"payment_id": cls.account_payment_term.id,
}
)
cls.sale_journal = cls.company_data["default_journal_sale"]
cls.purchase_journal = cls.company_data["default_journal_purchase"]
cls.general_journal = cls.company_data["default_journal_misc"]

def _create_vendor_bill(self, partner, invoice_date, price_unit, tax):
"""
Create an open Vendor Bill for `partner` having date `invoice_date`.
The Bill will also have a Line having Price `price_unit` and Tax `tax`.
"""
bill_model = self.invoice_model.with_context(default_move_type="in_invoice")
bill_form = Form(bill_model)
bill_form.partner_id = partner
bill_form.invoice_date = invoice_date
with bill_form.invoice_line_ids.new() as line:
line.tax_ids.clear()
line.tax_ids.add(tax)
line.name = "Test Invoice Line"
line.account_id = self.company_data["default_account_expense"]
line.price_unit = price_unit
bill = bill_form.save()
bill.action_post()
return bill

def _get_statement(self, period, statement_date, accounts):
"""
Create a VAT Statement in date `statement_date`
for Period `period` and Accounts `accounts`.
"""
# Create statement
statement_form = Form(self.vat_statement_model)
statement_form.journal_id = self.general_journal
statement_form.authority_vat_account_id = self.vat_authority
statement_form.payment_term_id = self.account_payment_term
statement_form.date = statement_date
statement_form.account_ids.clear()
for account in accounts:
statement_form.account_ids.add(account)
statement = statement_form.save()

# Add period
add_period_model = self.env["add.period.to.vat.statement"]
add_period_model = add_period_model.with_context(
active_id=statement.id,
active_model=statement._name,
)
add_period_form = Form(add_period_model)
add_period_form.period_id = period
add_period = add_period_form.save()
add_period.add_period()
return statement
Loading

0 comments on commit d02725d

Please sign in to comment.