Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][MIG] l10n_it_fatturapa_out_triple_discount #2760

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
01b67c2
[ADD] l10n_it_fatturapa_out_triple_discount
SimoRubi Jan 22, 2019
3df7fca
[UPD] Update l10n_it_fatturapa_out_triple_discount.pot
oca-travis Feb 1, 2019
4017fce
FIX l10n_it_fatturapa_out_triple_discount adapt to new set_sequences …
eLBati Mar 7, 2019
9c6c605
[ADD] icon.png
OCA-git-bot Apr 3, 2019
f0cb63c
l10n_it_fatturapa: xml doctor for fatturapa
sherpya May 3, 2019
264f9b7
[UPD] README.rst
OCA-git-bot Jul 29, 2019
5b76fae
[MIG] 10n_it_fatturapa_out_triple_discount: Migration to 12.0
tafaRU Dec 17, 2019
3b7b6c9
[UPD] Update l10n_it_fatturapa_out_triple_discount.pot
oca-travis Jan 3, 2020
2278bbc
[UPD] README.rst
OCA-git-bot Jan 3, 2020
83fa79d
Use float_round from odoo because in python 3 "Exact halfway cases ar…
eLBati Jan 14, 2020
c640350
l10n_it_fatturapa_out_triple_discount 12.0.1.0.1
OCA-git-bot Jan 15, 2020
9c9bc3a
l10n_it_fatturapa_out_triple_discount: disable tests because unstable
eLBati Jan 21, 2020
4e40600
l10n_it_fatturapa_out_triple_discount 12.0.1.0.2
OCA-git-bot Jan 22, 2020
686943b
merge PR 1264 1717 1728 1737 1739
May 13, 2020
311e046
FIX license LGPL-3 conflicts
eLBati Sep 24, 2020
84b0ad1
l10n_it_fatturapa_out_triple_discount 12.0.1.0.4
OCA-git-bot Sep 24, 2020
f4aac77
[12.0][IMP] l10n_it_fatturapa_out and l10n_it_fatturapa_out_triple_di…
tafaRU Sep 11, 2020
641d54b
l10n_it_fatturapa_out_triple_discount 12.0.2.0.0
OCA-git-bot Oct 2, 2020
5cf5ef3
[FIX][l10n_it_fatturapa_out_triple_discount] change rounding to avoid…
Apr 12, 2021
dbad815
l10n_it_fatturapa_out_triple_discount 12.0.2.0.1
OCA-git-bot Apr 15, 2021
c87162f
[REF] l10n_it_fatturapa_out: Extract discounted price computation
SirTakobi Jul 13, 2022
0c28ad6
[MIG] l10n_it_fatturapa_out_triple_discount: Migration to 14.0
SirTakobi Jul 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions l10n_it_fatturapa_out/data/invoice_it_template.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
~ Copyright 2022 Simone Rubino - TAKOBI
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<!--
Expand Down
3 changes: 3 additions & 0 deletions l10n_it_fatturapa_out/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
* `TAKOBI <https://takobi.online>`_:

* Simone Rubino <sir@takobi.online>
6 changes: 4 additions & 2 deletions l10n_it_fatturapa_out/wizard/efattura.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2020 Giuseppe Borruso
# Copyright 2020 Marco Colombo
# Copyright 2022 Simone Rubino - TAKOBI
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
import os
from datetime import datetime
Expand Down Expand Up @@ -174,8 +176,8 @@ def get_all_taxes(record):
wiz = self.env["wizard.export.fatturapa"]
return wiz.getAllTaxes(record)

def get_importo(line):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trovo più versatile passare l'intera line piuttosto che i due valori qui. Un sottomodulo potrebbe voler fare l'override dell'importo leggendo valori presi da line. Se passi solo price_unit e discount, altri moduli non ci possono fare molto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A me sembra più utile non duplicare il codice per il calcolo dello sconto.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beh prima c'era funzione get_importo() che riceveva un parametro, line, adesso riceve due parametri, price_unit e discount, entrambi però presi da line.
È cambiata la signature della funzione, e rende la funzione meno versatile.

Forse sarebbe meglio passare un parametro aggiuntivo, opzionale, che permetta di selezionare quale sconto applicare, mantenendo la compatibilità con la base e altri (eventuali) moduli. Tipo:

def get_importo(line, discount_field="discount"):
  str_number = str(line[discount_field])

che permette di mantenere la compatibilità e comunque scegliere lo sconto da applicare, in modo del tutto generale. Un domani un altro modulo potrebbe voler fare dei conti sull'importo usando campi dalla line, o introdurre in altro campo sconto da usare come base tipo discount4 (faccio per dire, non che abbia senso).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chiaro ma resto della mia idea; mi da l'impressione di un UCAS. Detto ciò, sentiti libero di modificare la pr.

str_number = str(line.discount)
def get_importo(line, discount_field="discount"):
str_number = str(line[discount_field])
number = str_number[::-1].find(".")
if number <= 2:
return False
Expand Down
80 changes: 80 additions & 0 deletions l10n_it_fatturapa_out_triple_discount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
======================================================
ITA - Fattura elettronica - Integrazione sconto triplo
======================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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_triple_discount
: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_triple_discount
: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**

Questo modulo consente di generare correttamente la fattura elettronica (XML) quando il modulo account_invoice_triple_discount è installato.

**English**

The module allows to use correctly generate the Electronic Invoice (XML) when the module account_invoice_triple_discount is installed.

**Table of contents**

.. contents::
:local:

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_triple_discount%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
~~~~~~~

* Agile Business Group

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

* Simone Rubino
* Alex Comba <alex.comba@agilebg.com>

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
20 changes: 20 additions & 0 deletions l10n_it_fatturapa_out_triple_discount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2019 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "ITA - Fattura elettronica - Integrazione sconto triplo",
GSLabIt marked this conversation as resolved.
Show resolved Hide resolved
"summary": "Modulo ponte tra emissione " "fatture elettroniche e sconto triplo",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://github.com/OCA/l10n-italy"
"l10n_it_fatturapa_out_triple_discount",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"license": "AGPL-3",
"auto_install": True,
"depends": [
"l10n_it_fatturapa_out",
"account_invoice_triple_discount",
],
"data": ["data/invoice_it_template.xml"],
}
50 changes: 50 additions & 0 deletions l10n_it_fatturapa_out_triple_discount/data/invoice_it_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
~ Copyright 2022 Simone Rubino - TAKOBI
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<template
id="account_invoice_line_it_triple_discount"
inherit_id="l10n_it_fatturapa_out.account_invoice_line_it_sconto_maggiorazione"
>
<xpath expr="//ScontoMaggiorazione" position="after">
<t
t-set="importo2"
t-value="get_importo(line, discount_field='discount2')"
/>
<t
t-set="importo3"
t-value="get_importo(line, discount_field='discount3')"
/>
<ScontoMaggiorazione t-if="line.discount2 != 0 or importo2 != 0">
<!-- [2.2.1.10] -->
<t t-if="importo">
<Tipo t-if="importo2 &gt; 0">SC</Tipo>
<Tipo t-if="importo2 &lt;= 0">MG</Tipo>
<Importo t-esc="format_numbers(abs(importo2))" />
</t>
<t t-else="">
<Tipo t-if="line.discount2 &gt; 0">SC</Tipo>
<Tipo t-if="line.discount2 &lt;= 0">MG</Tipo>
<Percentuale t-esc="format_numbers_two(abs(line.discount2))" />
</t>
</ScontoMaggiorazione>
<ScontoMaggiorazione t-if="line.discount3 != 0 or importo3 != 0">
<!-- [2.2.1.10] -->
<t t-if="importo">
<Tipo t-if="importo3 &gt; 0">SC</Tipo>
<Tipo t-if="importo3 &lt;= 0">MG</Tipo>
<Importo t-esc="format_numbers(abs(importo3))" />
</t>
<t t-else="">
<Tipo t-if="line.discount3 &gt; 0">SC</Tipo>
<Tipo t-if="line.discount3 &lt;= 0">MG</Tipo>
<Percentuale t-esc="format_numbers_two(abs(line.discount3))" />
</t>
</ScontoMaggiorazione>
</xpath>
</template>
</data>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_fatturapa_out_triple_discount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: l10n_it_fatturapa_out_triple_discount
#: model:ir.model,name:l10n_it_fatturapa_out_triple_discount.model_wizard_export_fatturapa
msgid "Export E-invoice"
msgstr ""

9 changes: 9 additions & 0 deletions l10n_it_fatturapa_out_triple_discount/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* Simone Rubino
* Alex Comba <alex.comba@agilebg.com>
* `Ooops <https://ooops404.com>`_:

* Giovanni Serra <giovanni@gslab.it>

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

* Simone Rubino <sir@takobi.online>
7 changes: 7 additions & 0 deletions l10n_it_fatturapa_out_triple_discount/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Italiano**

Questo modulo consente di generare correttamente la fattura elettronica (XML) quando il modulo account_invoice_triple_discount è installato.

**English**

The module allows to use correctly generate the Electronic Invoice (XML) when the module account_invoice_triple_discount is installed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading