From ca08dd8a8dd03ada03eaf2395a1ad100fd71bffc Mon Sep 17 00:00:00 2001 From: PicchiSeba Date: Fri, 6 Dec 2024 10:41:54 +0100 Subject: [PATCH] [ADD]l10n_it_intrastat_delivery_note: new module that adds missing fields to the delivery note report --- l10n_it_intrastat_delivery_note/README.rst | 99 ++++ l10n_it_intrastat_delivery_note/__init__.py | 2 + .../__manifest__.py | 22 + l10n_it_intrastat_delivery_note/hooks.py | 43 ++ .../models/__init__.py | 1 + .../models/stock_move.py | 16 + .../pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 3 + .../readme/DESCRIPTION.md | 7 + .../report/report_delivery_document.xml | 86 ++++ .../report/report_delivery_note.xml | 25 + .../static/description/icon.png | Bin 0 -> 6821 bytes .../static/description/index.html | 432 ++++++++++++++++++ .../tests/__init__.py | 1 + .../tests/test_stock_move.py | 56 +++ .../addons/l10n_it_intrastat_delivery_note | 1 + .../l10n_it_intrastat_delivery_note/setup.py | 6 + 17 files changed, 803 insertions(+) create mode 100644 l10n_it_intrastat_delivery_note/README.rst create mode 100644 l10n_it_intrastat_delivery_note/__init__.py create mode 100644 l10n_it_intrastat_delivery_note/__manifest__.py create mode 100644 l10n_it_intrastat_delivery_note/hooks.py create mode 100644 l10n_it_intrastat_delivery_note/models/__init__.py create mode 100644 l10n_it_intrastat_delivery_note/models/stock_move.py create mode 100644 l10n_it_intrastat_delivery_note/pyproject.toml create mode 100644 l10n_it_intrastat_delivery_note/readme/CONTRIBUTORS.md create mode 100644 l10n_it_intrastat_delivery_note/readme/DESCRIPTION.md create mode 100644 l10n_it_intrastat_delivery_note/report/report_delivery_document.xml create mode 100644 l10n_it_intrastat_delivery_note/report/report_delivery_note.xml create mode 100644 l10n_it_intrastat_delivery_note/static/description/icon.png create mode 100644 l10n_it_intrastat_delivery_note/static/description/index.html create mode 100644 l10n_it_intrastat_delivery_note/tests/__init__.py create mode 100644 l10n_it_intrastat_delivery_note/tests/test_stock_move.py create mode 120000 setup/l10n_it_intrastat_delivery_note/odoo/addons/l10n_it_intrastat_delivery_note create mode 100644 setup/l10n_it_intrastat_delivery_note/setup.py diff --git a/l10n_it_intrastat_delivery_note/README.rst b/l10n_it_intrastat_delivery_note/README.rst new file mode 100644 index 000000000000..ff81f191bf2e --- /dev/null +++ b/l10n_it_intrastat_delivery_note/README.rst @@ -0,0 +1,99 @@ +============================= +ITA - Intrastat Delivery Note +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3e3510f1efa020fc96deafc7148bb0330fc1d930017577bf2a09390cd5c5b06c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/l10n_it_intrastat_delivery_note + :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-16-0/l10n-italy-16-0-l10n_it_intrastat_delivery_note + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Questo modulo aggiunge campi mancanti alla stampa del resoconto DDT + +**English** + +This module adds missing fields to the DDT report print + +**Table of contents** + +.. contents:: + :local: + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* PyTech SRL + +Contributors +------------ + +- `PyTech SRL `__: + + - Sebastiano Picchi + - Alessandro Uffreduzzi + +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-aleuffre| image:: https://github.com/aleuffre.png?size=40px + :target: https://github.com/aleuffre + :alt: aleuffre +.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px + :target: https://github.com/renda-dev + :alt: renda-dev +.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px + :target: https://github.com/PicchiSeba + :alt: PicchiSeba + +Current `maintainers `__: + +|maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba| + +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_intrastat_delivery_note/__init__.py b/l10n_it_intrastat_delivery_note/__init__.py new file mode 100644 index 000000000000..1a9a001cf76a --- /dev/null +++ b/l10n_it_intrastat_delivery_note/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .hooks import post_init_hook, uninstall_hook diff --git a/l10n_it_intrastat_delivery_note/__manifest__.py b/l10n_it_intrastat_delivery_note/__manifest__.py new file mode 100644 index 000000000000..74d7f6f9298c --- /dev/null +++ b/l10n_it_intrastat_delivery_note/__manifest__.py @@ -0,0 +1,22 @@ +{ + "name": "ITA - Intrastat Delivery Note", + "version": "16.0.1.0.0", + "category": "Hidden", + "summary": "Aggiunta campi mancanti a stampa DDT", + "author": "PyTech SRL, Odoo Community Association (OCA)", + "maintainers": ["aleuffre", "renda-dev", "PicchiSeba"], + "website": "https://github.com/OCA/l10n-italy", + "license": "AGPL-3", + "installable": True, + "depends": [ + "l10n_it_delivery_note", + "l10n_it_intrastat", + ], + "data": [ + "report/report_delivery_document.xml", + "report/report_delivery_note.xml", + ], + "demo": [], + "post_init_hook": "post_init_hook", + "uninstall_hook": "uninstall_hook", +} diff --git a/l10n_it_intrastat_delivery_note/hooks.py b/l10n_it_intrastat_delivery_note/hooks.py new file mode 100644 index 000000000000..cb122a323664 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/hooks.py @@ -0,0 +1,43 @@ +import logging + +from odoo import SUPERUSER_ID, api, tools + +_logger = logging.getLogger(__name__) + + +def post_init_hook(cr, registry): + # Convert 'HS Code' to an 'Intrastat code' + with api.Environment.manage(): + env = api.Environment(cr, SUPERUSER_ID, {}) + product_ids = env["product.product"].search([("hs_code", "!=", False)]) + for code, products in tools.groupby(product_ids, lambda x: x.hs_code): + report_intrastat_code_id = env["report.intrastat.code"].search( + [("name", "=", code)] + ) + if not report_intrastat_code_id: + _logger.warning("No Intrastat Code found for HS Code: '%s'", code) + continue + + env["product.product"].browse([i.id for i in products]).write( + { + "intrastat_code_id": report_intrastat_code_id.id, + "intrastat_type": report_intrastat_code_id.type, + } + ) + + +def uninstall_hook(cr, registry): + # Move every 'Intrastat code' to 'HS Code' + with api.Environment.manage(): + env = api.Environment(cr, SUPERUSER_ID, {}) + if hasattr(env["product.product"], "hs_code"): + product_ids = env["product.product"].search( + [("intrastat_code_id", "!=", False), ("hs_code", "=", False)] + ) + + for code, products in tools.groupby( + product_ids, lambda x: x.intrastat_code_id + ): + env["product.product"].browse([i.id for i in products]).write( + {"hs_code": code.name} + ) diff --git a/l10n_it_intrastat_delivery_note/models/__init__.py b/l10n_it_intrastat_delivery_note/models/__init__.py new file mode 100644 index 000000000000..6bda2d2428e0 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/models/__init__.py @@ -0,0 +1 @@ +from . import stock_move diff --git a/l10n_it_intrastat_delivery_note/models/stock_move.py b/l10n_it_intrastat_delivery_note/models/stock_move.py new file mode 100644 index 000000000000..f066f380fa61 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/models/stock_move.py @@ -0,0 +1,16 @@ +from odoo import models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + def _get_aggregated_product_quantities(self, **kwargs): + aggregated_move_lines = super()._get_aggregated_product_quantities(**kwargs) + for aggregated_move_line in aggregated_move_lines: + intrastat_code = aggregated_move_lines[aggregated_move_line][ + "product" + ].product_tmpl_id.intrastat_code_id.name + aggregated_move_lines[aggregated_move_line][ + "intrastat_code_id" + ] = intrastat_code + return aggregated_move_lines diff --git a/l10n_it_intrastat_delivery_note/pyproject.toml b/l10n_it_intrastat_delivery_note/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/l10n_it_intrastat_delivery_note/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_it_intrastat_delivery_note/readme/CONTRIBUTORS.md b/l10n_it_intrastat_delivery_note/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..3ed70787dc0b --- /dev/null +++ b/l10n_it_intrastat_delivery_note/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [PyTech SRL](https://pytech.it): + - Sebastiano Picchi \<\> + - Alessandro Uffreduzzi \<\> diff --git a/l10n_it_intrastat_delivery_note/readme/DESCRIPTION.md b/l10n_it_intrastat_delivery_note/readme/DESCRIPTION.md new file mode 100644 index 000000000000..163a139f6478 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +**Italiano** + +Questo modulo aggiunge campi mancanti alla stampa del resoconto DDT + +**English** + +This module adds missing fields to the DDT report print diff --git a/l10n_it_intrastat_delivery_note/report/report_delivery_document.xml b/l10n_it_intrastat_delivery_note/report/report_delivery_document.xml new file mode 100644 index 000000000000..2e292b6830aa --- /dev/null +++ b/l10n_it_intrastat_delivery_note/report/report_delivery_document.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + diff --git a/l10n_it_intrastat_delivery_note/report/report_delivery_note.xml b/l10n_it_intrastat_delivery_note/report/report_delivery_note.xml new file mode 100644 index 000000000000..4952dab61ac7 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/report/report_delivery_note.xml @@ -0,0 +1,25 @@ + + + + diff --git a/l10n_it_intrastat_delivery_note/static/description/icon.png b/l10n_it_intrastat_delivery_note/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3642c5fa1f989510b7d0c98b53b7ee25c8840fa2 GIT binary patch literal 6821 zcmV;W8d~LvP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{02&QRL_t(|+U=cpcpUYa$3HW( zU0SVHU9u!gvMt$i!*am_8yA}C3B`mv4hS3}A$O2m65v7-jPDYXKu8EB7YI%Q1PGi- zOa~iqw=CO|EEiSF>U~$*UT5b1SV`{kN|uOy@alQ|=vmLs{^t98>-T+sD?wFNl`myX zMf?(iFF2@yKmfPL!`W_I=MbnWpOn<|_J&Hr;qaHBjs`$gm5+N(;I(x-S+lkbkH>xN z)n}RNYR={zxA!|}>2RUdN_6+y*?pjs9=o4+H8x3|@cBi5 z6%bDH`>C&O@3Qf;=RV|A|k7EB)YZYRI}>DF+T zn!l>bghKw4fOxux5df96WGgqWn9YP#3y0b~02uX}$nP4Fl`E!`Gcj}cyPZsDgvdXt zDvyin7-ydpsl`35cS|(&8EX>cJHhPPEY3O@hV9 zFTcB#mDgN=(O?+Zv{T(ipsUwOb$!b**X^#XXZ@x!1Yzv8bzFU_AP9H@DnEU(l!n%R zuDy6BZ@#~aeRVc|@q??Pejv9`rn$pK-UKrV76WDbTIjTSqttvANsxKw<;}zxb$sie zFQWEPGmrePgxjwzJU0VX_JmYSMlDaQDdCL|4p86W;afLMCo|0&wF}v>bw5iNWbx2F z%ScI#W7RXCP`0;@>n|_DY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o5#S^KjN+1~GqWO6&yKp9Udmj(~WFQo^{A+g~_P&lUOdk9>Uz>X)E?Vdeh-=lHTj TBR6r900000NkvXXu0mjfZIC&! literal 0 HcmV?d00001 diff --git a/l10n_it_intrastat_delivery_note/static/description/index.html b/l10n_it_intrastat_delivery_note/static/description/index.html new file mode 100644 index 000000000000..5c87ebc9cdfc --- /dev/null +++ b/l10n_it_intrastat_delivery_note/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +ITA - Intrastat Delivery Note + + + +
+

ITA - Intrastat Delivery Note

+ + +

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

+

Italiano

+

Questo modulo aggiunge campi mancanti alla stampa del resoconto DDT

+

English

+

This module adds missing fields to the DDT report print

+

Table of contents

+ +
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • PyTech SRL
  • +
+
+
+

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.

+

Current maintainers:

+

aleuffre renda-dev PicchiSeba

+

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_intrastat_delivery_note/tests/__init__.py b/l10n_it_intrastat_delivery_note/tests/__init__.py new file mode 100644 index 000000000000..4b33b6f53cee --- /dev/null +++ b/l10n_it_intrastat_delivery_note/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_move diff --git a/l10n_it_intrastat_delivery_note/tests/test_stock_move.py b/l10n_it_intrastat_delivery_note/tests/test_stock_move.py new file mode 100644 index 000000000000..67089fd33b03 --- /dev/null +++ b/l10n_it_intrastat_delivery_note/tests/test_stock_move.py @@ -0,0 +1,56 @@ +from odoo.tests import Form +from odoo.tests.common import TransactionCase + + +class TestStockMove(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ProductTemplate = cls.env["product.template"] + + cls.partner = cls.env.ref("base.partner_admin") + cls.stock_location = cls.env.ref("stock.stock_location_stock") + cls.customer_location = cls.env.ref("stock.stock_location_customers") + cls.uom_unit = cls.env.ref("uom.product_uom_unit") + cls.product = cls.ProductTemplate.search( + [("intrastat_code_id", "!=", False)] + ).product_variant_ids[:1] + + def test_move_lines_aggregated(self): + self.assertEqual(len(self.product), 1) + self.env["stock.quant"]._update_available_quantity( + self.product, self.stock_location, 25 + ) + picking = self.env["stock.picking"].create( + { + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "picking_type_id": self.env.ref("stock.picking_type_out").id, + } + ) + move1 = self.env["stock.move"].create( + { + "name": "test_transit_1", + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "product_id": self.product.id, + "product_uom": self.uom_unit.id, + "product_uom_qty": 15.0, + "picking_id": picking.id, + "picking_type_id": self.env.ref("stock.picking_type_out").id, + } + ) + move1.quantity_done = 5 + picking.action_put_in_pack() + + with Form(picking) as delivery_form: + delivery_form.partner_id = self.partner + delivery_form.save() + + aggregate_values = picking.move_line_ids._get_aggregated_product_quantities() + self.assertTrue(bool(aggregate_values)) + for v in aggregate_values.values(): + self.assertEqual( + v["product"].product_tmpl_id.intrastat_code_id.name, + v["intrastat_code_id"], + ) diff --git a/setup/l10n_it_intrastat_delivery_note/odoo/addons/l10n_it_intrastat_delivery_note b/setup/l10n_it_intrastat_delivery_note/odoo/addons/l10n_it_intrastat_delivery_note new file mode 120000 index 000000000000..be9bd5663ca1 --- /dev/null +++ b/setup/l10n_it_intrastat_delivery_note/odoo/addons/l10n_it_intrastat_delivery_note @@ -0,0 +1 @@ +../../../../l10n_it_intrastat_delivery_note \ No newline at end of file diff --git a/setup/l10n_it_intrastat_delivery_note/setup.py b/setup/l10n_it_intrastat_delivery_note/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_intrastat_delivery_note/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)