diff --git a/sale_order_amount_to_invoice/README.rst b/sale_order_amount_to_invoice/README.rst new file mode 100644 index 00000000000..b11e38024cc --- /dev/null +++ b/sale_order_amount_to_invoice/README.rst @@ -0,0 +1,104 @@ +============================ +Sale Order Amount to Invoice +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b128ace1032969d89528228d1287a949929314a5d2a9a59d95e12b7f5dd8e76c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/17.0/sale_order_amount_to_invoice + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_order_amount_to_invoice + :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/sale-workflow&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds "Amount to Invoice" for quotations/sales orders. It is +displayed: + +- In order lines. You need to show this field because it's hidden by + default +- In the quotation form view +- In the quotation list view. You need to show this field because it's + hidden by default + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +Sometimes you would like to see total amount to invoice for all your +sales orders. + +Configuration +============= + +No configuration is required. + +Usage +===== + +You need to click the list view setting (the last column in the list +view) and enable "Amount to Invoice" to show this filed in the list +view. Same thing for the quotation order lines. + +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 +------- + +* Cetmix + +Contributors +------------ + +- `Cetmix `__: + + - Ivan Sokolov + - Dessan Hemrayev + +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/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_amount_to_invoice/__init__.py b/sale_order_amount_to_invoice/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_order_amount_to_invoice/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_amount_to_invoice/__manifest__.py b/sale_order_amount_to_invoice/__manifest__.py new file mode 100644 index 00000000000..e268ccfe043 --- /dev/null +++ b/sale_order_amount_to_invoice/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Order Amount to Invoice", + "version": "17.0.1.0.0", + "author": "Cetmix, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/sale-workflow", + "category": "Sales", + "license": "AGPL-3", + "summary": "Show total amount to invoice in quotations/sales orders ", + "depends": [ + "sale", + "account", + ], + "data": [ + "views/sale_order_view.xml", + ], + "installable": True, +} diff --git a/sale_order_amount_to_invoice/i18n/it.po b/sale_order_amount_to_invoice/i18n/it.po new file mode 100644 index 00000000000..d4df930dd64 --- /dev/null +++ b/sale_order_amount_to_invoice/i18n/it.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_amount_to_invoice +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-08-27 11:25+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\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 5.10.4\n" + +#. module: sale_order_amount_to_invoice +#: model:ir.model,name:sale_order_amount_to_invoice.model_sale_order +msgid "Sales Order" +msgstr "Ordine di vendita" + +#. module: sale_order_amount_to_invoice +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_order_form +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_order_tree +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_quotation_tree +msgid "To Invoice" +msgstr "Da fatturare" + +#. module: sale_order_amount_to_invoice +#: model:ir.model.fields,field_description:sale_order_amount_to_invoice.field_sale_order__untaxed_amount_to_invoice +msgid "Untaxed Amount To Invoice" +msgstr "Importo imponibile da fatturare" diff --git a/sale_order_amount_to_invoice/i18n/sale_order_amount_to_invoice.pot b/sale_order_amount_to_invoice/i18n/sale_order_amount_to_invoice.pot new file mode 100644 index 00000000000..ff0e6e955b0 --- /dev/null +++ b/sale_order_amount_to_invoice/i18n/sale_order_amount_to_invoice.pot @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_amount_to_invoice +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: sale_order_amount_to_invoice +#: model:ir.model,name:sale_order_amount_to_invoice.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_order_amount_to_invoice +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_order_form +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_order_tree +#: model_terms:ir.ui.view,arch_db:sale_order_amount_to_invoice.view_quotation_tree +msgid "To Invoice" +msgstr "" + +#. module: sale_order_amount_to_invoice +#: model:ir.model.fields,field_description:sale_order_amount_to_invoice.field_sale_order__untaxed_amount_to_invoice +msgid "Untaxed Amount To Invoice" +msgstr "" diff --git a/sale_order_amount_to_invoice/models/__init__.py b/sale_order_amount_to_invoice/models/__init__.py new file mode 100644 index 00000000000..6aacb753131 --- /dev/null +++ b/sale_order_amount_to_invoice/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/sale_order_amount_to_invoice/models/sale_order.py b/sale_order_amount_to_invoice/models/sale_order.py new file mode 100644 index 00000000000..5927978a3cb --- /dev/null +++ b/sale_order_amount_to_invoice/models/sale_order.py @@ -0,0 +1,26 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + untaxed_amount_to_invoice = fields.Monetary( + compute="_compute_untaxed_amount_to_invoice", store=True + ) + + @api.depends("order_line.untaxed_amount_to_invoice") + def _compute_untaxed_amount_to_invoice(self): + """Compute the total invoice amount for each sales order.""" + result = self.env["sale.order.line"].read_group( + [("order_id", "in", self.ids)], + ["untaxed_amount_to_invoice:sum", "order_id"], + ["order_id"], + ) + amounts = { + item["order_id"][0]: item["untaxed_amount_to_invoice"] for item in result + } + for order in self: + order.untaxed_amount_to_invoice = amounts.get(order.id, 0) diff --git a/sale_order_amount_to_invoice/pyproject.toml b/sale_order_amount_to_invoice/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_order_amount_to_invoice/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_order_amount_to_invoice/readme/CONFIGURE.md b/sale_order_amount_to_invoice/readme/CONFIGURE.md new file mode 100644 index 00000000000..499830c72e6 --- /dev/null +++ b/sale_order_amount_to_invoice/readme/CONFIGURE.md @@ -0,0 +1 @@ +No configuration is required. \ No newline at end of file diff --git a/sale_order_amount_to_invoice/readme/CONTEXT.md b/sale_order_amount_to_invoice/readme/CONTEXT.md new file mode 100644 index 00000000000..97bd440c38c --- /dev/null +++ b/sale_order_amount_to_invoice/readme/CONTEXT.md @@ -0,0 +1 @@ +Sometimes you would like to see total amount to invoice for all your sales orders. \ No newline at end of file diff --git a/sale_order_amount_to_invoice/readme/CONTRIBUTORS.md b/sale_order_amount_to_invoice/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..c741b7f0228 --- /dev/null +++ b/sale_order_amount_to_invoice/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Cetmix](https://www.cetmix.com): + - Ivan Sokolov + - Dessan Hemrayev \ No newline at end of file diff --git a/sale_order_amount_to_invoice/readme/DESCRIPTION.md b/sale_order_amount_to_invoice/readme/DESCRIPTION.md new file mode 100644 index 00000000000..7eec2e7b89c --- /dev/null +++ b/sale_order_amount_to_invoice/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This module adds "Amount to Invoice" for quotations/sales orders. It is displayed: + +- In order lines. You need to show this field because it's hidden by default +- In the quotation form view +- In the quotation list view. You need to show this field because it's hidden by default \ No newline at end of file diff --git a/sale_order_amount_to_invoice/readme/USAGE.md b/sale_order_amount_to_invoice/readme/USAGE.md new file mode 100644 index 00000000000..b75734a166c --- /dev/null +++ b/sale_order_amount_to_invoice/readme/USAGE.md @@ -0,0 +1 @@ +You need to click the list view setting (the last column in the list view) and enable "Amount to Invoice" to show this filed in the list view. Same thing for the quotation order lines. \ No newline at end of file diff --git a/sale_order_amount_to_invoice/static/description/icon.png b/sale_order_amount_to_invoice/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_order_amount_to_invoice/static/description/icon.png differ diff --git a/sale_order_amount_to_invoice/static/description/index.html b/sale_order_amount_to_invoice/static/description/index.html new file mode 100644 index 00000000000..271b95c724a --- /dev/null +++ b/sale_order_amount_to_invoice/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Sale Order Amount to Invoice + + + +
+

Sale Order Amount to Invoice

+ + +

Beta License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

This module adds “Amount to Invoice” for quotations/sales orders. It is +displayed:

+
    +
  • In order lines. You need to show this field because it’s hidden by +default
  • +
  • In the quotation form view
  • +
  • In the quotation list view. You need to show this field because it’s +hidden by default
  • +
+

Table of contents

+ +
+

Use Cases / Context

+

Sometimes you would like to see total amount to invoice for all your +sales orders.

+
+
+

Configuration

+

No configuration is required.

+
+
+

Usage

+

You need to click the list view setting (the last column in the list +view) and enable “Amount to Invoice” to show this filed in the list +view. Same thing for the quotation order lines.

+
+
+

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

+
    +
  • Cetmix
  • +
+
+
+

Contributors

+
    +
  • Cetmix:
      +
    • Ivan Sokolov
    • +
    • Dessan Hemrayev
    • +
    +
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/sale_order_amount_to_invoice/tests/__init__.py b/sale_order_amount_to_invoice/tests/__init__.py new file mode 100644 index 00000000000..15963146727 --- /dev/null +++ b/sale_order_amount_to_invoice/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order_invoice_amount diff --git a/sale_order_amount_to_invoice/tests/test_sale_order_invoice_amount.py b/sale_order_amount_to_invoice/tests/test_sale_order_invoice_amount.py new file mode 100644 index 00000000000..1f8107086b4 --- /dev/null +++ b/sale_order_amount_to_invoice/tests/test_sale_order_invoice_amount.py @@ -0,0 +1,63 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import tagged +from odoo.tests.common import Form, TransactionCase + + +@tagged("post_install", "-at_install") +class TestSaleOrderInvoiceAmount(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + # Partners + res_partner_obj = cls.env["res.partner"] + product_obj = cls.env["product.product"] + cls.res_partner_1 = res_partner_obj.create({"name": "Test Partner 1"}) + # Products + cls.product_1 = product_obj.create( + {"name": "Desk Combination 1", "type": "consu", "invoice_policy": "order"} + ) + cls.product_2 = product_obj.create( + { + "name": "Desk Combination 2", + "type": "consu", + "invoice_policy": "delivery", + } + ) + # Sale Order + cls.sale_order_1 = cls.env["sale.order"].create( + {"partner_id": cls.res_partner_1.id} + ) + + def test_add_product(self): + """Check add product to sale order""" + with Form(self.sale_order_1) as form: + with form.order_line.new() as line_1: + line_1.product_id = self.product_1 + line_1.price_unit = 100.0 + with form.order_line.new() as line_2: + line_2.product_id = self.product_2 + line_2.price_unit = 150.0 + + sale_order = form.save() + + self.assertEqual( + sale_order.untaxed_amount_to_invoice, + 0, + msg="Amount to invoice must be equal 0", + ) + sale_order.action_confirm() + self.assertEqual( + sale_order.untaxed_amount_to_invoice, + 100.0, + msg="Amount to invoice must be equal 100.0", + ) + + sale_order.order_line[1].qty_delivered = 1 + self.assertEqual( + sale_order.untaxed_amount_to_invoice, + 250.0, + msg="Amount to invoice must be equal 250.0", + ) diff --git a/sale_order_amount_to_invoice/views/sale_order_view.xml b/sale_order_amount_to_invoice/views/sale_order_view.xml new file mode 100644 index 00000000000..6875a1f5bfb --- /dev/null +++ b/sale_order_amount_to_invoice/views/sale_order_view.xml @@ -0,0 +1,60 @@ + + + + sale.order.form + sale.order + + 99 + + + + + + + + + + + sale.order.tree + sale.order + + + + + + + + + sale.order.tree + sale.order + + + + + + + +