diff --git a/account_invoice_line_sale_line_position/README.rst b/account_invoice_line_sale_line_position/README.rst new file mode 100644 index 000000000..53411bd18 --- /dev/null +++ b/account_invoice_line_sale_line_position/README.rst @@ -0,0 +1,89 @@ +======================================= +Account Invoice Line Sale Line Position +======================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:93336364c075809abad8389fa5673e97bf86bc11e030c2c8182da346a2a6cceb + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Faccount--invoice--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoice-reporting/tree/16.0/account_invoice_line_sale_line_position + :alt: OCA/account-invoice-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-invoice-reporting-16-0/account-invoice-reporting-16-0-account_invoice_line_sale_line_position + :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/account-invoice-reporting&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is build on top of the module `sale_order_line_position`. + +It adds (if any) the sale line position on the invoice line. +There can be multiple positions for one invoicing line. And they are +added to the report. + +**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 +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Thierry Ducrest +* `Trobz `_: +* Nguyen Ho +* `Binhex `_: +* David Luis Mora + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp + +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/account-invoice-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_line_sale_line_position/__init__.py b/account_invoice_line_sale_line_position/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/account_invoice_line_sale_line_position/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_invoice_line_sale_line_position/__manifest__.py b/account_invoice_line_sale_line_position/__manifest__.py new file mode 100644 index 000000000..9c9c84475 --- /dev/null +++ b/account_invoice_line_sale_line_position/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Account Invoice Line Sale Line Position", + "summary": "Adds the related sale line position on invoice line.", + "version": "16.0.1.0.0", + "category": "Sale", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/account-invoice-reporting", + "depends": ["sale_order_line_position"], + "data": ["views/account_move_views.xml", "report/invoice_report.xml"], + "installable": True, +} diff --git a/account_invoice_line_sale_line_position/i18n/account_invoice_line_sale_line_position.pot b/account_invoice_line_sale_line_position/i18n/account_invoice_line_sale_line_position.pot new file mode 100644 index 000000000..c28728e67 --- /dev/null +++ b/account_invoice_line_sale_line_position/i18n/account_invoice_line_sale_line_position.pot @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_line_sale_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.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: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_bank_statement_line__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_payment__has_order_position +msgid "Has Order Position" +msgstr "" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_invoice_line_sale_line_position +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.report_invoice_document +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.view_move_form +msgid "Pos" +msgstr "" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move_line__position_formatted +msgid "Position Formatted" +msgstr "" diff --git a/account_invoice_line_sale_line_position/i18n/de.po b/account_invoice_line_sale_line_position/i18n/de.po new file mode 100644 index 000000000..1c14a25ad --- /dev/null +++ b/account_invoice_line_sale_line_position/i18n/de.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_line_sale_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-05-11 13:05+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\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.3.2\n" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_bank_statement_line__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_payment__has_order_position +msgid "Has Order Position" +msgstr "Hat Auftragsposition" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move +msgid "Journal Entry" +msgstr "Journalbuchung" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move_line +msgid "Journal Item" +msgstr "Journal-Item" + +#. module: account_invoice_line_sale_line_position +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.report_invoice_document +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.view_move_form +msgid "Pos" +msgstr "Pos" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move_line__position_formatted +msgid "Position Formatted" +msgstr "" + +#~ msgid "Display Name" +#~ msgstr "Anzeigename" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Zuletzt geändert am" diff --git a/account_invoice_line_sale_line_position/i18n/es.po b/account_invoice_line_sale_line_position/i18n/es.po new file mode 100644 index 000000000..15bf30204 --- /dev/null +++ b/account_invoice_line_sale_line_position/i18n/es.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_invoice_line_sale_line_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-29 10:09+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\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" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_bank_statement_line__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move__has_order_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_payment__has_order_position +msgid "Has Order Position" +msgstr "Tiene posición de pedido" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move +msgid "Journal Entry" +msgstr "Entrada diaria" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model,name:account_invoice_line_sale_line_position.model_account_move_line +msgid "Journal Item" +msgstr "artículo diario" + +#. module: account_invoice_line_sale_line_position +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.report_invoice_document +#: model_terms:ir.ui.view,arch_db:account_invoice_line_sale_line_position.view_move_form +msgid "Pos" +msgstr "Posición" + +#. module: account_invoice_line_sale_line_position +#: model:ir.model.fields,field_description:account_invoice_line_sale_line_position.field_account_move_line__position_formatted +msgid "Position Formatted" +msgstr "Posición Formateada" diff --git a/account_invoice_line_sale_line_position/models/__init__.py b/account_invoice_line_sale_line_position/models/__init__.py new file mode 100644 index 000000000..8e072db8f --- /dev/null +++ b/account_invoice_line_sale_line_position/models/__init__.py @@ -0,0 +1 @@ +from . import account_invoice diff --git a/account_invoice_line_sale_line_position/models/account_invoice.py b/account_invoice_line_sale_line_position/models/account_invoice.py new file mode 100644 index 000000000..057e17c89 --- /dev/null +++ b/account_invoice_line_sale_line_position/models/account_invoice.py @@ -0,0 +1,35 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import api, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + has_order_position = fields.Boolean(compute="_compute_has_order_position") + + @api.depends("invoice_line_ids.position_formatted") + def _compute_has_order_position(self): + for record in self: + record.has_order_position = any( + record.invoice_line_ids.mapped("position_formatted") + ) + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + position_formatted = fields.Char(compute="_compute_position_formatted") + + @api.depends("sale_line_ids.position") + def _compute_position_formatted(self): + for record in self: + if record.display_type: + record.position_formatted = "" + continue + values = [ + val for val in record.sale_line_ids.mapped("position_formatted") if val + ] + + record.position_formatted = "/".join(values) diff --git a/account_invoice_line_sale_line_position/readme/CONTRIBUTORS.rst b/account_invoice_line_sale_line_position/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..c4811e65d --- /dev/null +++ b/account_invoice_line_sale_line_position/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Thierry Ducrest +* `Trobz `_: +* Nguyen Ho +* `Binhex `_: +* David Luis Mora diff --git a/account_invoice_line_sale_line_position/readme/CREDITS.rst b/account_invoice_line_sale_line_position/readme/CREDITS.rst new file mode 100644 index 000000000..f37ebe757 --- /dev/null +++ b/account_invoice_line_sale_line_position/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp diff --git a/account_invoice_line_sale_line_position/readme/DESCRIPTION.rst b/account_invoice_line_sale_line_position/readme/DESCRIPTION.rst new file mode 100644 index 000000000..da70e8b2a --- /dev/null +++ b/account_invoice_line_sale_line_position/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module is build on top of the module `sale_order_line_position`. + +It adds (if any) the sale line position on the invoice line. +There can be multiple positions for one invoicing line. And they are +added to the report. diff --git a/account_invoice_line_sale_line_position/report/invoice_report.xml b/account_invoice_line_sale_line_position/report/invoice_report.xml new file mode 100644 index 000000000..7f039d798 --- /dev/null +++ b/account_invoice_line_sale_line_position/report/invoice_report.xml @@ -0,0 +1,16 @@ + + + + diff --git a/account_invoice_line_sale_line_position/static/description/icon.png b/account_invoice_line_sale_line_position/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/account_invoice_line_sale_line_position/static/description/icon.png differ diff --git a/account_invoice_line_sale_line_position/static/description/index.html b/account_invoice_line_sale_line_position/static/description/index.html new file mode 100644 index 000000000..10fee3de3 --- /dev/null +++ b/account_invoice_line_sale_line_position/static/description/index.html @@ -0,0 +1,433 @@ + + + + + + +Account Invoice Line Sale Line Position + + + +
+

Account Invoice Line Sale Line Position

+ + +

Beta License: AGPL-3 OCA/account-invoice-reporting Translate me on Weblate Try me on Runboat

+

This module is build on top of the module sale_order_line_position.

+

It adds (if any) the sale line position on the invoice line. +There can be multiple positions for one invoicing line. And they are +added to the report.

+

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

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

+
+
+

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/account-invoice-reporting project on GitHub.

+

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

+
+
+
+ + diff --git a/account_invoice_line_sale_line_position/tests/__init__.py b/account_invoice_line_sale_line_position/tests/__init__.py new file mode 100644 index 000000000..ea9babe4d --- /dev/null +++ b/account_invoice_line_sale_line_position/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_invoice_line_sale_line_position diff --git a/account_invoice_line_sale_line_position/tests/test_account_invoice_line_sale_line_position.py b/account_invoice_line_sale_line_position/tests/test_account_invoice_line_sale_line_position.py new file mode 100644 index 000000000..d079c07ed --- /dev/null +++ b/account_invoice_line_sale_line_position/tests/test_account_invoice_line_sale_line_position.py @@ -0,0 +1,55 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo.tests import SingleTransactionCase + + +class TestAccountInvoiceLineSaleLinePosition(SingleTransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.partner = cls.env.ref("base.res_partner_12") + cls.product = cls.env.ref("product.product_product_9") + cls.order = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": cls.product.id, + "name": cls.product.name, + "product_uom_qty": 4.0, + "price_unit": 123.0, + "qty_delivered": 4.0, + }, + ), + ( + 0, + 0, + {"name": "section", "display_type": "line_section"}, + ), + ( + 0, + 0, + { + "product_id": cls.product.id, + "name": cls.product.name, + "product_uom_qty": 1.0, + "price_unit": 0.0, + "qty_delivered": 1.0, + }, + ), + ], + } + ) + cls.order.action_confirm() + cls.order._force_lines_to_invoice_policy_order() + + def test_invoice_position(self): + """Check positions are retrieved from sale line.""" + self.invoice = self.order._create_invoices() + self.assertEqual(self.invoice.invoice_line_ids[0].position_formatted, "001") + self.assertEqual(self.invoice.invoice_line_ids[1].position_formatted, "") + self.assertEqual(self.invoice.invoice_line_ids[2].position_formatted, "002") diff --git a/account_invoice_line_sale_line_position/views/account_move_views.xml b/account_invoice_line_sale_line_position/views/account_move_views.xml new file mode 100644 index 000000000..bc1697252 --- /dev/null +++ b/account_invoice_line_sale_line_position/views/account_move_views.xml @@ -0,0 +1,21 @@ + + + + + account.move + + + + + + + + + + diff --git a/setup/account_invoice_line_sale_line_position/odoo/addons/account_invoice_line_sale_line_position b/setup/account_invoice_line_sale_line_position/odoo/addons/account_invoice_line_sale_line_position new file mode 120000 index 000000000..70c06eb83 --- /dev/null +++ b/setup/account_invoice_line_sale_line_position/odoo/addons/account_invoice_line_sale_line_position @@ -0,0 +1 @@ +../../../../account_invoice_line_sale_line_position \ No newline at end of file diff --git a/setup/account_invoice_line_sale_line_position/setup.py b/setup/account_invoice_line_sale_line_position/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/account_invoice_line_sale_line_position/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)