Skip to content

Commit

Permalink
Merge PR #2559 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by tafaRU
  • Loading branch information
OCA-git-bot committed Feb 3, 2022
2 parents 180f47b + 082b5d4 commit 93ffaef
Show file tree
Hide file tree
Showing 31 changed files with 1,709 additions and 32 deletions.
46 changes: 24 additions & 22 deletions l10n_it_fatturapa_out/data/invoice_it_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -296,44 +296,44 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<CedentePrestatore>
<DatiAnagrafici>
<IdFiscaleIVA>
<IdPaese t-esc="get_vat_country(company_id.vat)" />
<IdCodice t-esc="get_vat_number(company_id.vat)" />
<IdPaese t-esc="get_vat_country(partner_id.vat)" />
<IdCodice t-esc="get_vat_number(partner_id.vat)" />
</IdFiscaleIVA>
<CodiceFiscale
t-if="company_id.partner_id.fiscalcode"
t-esc="company_id.partner_id.fiscalcode"
t-if="partner_id.fiscalcode"
t-esc="partner_id.fiscalcode"
/>
<Anagrafica>
<Denominazione t-esc="company_id.partner_id.display_name" />
<Denominazione t-esc="partner_id.display_name" />
<Nome
t-if="not company_id.partner_id.is_company"
t-esc="company_id.partner_id.firstname"
t-if="not partner_id.is_company"
t-esc="partner_id.firstname"
/>
<Cognome
t-if="not company_id.partner_id.is_company"
t-esc="company_id.partner_id.lastname"
t-if="not partner_id.is_company"
t-esc="partner_id.lastname"
/>
<!-- <Titolo t-esc=""/>-->
<CodEORI
t-if="company_id.partner_id.eori_code"
t-esc="company_id.partner_id.eori_code"
t-if="partner_id.eori_code"
t-esc="partner_id.eori_code"
/>
</Anagrafica>
<!-- <AlboProfessionale t-esc=""/>-->
<!-- <ProvinciaAlbo t-esc=""/>-->
<!-- <NumeroIscrizioneAlbo t-esc=""/>-->
<!-- <DataIscrizioneAlbo t-esc=""/>-->
<RegimeFiscale
t-esc="company_id.fatturapa_fiscal_position_id.code"
/>
<RegimeFiscale>RF01</RegimeFiscale>
<!-- TODO: see https://github.com/OCA/l10n-italy/issues/2557-->
<!-- t-esc="partner_id.fatturapa_fiscal_position_id.code"-->
</DatiAnagrafici>
<Sede>
<t t-call="l10n_it_fatturapa_out.account_invoice_it_FatturaPA_sede">
<t t-set="partner_id" t-value="company_id.partner_id" />
</t>
<t
t-call="l10n_it_fatturapa_out.account_invoice_it_FatturaPA_sede"
/>
</Sede>
<StabileOrganizzazione
t-if="company_id.fatturapa_stabile_organizzazione"
t-if="company_id and company_id.fatturapa_stabile_organizzazione"
>
<t t-call="l10n_it_fatturapa_out.account_invoice_it_FatturaPA_sede">
<t
Expand All @@ -343,7 +343,7 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
</t>
</StabileOrganizzazione>
<IscrizioneREA
t-if="company_id.rea_office and company_id.rea_code and company_id.rea_liquidation_state"
t-if="company_id and company_id.rea_office and company_id.rea_code and company_id.rea_liquidation_state"
>
<!--1.2.4-->
<Ufficio
Expand All @@ -361,7 +361,7 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
/>
<StatoLiquidazione t-esc="company_id.rea_liquidation_state" />
</IscrizioneREA>
<Contatti>
<Contatti t-if="company_id">
<Telefono
t-if="format_phone(company_id.partner_id.phone)"
t-esc="format_phone(company_id.partner_id.phone)"
Expand All @@ -373,7 +373,7 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
<Email t-if="company_id.email" t-esc="company_id.email" />
</Contatti>
<RiferimentoAmministrazione
t-if="company_id.fatturapa_pub_administration_ref"
t-if="company_id and company_id.fatturapa_pub_administration_ref"
t-esc="company_id.fatturapa_pub_administration_ref"
/>
</CedentePrestatore>
Expand Down Expand Up @@ -701,7 +701,9 @@ e 'line' per riga di fattura (a seconda del livello in cui sono chiamati)
/>
<t
t-call="l10n_it_fatturapa_out.account_invoice_it_cedente_prestatore"
/>
>
<t t-set="partner_id" t-value="company_id.partner_id" />
</t>
<t
t-call="l10n_it_fatturapa_out.account_invoice_it_rappresentante_fiscale"
/>
Expand Down
6 changes: 6 additions & 0 deletions l10n_it_fatturapa_out/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def preventive_checks(self):
raise UserError(
_("Invoice %s contains product lines w/o taxes") % invoice.name
)
company_id = invoice.company_id
if company_id.vat != company_id.partner_id.vat:
raise UserError(
_("Invoice %s: company and company partner must have same vat")
% invoice.name
)
return

def action_invoice_cancel(self):
Expand Down
11 changes: 7 additions & 4 deletions l10n_it_fatturapa_out/tests/fatturapa_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ def AttachFileToInvoice(self, InvoiceId, filename):
}
)

def set_sequences(self, invoice_number, dt):
def set_sequences(
self,
invoice_number,
dt,
sequence_name="Customer Invoices : Check Number Sequence",
):
seq_pool = self.env["ir.sequence"]
inv_seq = seq_pool.search(
[("name", "=", "Customer Invoices : Check Number Sequence")], limit=1
)
inv_seq = seq_pool.search([("name", "=", sequence_name)], limit=1)
seq_date = self.env["ir.sequence.date_range"].search(
[
("sequence_id", "=", inv_seq.id),
Expand Down
6 changes: 4 additions & 2 deletions l10n_it_fatturapa_out/wizard/efattura.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def format_phone(number):
return number
return False

def format_price(line):
def format_price(line, sign=1):
res = line.price_unit
if line.tax_ids and line.tax_ids[0].price_include:
res = line.price_unit / (1 + (line.tax_ids[0].amount / 100))
Expand All @@ -115,7 +115,9 @@ def format_price(line):
res = -res

# XXX arrotondamento?
res = "{prezzo:.{precision}f}".format(prezzo=res, precision=price_precision)
res = "{prezzo:.{precision}f}".format(
prezzo=sign * res, precision=price_precision
)
return res

def format_quantity(line):
Expand Down
104 changes: 104 additions & 0 deletions l10n_it_fatturapa_out_rc/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
============================================
ITA - Emissione e-fattura con reverse charge
============================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_out_rc
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_fatturapa_out_rc
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Gestione tipi documento fiscale TD16, TD17, TD18, TD19 in generazione fattura elettronica.

Il modulo permette di impostare, nell'XML, il corretto fornitore in caso di reverse charge.

**Table of contents**

.. contents::
:local:

Configuration
=============

**Italiano**

Vedi ``l10n_it_reverse_charge`` per la configurazione dei tipi di reverse charge.

Per le autofatture da comunicare a SDI va impostato

**Tipo partner** = **Altro**

e

**Partner autofattura** = **My company**

Sul tipo di reverse charge impostare anche il relativo **Tipo documento fiscale**

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_out_rc%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* TAKOBI

Contributors
~~~~~~~~~~~~

* `TAKOBI <https://takobi.online>`_:

* Lorenzo Battistini

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-eLBati| image:: https://github.com/eLBati.png?size=40px
:target: https://github.com/eLBati
:alt: eLBati

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-eLBati|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_out_rc>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions l10n_it_fatturapa_out_rc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import wizard
from . import models
26 changes: 26 additions & 0 deletions l10n_it_fatturapa_out_rc/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 Lorenzo Battistini @ TAKOBI
# Copyright 2021 Alex Comba - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "ITA - Emissione e-fattura con reverse charge",
"summary": "Integrazione l10n_it_fatturapa_out e l10n_it_reverse_charge",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://github.com/OCA/l10n-italy",
"author": "TAKOBI, Odoo Community Association (OCA)",
"maintainers": ["eLBati"],
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": [
"l10n_it_fatturapa_out",
"l10n_it_fatturapa_in",
"l10n_it_reverse_charge",
],
"data": [
"views/rc_type_views.xml",
"views/invoice_it_template.xml",
],
}
Loading

0 comments on commit 93ffaef

Please sign in to comment.