Skip to content

Commit

Permalink
Merge branch '16.0' into 16.0-FIX_IVA_multicompany
Browse files Browse the repository at this point in the history
  • Loading branch information
matteoopenf authored Sep 9, 2024
2 parents 275ad87 + fb77e79 commit 8da3d24
Show file tree
Hide file tree
Showing 29 changed files with 788 additions and 27 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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.4 | | Inversione contabile
[l10n_it_riba](l10n_it_riba/) | 16.0.1.6.1 | | Ricevute bancarie
[l10n_it_riba](l10n_it_riba/) | 16.0.1.6.3 | | Ricevute bancarie
[l10n_it_sdi_channel](l10n_it_sdi_channel/) | 16.0.1.1.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
Expand All @@ -78,7 +78,7 @@ addon | version | maintainers | summary
[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_communication](l10n_it_vat_statement_communication/) | 16.0.1.0.1 | | 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
Expand All @@ -87,6 +87,7 @@ addon | version | maintainers | summary
[l10n_it_withholding_tax](l10n_it_withholding_tax/) | 16.0.1.1.6 | | ITA - Ritenute d'acconto
[l10n_it_withholding_tax_financial_report](l10n_it_withholding_tax_financial_report/) | 16.0.1.0.1 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Integrazione Ritenute d'acconto e Rendiconti contabili
[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_payment_order](l10n_it_withholding_tax_payment_order/) | 16.0.1.0.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Integrazione Ritenute d'acconto e Ordini di pagamento
[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
8 changes: 6 additions & 2 deletions account_vat_period_end_statement/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-09 12:56+0000\n"
"PO-Revision-Date: 2023-12-24 17:36+0000\n"
"PO-Revision-Date: 2024-09-04 10:06+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: \n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"X-Generator: Weblate 5.6.2\n"

#. module: account_vat_period_end_statement
#: model:ir.model.fields.selection,name:account_vat_period_end_statement.selection__account_vat_period_end_statement__advance_computation_method__4
Expand Down Expand Up @@ -556,6 +556,10 @@ msgid ""
"Operazioni UE: Servizi Si Intra, Servizi No Intra, Beni UE, Rev.Charge UE, "
"Cell. UE, Microproc. UE"
msgstr ""
"Reverse charge: comprende RevCharge, Op.SM, Op.Vat., Op.FUE, Beni UE in "
"Italia, Beni FUE in Italia, Cell., Microproc.\n"
"Operazioni UE: Servizi Si Intra, Servizi No Intra, Beni UE, Rev.Charge UE, "
"Cell. UE, Microproc. UE"

#. module: account_vat_period_end_statement
#: model_terms:ir.ui.view,arch_db:account_vat_period_end_statement.report_vatperiodendstatement_tax_code
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_riba/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ITA - Ricevute bancarie
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9a26ed3685884fe6e425886b681332843a629c11c5204d536ed32d33ae38a59a
!! source digest: sha256:74f718c92239a411abd4ce9f3e04f8a8e295353684af9a1010e14be51bd05f6e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_riba/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{
"name": "ITA - Ricevute bancarie",
"version": "16.0.1.6.1",
"version": "16.0.1.6.3",
"development_status": "Beta",
"author": "Odoo Community Association (OCA)",
"category": "Localization/Italy",
Expand Down
19 changes: 19 additions & 0 deletions l10n_it_riba/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ msgstr "Annulla"
msgid "Canceled"
msgstr "Annullato"

#. module: l10n_it_riba
#. odoo-python
#: code:addons/l10n_it_riba/models/account.py:0
#, python-format
msgid ""
"Cannot post invoices with C/O payments without bank. Please check the "
"following invoices:\n"
"\n"
"- \n"
"- "
msgstr ""

#. module: l10n_it_riba
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.wizard_riba_file_export
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.wizard_riba_payment_date
Expand Down Expand Up @@ -628,6 +640,13 @@ msgstr "Se selezionata, alcuni messaggi hanno un errore di consegna."
msgid "Immediate"
msgstr "Immediata"

#. module: l10n_it_riba
#. odoo-python
#: code:addons/l10n_it_riba/models/account.py:0
#, python-format
msgid "Invoice %(name)s for customer \"%(customer_name)s\", total %(amount)s"
msgstr ""

#. module: l10n_it_riba
#: model:ir.model.fields,field_description:l10n_it_riba.field_riba_slip_line__invoice_date
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.slip_qweb
Expand Down
18 changes: 18 additions & 0 deletions l10n_it_riba/i18n/l10n_it_riba.pot
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ msgstr ""
msgid "Canceled"
msgstr ""

#. module: l10n_it_riba
#. odoo-python
#: code:addons/l10n_it_riba/models/account.py:0
#, python-format
msgid ""
"Cannot post invoices with C/O payments without bank. Please check the following invoices:\n"
"\n"
"- \n"
"- "
msgstr ""

#. module: l10n_it_riba
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.wizard_riba_file_export
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.wizard_riba_payment_date
Expand Down Expand Up @@ -609,6 +620,13 @@ msgstr ""
msgid "Immediate"
msgstr ""

#. module: l10n_it_riba
#. odoo-python
#: code:addons/l10n_it_riba/models/account.py:0
#, python-format
msgid "Invoice %(name)s for customer \"%(customer_name)s\", total %(amount)s"
msgstr ""

#. module: l10n_it_riba
#: model:ir.model.fields,field_description:l10n_it_riba.field_riba_slip_line__invoice_date
#: model_terms:ir.ui.view,arch_db:l10n_it_riba.slip_qweb
Expand Down
26 changes: 26 additions & 0 deletions l10n_it_riba/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ def month_check(self, invoice_date_due, all_date_due):
return True
return False

def _post(self, soft=True):
inv_riba_no_bank = self.filtered(
lambda x: x.is_riba_payment
and x.move_type == "out_invoice"
and not x.riba_partner_bank_id
)
if inv_riba_no_bank:
inv_details = (
_(
'Invoice %(name)s for customer "%(customer_name)s", '
"total %(amount)s",
name=inv.display_name,
customer_name=inv.partner_id.display_name,
amount=inv.amount_total,
)
for inv in inv_riba_no_bank
)
raise UserError(
_(
"Cannot post invoices with C/O payments without bank. "
"Please check the following invoices:\n\n- "
+ "\n- ".join(inv_details)
)
)
return super()._post(soft=soft)

def action_post(self):
for invoice in self:
# ---- Add a line with collection fees for each due date only for first due
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_riba/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">ITA - Ricevute bancarie</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9a26ed3685884fe6e425886b681332843a629c11c5204d536ed32d33ae38a59a
!! source digest: sha256:74f718c92239a411abd4ce9f3e04f8a8e295353684af9a1010e14be51bd05f6e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_riba"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_riba"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
Expand Down
85 changes: 85 additions & 0 deletions l10n_it_riba/tests/test_riba.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os

from odoo.exceptions import UserError
from odoo.fields import first
from odoo.tests import Form
from odoo.tools import config, safe_eval

Expand Down Expand Up @@ -679,3 +680,87 @@ def test_riba_line_date_no_move(self):
riba_list.line_ids.mapped("invoice_date"),
[False] * 2,
)

def test_file_substitute_forbidden_chars(self):
"""Forbidden characters are substituted in generated file."""
# Arrange
company = self.env.company
payment_term = self.payment_term1
product = self.product1
partner = self.partner
partner.street = "Via di là"
company.due_cost_service_id = self.service_due_cost

invoice_form = Form(
self.env["account.move"].with_context(
default_move_type="out_invoice",
default_name="Test invoice",
)
)
invoice_form.partner_id = partner
invoice_form.invoice_payment_term_id = payment_term
invoice_form.riba_partner_bank_id = first(partner.bank_ids)
with invoice_form.invoice_line_ids.new() as line:
line.product_id = product
invoice = invoice_form.save()
invoice.action_post()

to_issue_action = self.env.ref("l10n_it_riba.action_riba_to_issue")
to_issue_records = self.env[to_issue_action.res_model].search(
safe_eval.safe_eval(to_issue_action.domain)
)
invoice_to_issue_records = to_issue_records & invoice.line_ids
self.assertTrue(invoice_to_issue_records)

issue_wizard_model = self.env["riba.issue"].with_context(
active_model=invoice_to_issue_records._name,
active_ids=invoice_to_issue_records.ids,
)
issue_wizard_form = Form(issue_wizard_model)
issue_wizard_form.configuration_id = self.riba_config_incasso
issue_wizard = issue_wizard_form.save()
issue_result = issue_wizard.create_list()
slip = self.env[issue_result["res_model"]].browse(issue_result["res_id"])

# Act
export_wizard = (
self.env["riba.file.export"].with_context(active_ids=slip.ids).create({})
)
export_wizard.act_getfile()

# Assert
file_content = base64.decodebytes(export_wizard.riba_txt).decode()
self.assertNotIn("Via di là", file_content)
self.assertIn("Via di la", file_content)

def test_riba_inv_no_bank(self):
"""
Test that a riba invoice without a bank defined
cannot be confirmed (e.g. via the list view)
"""
self.invoice.company_id.due_cost_service_id = self.service_due_cost.id
self.invoice.riba_partner_bank_id = False
with self.assertRaises(UserError) as err:
self.invoice.action_post()
err_msg = err.exception.args[0]
self.assertIn("Cannot post invoices", err_msg)
self.assertIn(self.invoice.partner_id.display_name, err_msg)
# We have to add back a taxed collection fee for each payment term line
# because they have been added during `action_post`
# and recorded in the exception message,
# but `assertRaises` rolls them back
collection_fees = self.invoice.invoice_payment_term_id.riba_payment_cost
collection_fees_tax = self.invoice.fiscal_position_id.map_tax(
self.service_due_cost.taxes_id
)
taxed_collection_fees = collection_fees_tax.compute_all(collection_fees)[
"total_included"
]
self.assertIn(
str(
self.invoice.amount_total
+ len(self.invoice.invoice_payment_term_id.line_ids)
* taxed_collection_fees
),
err_msg,
)
26 changes: 14 additions & 12 deletions l10n_it_riba/wizard/wizard_riba_file_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import datetime
import re

from unidecode import unidecode

from odoo import _, fields, models
from odoo.exceptions import UserError

Expand Down Expand Up @@ -303,7 +305,7 @@ def act_getfile(self):
issued_date = datetime.datetime.now().strftime("%d%m%y")
support_name = datetime.datetime.now().strftime("%d%m%y%H%M%S") + credit_sia
creditor_address = order_obj.config_id.company_id.partner_id
creditor_city = creditor_address.city or ""
creditor_city = unidecode(creditor_address.city or "")
if (
not order_obj.config_id.company_id.partner_id.vat
and not order_obj.config_id.company_id.partner_id.fiscalcode
Expand All @@ -322,10 +324,10 @@ def act_getfile(self):
issued_date,
support_name,
"E",
company_name,
creditor_address.street or "",
unidecode(company_name),
unidecode(creditor_address.street or ""),
creditor_address.zip or "" + " " + creditor_city,
order_obj.config_id.company_id.partner_id.ref or "",
unidecode(order_obj.config_id.company_id.partner_id.ref or ""),
(
order_obj.config_id.company_id.partner_id.vat
and order_obj.config_id.company_id.partner_id.vat[2:]
Expand All @@ -336,7 +338,7 @@ def act_getfile(self):
for line in order_obj.line_ids:
debit_bank = line.bank_id
debtor_address = line.partner_id
debtor_street = debtor_address.street or ""
debtor_street = unidecode(debtor_address.street or "")
debtor_zip = debtor_address.zip or ""
if debit_bank.bank_abi and debit_bank.bank_cab:
debit_abi = debit_bank.bank_abi
Expand All @@ -352,10 +354,10 @@ def act_getfile(self):
partner=line.partner_id.name,
)
)
debtor_city = (
debtor_city = unidecode(
debtor_address.city and debtor_address.city.ljust(23)[0:23] or ""
)
debtor_province = (
debtor_province = unidecode(
debtor_address.state_id and debtor_address.state_id.code or ""
)
if not line.due_date: # ??? VERIFICARE
Expand Down Expand Up @@ -386,12 +388,12 @@ def act_getfile(self):
debtor_province,
debit_abi,
debit_cab,
debit_bank.bank_name and debit_bank.bank_name[:50] or "",
line.partner_id.ref and line.partner_id.ref[:16] or "",
line.invoice_number[:40],
unidecode(debit_bank.bank_name and debit_bank.bank_name[:50] or ""),
unidecode(line.partner_id.ref and line.partner_id.ref[:16] or ""),
unidecode(line.invoice_number[:40]),
line.invoice_date,
"CIG: %s " % line.cig if line.cig else "",
"CUP: %s " % line.cup if line.cup else "",
unidecode("CIG: %s " % line.cig if line.cig else ""),
unidecode("CUP: %s " % line.cup if line.cup else ""),
]
array_riba.append(riba)

Expand Down
2 changes: 1 addition & 1 deletion l10n_it_vat_statement_communication/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ITA - Comunicazione liquidazione IVA
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:757141ef866cf709a122fe0cd810d22a61102800577d6f9dc2507ea01ef98e3b
!! source digest: sha256:ad2f827fa79eed0a540b62fbaeebe78c1f0d035c64ef6cdeb4b667162512aa9e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def get_export_xml(self):
x1_Fornitura.append(x1_2_Comunicazione)

xml_string = etree.tostring(
x1_Fornitura, encoding="utf8", method="xml", pretty_print=True
x1_Fornitura,
encoding="utf-8",
method="xml",
pretty_print=True,
xml_declaration=True,
)
return xml_string

Expand Down
Loading

0 comments on commit 8da3d24

Please sign in to comment.