diff --git a/purchase_force_invoiced_quantity/README.rst b/purchase_force_invoiced_quantity/README.rst new file mode 100644 index 00000000000..78b283d1f5b --- /dev/null +++ b/purchase_force_invoiced_quantity/README.rst @@ -0,0 +1,121 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================ +Purchase Force Invoiced Quantity +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d2654ecfc75bc0715ae3625b649842faaca507543fec3cec094ffbe3422ec310 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/19.0/purchase_force_invoiced_quantity + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-19-0/purchase-workflow-19-0-purchase_force_invoiced_quantity + :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/purchase-workflow&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module add a new "Force Invoiced" field to purchase order lines. +This field is used as modifier when computing quantity to be invoiced. + +Current behaviour: quantity to invoice = delivered - invoiced + +Implemented behaviour: quantity to invoice = delivered - invoiced - +force invoiced + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +This module implements additional featured for the `Purchase Force +Invoiced `__ +module. + +It covers the following scenarios: + +- One need to modify the quantity to be invoiced after the products were + received. Eg .you negotiated an extra discount from your vendor. +- You would like to fix some issues with quantities invoiced cause by + incorrect data entry. + +Configuration +============= + +No configuration is required. + +Usage +===== + +Open a purchase order and add an amount into the "Force Invoiced" field. +Amount to invoice will be adjusted accordingly. This field is optional +so you can hide it if you don't need it. + +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 + +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_force_invoiced_quantity/__init__.py b/purchase_force_invoiced_quantity/__init__.py new file mode 100644 index 00000000000..bf8e144111d --- /dev/null +++ b/purchase_force_invoiced_quantity/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/purchase_force_invoiced_quantity/__manifest__.py b/purchase_force_invoiced_quantity/__manifest__.py new file mode 100644 index 00000000000..c7cc4378fd9 --- /dev/null +++ b/purchase_force_invoiced_quantity/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Purchase Force Invoiced Quantity", + "summary": "Add manual invoice quantity in purchase order lines", + "version": "19.0.1.0.0", + "author": "Cetmix, Odoo Community Association (OCA)", + "category": "Purchase Management", + "license": "AGPL-3", + "website": "https://github.com/OCA/purchase-workflow", + "depends": ["purchase_force_invoiced"], + "data": [ + "views/purchase_order.xml", + ], + "demo": [ + "demo/demo_product.xml", + "demo/demo_purchase_order.xml", + ], + "installable": True, +} diff --git a/purchase_force_invoiced_quantity/demo/demo_product.xml b/purchase_force_invoiced_quantity/demo/demo_product.xml new file mode 100644 index 00000000000..67512fdc590 --- /dev/null +++ b/purchase_force_invoiced_quantity/demo/demo_product.xml @@ -0,0 +1,14 @@ + + + + Purchase Force Invoiced qty product 1 + service + receive + + + + Purchase Force Invoiced qty product 2 + service + receive + + diff --git a/purchase_force_invoiced_quantity/demo/demo_purchase_order.xml b/purchase_force_invoiced_quantity/demo/demo_purchase_order.xml new file mode 100644 index 00000000000..85e52414710 --- /dev/null +++ b/purchase_force_invoiced_quantity/demo/demo_purchase_order.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + 5 + 3 + 295.00 + + + + + + 5 + 0 + 145.00 + + diff --git a/purchase_force_invoiced_quantity/i18n/it.po b/purchase_force_invoiced_quantity/i18n/it.po new file mode 100644 index 00000000000..ade4cd2b4f9 --- /dev/null +++ b/purchase_force_invoiced_quantity/i18n/it.po @@ -0,0 +1,56 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_force_invoiced_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-09-16 10:20+0000\n" +"Last-Translator: mymage \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: purchase_force_invoiced_quantity +#: model:ir.model.fields,field_description:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "Force Invoiced Qty" +msgstr "Forza q.tà fatturata" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_1_product_template +msgid "Purchase Force Invoiced qty product 1" +msgstr "Quantità fatturazione formzata acquisto prodotto 1" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_2_product_template +msgid "Purchase Force Invoiced qty product 2" +msgstr "Quantità fatturazione formzata acquisto prodotto 2" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model,name:purchase_force_invoiced_quantity.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "Riga ordine di acquisto" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model.fields,help:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "" +"This amount will be deducted from quantity to invoice.\n" +"quantity to invoice = delivered - invoiced - force invoiced qty" +msgstr "" +"Questo valore verrà dedotto dalla quantità da fatturare.\n" +"quantità da fatturare = consegnata - fatturata - forzata a fatturata" + +#~ msgid "Force Invoiced" +#~ msgstr "Forza a fatturato" + +#~ msgid "" +#~ "This amount will be deducted from quantity to invoice.\n" +#~ "quantity to invoice = delivered - invoiced - force invoiced" +#~ msgstr "" +#~ "Questo valore verrà dedotto dalla quantità da fatturare.\n" +#~ "quantità da fatturare = consegnata - fatturata - forzata a fatturata" diff --git a/purchase_force_invoiced_quantity/i18n/pt_BR.po b/purchase_force_invoiced_quantity/i18n/pt_BR.po new file mode 100644 index 00000000000..f41dff316e1 --- /dev/null +++ b/purchase_force_invoiced_quantity/i18n/pt_BR.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_force_invoiced_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_BR\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" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model.fields,field_description:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "Force Invoiced Qty" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_1_product_template +msgid "Purchase Force Invoiced qty product 1" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_2_product_template +msgid "Purchase Force Invoiced qty product 2" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model,name:purchase_force_invoiced_quantity.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model.fields,help:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "" +"This amount will be deducted from quantity to invoice.\n" +"quantity to invoice = delivered - invoiced - force invoiced qty" +msgstr "" diff --git a/purchase_force_invoiced_quantity/i18n/purchase_force_invoiced_quantity.pot b/purchase_force_invoiced_quantity/i18n/purchase_force_invoiced_quantity.pot new file mode 100644 index 00000000000..133a23c10ab --- /dev/null +++ b/purchase_force_invoiced_quantity/i18n/purchase_force_invoiced_quantity.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_force_invoiced_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.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: purchase_force_invoiced_quantity +#: model:ir.model.fields,field_description:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "Force Invoiced Qty" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_1_product_template +msgid "Purchase Force Invoiced qty product 1" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:product.template,name:purchase_force_invoiced_quantity.demo_product_purchase_force_invoiced_qty_2_product_template +msgid "Purchase Force Invoiced qty product 2" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model,name:purchase_force_invoiced_quantity.model_purchase_order_line +msgid "Purchase Order Line" +msgstr "" + +#. module: purchase_force_invoiced_quantity +#: model:ir.model.fields,help:purchase_force_invoiced_quantity.field_purchase_order_line__force_invoiced_qty +msgid "" +"This amount will be deducted from quantity to invoice.\n" +"quantity to invoice = delivered - invoiced - force invoiced qty" +msgstr "" diff --git a/purchase_force_invoiced_quantity/models/__init__.py b/purchase_force_invoiced_quantity/models/__init__.py new file mode 100644 index 00000000000..a8311a30fe4 --- /dev/null +++ b/purchase_force_invoiced_quantity/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import purchase_order_line diff --git a/purchase_force_invoiced_quantity/models/purchase_order_line.py b/purchase_force_invoiced_quantity/models/purchase_order_line.py new file mode 100644 index 00000000000..b1ae9b8fe35 --- /dev/null +++ b/purchase_force_invoiced_quantity/models/purchase_order_line.py @@ -0,0 +1,33 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class PurchaseOrderLine(models.Model): + _inherit = "purchase.order.line" + + force_invoiced_qty = fields.Float( + digits="Product Unit of Measure", + help=( + "This amount will be deducted from quantity to invoice." + "\nquantity to invoice = delivered - invoiced - force invoiced qty" + ), + ) + + @api.depends("force_invoiced_qty") + def _compute_qty_invoiced(self): + """ + Compute the quantity to invoice. + """ + res = super()._compute_qty_invoiced() + for line in self.filtered(lambda line: line.force_invoiced_qty): + # compute qty_to_invoice + if ( + line.order_id.state in ["purchase", "done"] + and line.product_id.purchase_method != "purchase" + ): + line.qty_to_invoice = ( + line.qty_received - line.qty_invoiced - line.force_invoiced_qty + ) + return res diff --git a/purchase_force_invoiced_quantity/pyproject.toml b/purchase_force_invoiced_quantity/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/purchase_force_invoiced_quantity/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/purchase_force_invoiced_quantity/readme/CONFIGURE.md b/purchase_force_invoiced_quantity/readme/CONFIGURE.md new file mode 100644 index 00000000000..718c4a6561b --- /dev/null +++ b/purchase_force_invoiced_quantity/readme/CONFIGURE.md @@ -0,0 +1 @@ +No configuration is required. diff --git a/purchase_force_invoiced_quantity/readme/CONTEXT.md b/purchase_force_invoiced_quantity/readme/CONTEXT.md new file mode 100644 index 00000000000..df073504dfb --- /dev/null +++ b/purchase_force_invoiced_quantity/readme/CONTEXT.md @@ -0,0 +1,10 @@ +This module implements additional featured for the [Purchase Force +Invoiced](https://github.com/OCA/purchase-workflow/tree/16.0/purchase_force_invoiced) +module. + +It covers the following scenarios: + +- One need to modify the quantity to be invoiced after the products were + received. Eg .you negotiated an extra discount from your vendor. +- You would like to fix some issues with quantities invoiced cause by + incorrect data entry. diff --git a/purchase_force_invoiced_quantity/readme/CONTRIBUTORS.md b/purchase_force_invoiced_quantity/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..57151c789c9 --- /dev/null +++ b/purchase_force_invoiced_quantity/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- [Cetmix](http://cetmix.com) + +> - Ivan Sokolov +> - Dessan Hemrayev + +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/purchase_force_invoiced_quantity/readme/DESCRIPTION.md b/purchase_force_invoiced_quantity/readme/DESCRIPTION.md new file mode 100644 index 00000000000..91ca74107e5 --- /dev/null +++ b/purchase_force_invoiced_quantity/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module add a new "Force Invoiced" field to purchase order lines. +This field is used as modifier when computing quantity to be invoiced. + +Current behaviour: quantity to invoice = delivered - invoiced + +Implemented behaviour: quantity to invoice = delivered - invoiced - +force invoiced diff --git a/purchase_force_invoiced_quantity/readme/USAGE.md b/purchase_force_invoiced_quantity/readme/USAGE.md new file mode 100644 index 00000000000..04c404e4837 --- /dev/null +++ b/purchase_force_invoiced_quantity/readme/USAGE.md @@ -0,0 +1,3 @@ +Open a purchase order and add an amount into the "Force Invoiced" field. +Amount to invoice will be adjusted accordingly. This field is optional +so you can hide it if you don't need it. diff --git a/purchase_force_invoiced_quantity/static/description/icon.png b/purchase_force_invoiced_quantity/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/purchase_force_invoiced_quantity/static/description/icon.png differ diff --git a/purchase_force_invoiced_quantity/static/description/index.html b/purchase_force_invoiced_quantity/static/description/index.html new file mode 100644 index 00000000000..2a2a32beb55 --- /dev/null +++ b/purchase_force_invoiced_quantity/static/description/index.html @@ -0,0 +1,472 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Purchase Force Invoiced Quantity

+ +

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

+

This module add a new “Force Invoiced” field to purchase order lines. +This field is used as modifier when computing quantity to be invoiced.

+

Current behaviour: quantity to invoice = delivered - invoiced

+

Implemented behaviour: quantity to invoice = delivered - invoiced - +force invoiced

+

Table of contents

+ +
+

Use Cases / Context

+

This module implements additional featured for the Purchase Force +Invoiced +module.

+

It covers the following scenarios:

+
    +
  • One need to modify the quantity to be invoiced after the products were +received. Eg .you negotiated an extra discount from your vendor.
  • +
  • You would like to fix some issues with quantities invoiced cause by +incorrect data entry.
  • +
+
+
+

Configuration

+

No configuration is required.

+
+
+

Usage

+

Open a purchase order and add an amount into the “Force Invoiced” field. +Amount to invoice will be adjusted accordingly. This field is optional +so you can hide it if you don’t need it.

+
+
+

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

+ + +
+
    +
  • 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/purchase-workflow project on GitHub.

+

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

+
+
+
+
+ + diff --git a/purchase_force_invoiced_quantity/tests/__init__.py b/purchase_force_invoiced_quantity/tests/__init__.py new file mode 100644 index 00000000000..0f68af56584 --- /dev/null +++ b/purchase_force_invoiced_quantity/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_purchase_force_invoiced_quantity diff --git a/purchase_force_invoiced_quantity/tests/test_purchase_force_invoiced_quantity.py b/purchase_force_invoiced_quantity/tests/test_purchase_force_invoiced_quantity.py new file mode 100644 index 00000000000..70a8fc1b6a0 --- /dev/null +++ b/purchase_force_invoiced_quantity/tests/test_purchase_force_invoiced_quantity.py @@ -0,0 +1,47 @@ +# Copyright (C) 2024 Cetmix OÜ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +class TestPurchaseForceInvoicedQTY(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + + cls.purchase_order_obj = cls.env["purchase.order"] + cls.purchase_order_line_obj = cls.env["purchase.order.line"] + + cls.customer = cls.partner_a + cls.product_1 = cls.product_a + cls.product_2 = cls.product_b + (cls.product_1 | cls.product_2).write({"purchase_method": "receive"}) + + def test_purchase_order(self): + po = self.purchase_order_obj.create({"partner_id": self.customer.id}) + pol1 = self.purchase_order_line_obj.create( + {"product_id": self.product_1.id, "product_qty": 3, "order_id": po.id} + ) + pol2 = self.purchase_order_line_obj.create( + {"product_id": self.product_2.id, "product_qty": 2, "order_id": po.id} + ) + + # confirm quotation + po.button_confirm() + # update quantities delivered + pol1.qty_received = 1 + pol2.qty_received = 2 + + pol2.force_invoiced_qty = 3 + self.assertEqual( + pol2.qty_to_invoice, -1, msg="The quantity to invoice should be -1" + ) + self.assertEqual( + po.invoice_status, "to invoice", "The invoice status should be To Invoice" + ) + + po.action_create_invoice() + self.assertEqual( + po.invoice_status, "invoiced", "The invoice status should be Invoiced" + ) diff --git a/purchase_force_invoiced_quantity/views/purchase_order.xml b/purchase_force_invoiced_quantity/views/purchase_order.xml new file mode 100644 index 00000000000..f613dd3928f --- /dev/null +++ b/purchase_force_invoiced_quantity/views/purchase_order.xml @@ -0,0 +1,22 @@ + + + + purchase.order.form + purchase.order + + + + + + + + +