diff --git a/l10n_it_fatturapa_in_purchase/README.rst b/l10n_it_fatturapa_in_purchase/README.rst new file mode 100644 index 000000000000..c1f23577ca1c --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/README.rst @@ -0,0 +1,99 @@ +================================================= +ITA - Fattura elettronica - Integrazione acquisti +================================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/14.0/l10n_it_fatturapa_in_purchase + :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-14-0/l10n-italy-14-0-l10n_it_fatturapa_in_purchase + :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/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Integra gli ordini di acquisto con le fatture elettroniche fornitore. + +Con questo modulo è possibile collegare una fattura elettronica fornitore a un ordine di acquisto esistente. + +In questo modo si tiene traccia della fatturazione o meno dell'ordine. + +**English** + +Integrate purchase orders with supplier electronic bills. + +With this module you can link a supplier electronic bill to an existing purchase order. + +In this way, you track whether the order is invoiced or not. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +**Italiano** + +Nelle fatture elettroniche fornitore in bozza, aprire la riga da collegare a una riga dell'ordine di acquisto e compilare il campo "Riga ordine di acquisto". + +**English** + +In draft supplier electronic bills, open the line to be linked to a purchase order line and fill in the 'Purchase order line' field. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Agile Business Group + +Contributors +~~~~~~~~~~~~ + +* Lorenzo Battistini +* Sergio Zanchetta + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_in_purchase/__init__.py b/l10n_it_fatturapa_in_purchase/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_it_fatturapa_in_purchase/__manifest__.py b/l10n_it_fatturapa_in_purchase/__manifest__.py new file mode 100644 index 000000000000..aaf72182435f --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2018 Lorenzo Battistini +# Copyright 2018 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo) +# Copyright 2019 Simone Rubino - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +{ + "name": "ITA - Fattura elettronica - Integrazione acquisti", + "summary": "Modulo ponte tra ricezione fatture elettroniche e acquisti", + "version": "14.0.1.0.0", + "category": "Hidden", + "author": "Agile Business Group, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-italy", + "license": "AGPL-3", + "depends": [ + "l10n_it_fatturapa_in", + "purchase", + ], + "data": [ + "views/invoice_view.xml", + ], + "installable": True, + "auto_install": True, +} diff --git a/l10n_it_fatturapa_in_purchase/i18n/it.po b/l10n_it_fatturapa_in_purchase/i18n/it.po new file mode 100644 index 000000000000..27706625abd6 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/i18n/it.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_in_purchase +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-09-27 08:55+0000\n" +"PO-Revision-Date: 2020-01-08 12:13+0000\n" +"Last-Translator: Sergio Zanchetta \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 3.10\n" + +#. module: l10n_it_fatturapa_in_purchase +#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_in_purchase.invoice_supplier_form_po_line +msgid "PO line" +msgstr "Riga OA" + +#. module: l10n_it_fatturapa_in_purchase +#: model:ir.model,name:l10n_it_fatturapa_in_purchase.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Riga ordine di acquisto" + +#. module: l10n_it_fatturapa_in_purchase +#: model:ir.model.fields,field_description:l10n_it_fatturapa_in_purchase.field_purchase_order_line__to_invoice +msgid "To Invoice" +msgstr "Da fatturare" + +#~ msgid "E-Invoice Import File" +#~ msgstr "File importazione fattura elettronica" + +#~ msgid "Invoice Line" +#~ msgstr "Riga Fattura" diff --git a/l10n_it_fatturapa_in_purchase/i18n/l10n_it_fatturapa_in_purchase.pot b/l10n_it_fatturapa_in_purchase/i18n/l10n_it_fatturapa_in_purchase.pot new file mode 100644 index 000000000000..bb07dea35ee9 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/i18n/l10n_it_fatturapa_in_purchase.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_in_purchase +# +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_in_purchase +#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_in_purchase.invoice_supplier_form_po_line +msgid "PO line" +msgstr "" + +#. module: l10n_it_fatturapa_in_purchase +#: model:ir.model,name:l10n_it_fatturapa_in_purchase.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: l10n_it_fatturapa_in_purchase +#: model:ir.model.fields,field_description:l10n_it_fatturapa_in_purchase.field_purchase_order_line__to_invoice +msgid "To Invoice" +msgstr "" + diff --git a/l10n_it_fatturapa_in_purchase/models/__init__.py b/l10n_it_fatturapa_in_purchase/models/__init__.py new file mode 100644 index 000000000000..9f03530643d8 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/models/__init__.py @@ -0,0 +1 @@ +from . import purchase_order diff --git a/l10n_it_fatturapa_in_purchase/models/purchase_order.py b/l10n_it_fatturapa_in_purchase/models/purchase_order.py new file mode 100644 index 000000000000..9c70a9194031 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/models/purchase_order.py @@ -0,0 +1,31 @@ +# Copyright 2018 Lorenzo Battistini +# Copyright 2018 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo) +# Copyright 2019 Simone Rubino - Agile Business Group + +from odoo import fields, models +from odoo.tools import float_compare + + +class POLine(models.Model): + _inherit = "purchase.order.line" + to_invoice = fields.Boolean( + "To Invoice", compute="_compute_qty_invoiced", store=True + ) + + def _compute_qty_invoiced(self): + super()._compute_qty_invoiced() + precision = self.env["decimal.precision"].precision_get( + "Product Unit of Measure" + ) + for line in self: + if float_compare(line.qty_to_invoice, 0.0, precision_digits=precision) == 1: + line.to_invoice = True + else: + line.to_invoice = False + + def name_get(self): + res = [] + for line in self: + name = "{}: {}".format(line.order_id.name, line.name) + res.append((line.id, name)) + return res diff --git a/l10n_it_fatturapa_in_purchase/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_in_purchase/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..0fcb0b17c2f9 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Lorenzo Battistini +* Sergio Zanchetta diff --git a/l10n_it_fatturapa_in_purchase/readme/DESCRIPTION.rst b/l10n_it_fatturapa_in_purchase/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..3f38e1c90ac4 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/readme/DESCRIPTION.rst @@ -0,0 +1,15 @@ +**Italiano** + +Integra gli ordini di acquisto con le fatture elettroniche fornitore. + +Con questo modulo è possibile collegare una fattura elettronica fornitore a un ordine di acquisto esistente. + +In questo modo si tiene traccia della fatturazione o meno dell'ordine. + +**English** + +Integrate purchase orders with supplier electronic bills. + +With this module you can link a supplier electronic bill to an existing purchase order. + +In this way, you track whether the order is invoiced or not. diff --git a/l10n_it_fatturapa_in_purchase/readme/USAGE.rst b/l10n_it_fatturapa_in_purchase/readme/USAGE.rst new file mode 100644 index 000000000000..7df277de8bfe --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/readme/USAGE.rst @@ -0,0 +1,7 @@ +**Italiano** + +Nelle fatture elettroniche fornitore in bozza, aprire la riga da collegare a una riga dell'ordine di acquisto e compilare il campo "Riga ordine di acquisto". + +**English** + +In draft supplier electronic bills, open the line to be linked to a purchase order line and fill in the 'Purchase order line' field. diff --git a/l10n_it_fatturapa_in_purchase/static/description/icon.png b/l10n_it_fatturapa_in_purchase/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/l10n_it_fatturapa_in_purchase/static/description/icon.png differ diff --git a/l10n_it_fatturapa_in_purchase/static/description/index.html b/l10n_it_fatturapa_in_purchase/static/description/index.html new file mode 100644 index 000000000000..e68985d34671 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/static/description/index.html @@ -0,0 +1,435 @@ + + + + + + +ITA - Fattura elettronica - Integrazione acquisti + + + +
+

ITA - Fattura elettronica - Integrazione acquisti

+ + +

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Italiano

+

Integra gli ordini di acquisto con le fatture elettroniche fornitore.

+

Con questo modulo è possibile collegare una fattura elettronica fornitore a un ordine di acquisto esistente.

+

In questo modo si tiene traccia della fatturazione o meno dell’ordine.

+

English

+

Integrate purchase orders with supplier electronic bills.

+

With this module you can link a supplier electronic bill to an existing purchase order.

+

In this way, you track whether the order is invoiced or not.

+

Table of contents

+ +
+

Usage

+

Italiano

+

Nelle fatture elettroniche fornitore in bozza, aprire la riga da collegare a una riga dell’ordine di acquisto e compilare il campo “Riga ordine di acquisto”.

+

English

+

In draft supplier electronic bills, open the line to be linked to a purchase order line and fill in the ‘Purchase order line’ field.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Agile Business Group
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_it_fatturapa_in_purchase/tests/__init__.py b/l10n_it_fatturapa_in_purchase/tests/__init__.py new file mode 100644 index 000000000000..7d340b4d3f59 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2019 Simone Rubino - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_l10n_it_fatturapa_in_purchase diff --git a/l10n_it_fatturapa_in_purchase/tests/data/IT05979361218_008.xml b/l10n_it_fatturapa_in_purchase/tests/data/IT05979361218_008.xml new file mode 100644 index 000000000000..cd4629331445 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/tests/data/IT05979361218_008.xml @@ -0,0 +1,98 @@ + + + + + + IT + 05979361218 + + 008 + FPA12 + UFPQ1O + + + + + IT + 05979361218 + + + SOCIETA' ALPHA BETA SRL + + RF02 + + + VIALE ROMA 543B + 07100 + SASSARI + SS + IT + + + + + 80213330584 + + AMMINISTRAZIONE BETA + + + + VIA TORINO 38-B + 00145 + ROMA + RM + IT + + + + + + MARIO + ROSSI + + + + TZ + + + + + TD01 + EUR + 2015-06-22 + FT/2015/0012 + Rif ordine MAPA: --- Nr. Identificativo Ordine 1234567 + + + + + 1 + Prodotto di test al giorno + 1.00 + 10.00 + + SC + 10.00 + + 9.00 + 0.00 + N4 + + + 0.00 + N4 + 9.00 + 0.00 + Operazioni senza addebito imposta regime contribuenti minimi art.27 c.1-2 DL.98/11 + + + + diff --git a/l10n_it_fatturapa_in_purchase/tests/test_l10n_it_fatturapa_in_purchase.py b/l10n_it_fatturapa_in_purchase/tests/test_l10n_it_fatturapa_in_purchase.py new file mode 100644 index 000000000000..cfc3eba808c1 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/tests/test_l10n_it_fatturapa_in_purchase.py @@ -0,0 +1,55 @@ +# Copyright 2019 Simone Rubino - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from datetime import datetime + +from odoo.fields import first +from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT + +from odoo.addons.l10n_it_fatturapa_in.tests.fatturapa_common import FatturapaCommon + + +class Testl10nItFatturapaInPurchase(FatturapaCommon): + def setUp(self): + super().setUp() + order_model = self.env["purchase.order"] + self.partner_id = self.env.ref("base.res_partner_1") + self.product_id_1 = self.env.ref("product.product_product_8") + self.order = order_model.create( + { + "name": "test_po", + "partner_id": self.partner_id.id, + "order_line": [ + ( + 0, + 0, + { + "name": self.product_id_1.name, + "product_id": self.product_id_1.id, + "product_qty": 5.0, + "product_uom": self.product_id_1.uom_po_id.id, + "price_unit": 500.0, + "date_planned": datetime.today().strftime( + DEFAULT_SERVER_DATETIME_FORMAT + ), + }, + ) + ], + } + ) + + def test_fatturapa_in_purchase(self): + """Check that `name_get` works properly. verify to_invoice field""" + res = self.run_wizard("test_fatturapa_in_purchase", "IT05979361218_008.xml") + invoice_id = res.get("domain")[0][2][0] + invoice = self.invoice_model.browse(invoice_id) + + inv_line = first(invoice.invoice_line_ids) + order_line = first(self.order.order_line) + inv_line.purchase_line_id = order_line + + self.assertEqual(order_line.display_name, "test_po: Large Desk") + self.assertFalse(order_line.to_invoice) + order_line.product_id.write({"purchase_method": "purchase"}) + self.order.button_approve() + self.assertTrue(order_line.to_invoice) diff --git a/l10n_it_fatturapa_in_purchase/views/invoice_view.xml b/l10n_it_fatturapa_in_purchase/views/invoice_view.xml new file mode 100644 index 000000000000..d5a86aece802 --- /dev/null +++ b/l10n_it_fatturapa_in_purchase/views/invoice_view.xml @@ -0,0 +1,48 @@ + + + + + + view_invoice_form_fatturapa_po_line + account.move + + + + + + + + + + + + invoice_supplier_form_po_line + account.move + + + + + + + + {'column_invisible': [('parent.move_type', 'not in', ('in_invoice', 'in_refund'))]} + + + + + diff --git a/setup/l10n_it_fatturapa_in_purchase/odoo/addons/l10n_it_fatturapa_in_purchase b/setup/l10n_it_fatturapa_in_purchase/odoo/addons/l10n_it_fatturapa_in_purchase new file mode 120000 index 000000000000..3aed3a8463b9 --- /dev/null +++ b/setup/l10n_it_fatturapa_in_purchase/odoo/addons/l10n_it_fatturapa_in_purchase @@ -0,0 +1 @@ +../../../../l10n_it_fatturapa_in_purchase \ No newline at end of file diff --git a/setup/l10n_it_fatturapa_in_purchase/setup.py b/setup/l10n_it_fatturapa_in_purchase/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_fatturapa_in_purchase/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)