diff --git a/sale_invoice_split_payment/README.rst b/sale_invoice_split_payment/README.rst new file mode 100644 index 00000000000..39fa42744f0 --- /dev/null +++ b/sale_invoice_split_payment/README.rst @@ -0,0 +1,107 @@ +========================== +Sale Invoice Split Payment +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:18638e065d302d088c58f6753cdb0960606c370d9a18bc96459c9f70227eea6b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/sale_invoice_split_payment + :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-16-0/sale-workflow-16-0-sale_invoice_split_payment + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module takes payment terms into account when invoicing. In this +way, two invoices with the same data but different payment terms will be +invoiced separately. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +- Go to Sales > Orders > Quotations + +- Create a quotation. Set a customer, a product and a payment term. + +- Confirm the quotation. + +- Create a second quotation with the same data as above and set a + different payment term. + +- Confirm the second quotation. + +- Go back to the Quotations list view and select the two newly created + sales orders. + +- Click on the Action button and select Create Invoices. + +- In the wizard click on Create and View Invoice. + +- Even though both quotations have almost the same data, the invoicing + has been split into two invoices because they have different payment + terms. + +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 +------- + +* Dixmit + +Contributors +------------ + +- `Dixmit `__: + + - Luis Rodríguez + +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_invoice_split_payment/__init__.py b/sale_invoice_split_payment/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_invoice_split_payment/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_invoice_split_payment/__manifest__.py b/sale_invoice_split_payment/__manifest__.py new file mode 100644 index 00000000000..532434a27da --- /dev/null +++ b/sale_invoice_split_payment/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Invoice Split Payment", + "summary": """Split by payment term generated invoices from sale orders""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/sale-workflow", + "depends": [ + "sale", + ], + "data": [], + "demo": [], +} diff --git a/sale_invoice_split_payment/models/__init__.py b/sale_invoice_split_payment/models/__init__.py new file mode 100644 index 00000000000..6aacb753131 --- /dev/null +++ b/sale_invoice_split_payment/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/sale_invoice_split_payment/models/sale_order.py b/sale_invoice_split_payment/models/sale_order.py new file mode 100644 index 00000000000..2562d21efbb --- /dev/null +++ b/sale_invoice_split_payment/models/sale_order.py @@ -0,0 +1,15 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def _get_invoice_grouping_keys(self): + res = super()._get_invoice_grouping_keys() + if "invoice_payment_term_id" not in res: + res.append("invoice_payment_term_id") + + return res diff --git a/sale_invoice_split_payment/readme/CONTRIBUTORS.md b/sale_invoice_split_payment/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..d428846a780 --- /dev/null +++ b/sale_invoice_split_payment/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Dixmit](https://www.dixmit.com): + - Luis Rodríguez diff --git a/sale_invoice_split_payment/readme/DESCRIPTION.md b/sale_invoice_split_payment/readme/DESCRIPTION.md new file mode 100644 index 00000000000..e4e1ea432a2 --- /dev/null +++ b/sale_invoice_split_payment/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module takes payment terms into account when invoicing. In this way, two invoices with the same data but different payment terms will be invoiced separately. diff --git a/sale_invoice_split_payment/readme/USAGE.md b/sale_invoice_split_payment/readme/USAGE.md new file mode 100644 index 00000000000..0a4a73bc70b --- /dev/null +++ b/sale_invoice_split_payment/readme/USAGE.md @@ -0,0 +1,19 @@ +To use this module, you need to: + +- Go to Sales > Orders > Quotations + +- Create a quotation. Set a customer, a product and a payment term. + +- Confirm the quotation. + +- Create a second quotation with the same data as above and set a different payment term. + +- Confirm the second quotation. + +- Go back to the Quotations list view and select the two newly created sales orders. + +- Click on the Action button and select Create Invoices. + +- In the wizard click on Create and View Invoice. + +- Even though both quotations have almost the same data, the invoicing has been split into two invoices because they have different payment terms. diff --git a/sale_invoice_split_payment/static/description/icon.png b/sale_invoice_split_payment/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_invoice_split_payment/static/description/icon.png differ diff --git a/sale_invoice_split_payment/static/description/index.html b/sale_invoice_split_payment/static/description/index.html new file mode 100644 index 00000000000..e74e8abca92 --- /dev/null +++ b/sale_invoice_split_payment/static/description/index.html @@ -0,0 +1,448 @@ + + + + + +Sale Invoice Split Payment + + + +
+

Sale Invoice Split Payment

+ + +

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

+

This module takes payment terms into account when invoicing. In this +way, two invoices with the same data but different payment terms will be +invoiced separately.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • Go to Sales > Orders > Quotations
  • +
  • Create a quotation. Set a customer, a product and a payment term.
  • +
  • Confirm the quotation.
  • +
  • Create a second quotation with the same data as above and set a +different payment term.
  • +
  • Confirm the second quotation.
  • +
  • Go back to the Quotations list view and select the two newly created +sales orders.
  • +
  • Click on the Action button and select Create Invoices.
  • +
  • In the wizard click on Create and View Invoice.
  • +
  • Even though both quotations have almost the same data, the invoicing +has been split into two invoices because they have different payment +terms.
  • +
+
+
+

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

+
    +
  • Dixmit
  • +
+
+
+

Contributors

+
    +
  • Dixmit:
      +
    • Luis Rodríguez
    • +
    +
  • +
+
+
+

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_invoice_split_payment/tests/__init__.py b/sale_invoice_split_payment/tests/__init__.py new file mode 100644 index 00000000000..6f699d0d8ba --- /dev/null +++ b/sale_invoice_split_payment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order diff --git a/sale_invoice_split_payment/tests/test_sale_order.py b/sale_invoice_split_payment/tests/test_sale_order.py new file mode 100644 index 00000000000..b2ce7461f6f --- /dev/null +++ b/sale_invoice_split_payment/tests/test_sale_order.py @@ -0,0 +1,111 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestSaleOrer(TransactionCase): + def setUp(self): + super().setUp() + self.partner = self.env["res.partner"].create( + { + "name": "Test Partner", + } + ) + + self.product = self.env["product.product"].create( + { + "name": "Test Product", + "type": "service", + "list_price": 100, + } + ) + + self.payment_term_id = self.env["account.payment.term"].create( + { + "name": "Test Payment Term", + "line_ids": [ + ( + 0, + 0, + { + "value": "balance", + "days": 15, + }, + ), + ], + } + ) + + self.payment_term_id2 = self.env["account.payment.term"].create( + { + "name": "Test Payment Term 2", + "line_ids": [ + ( + 0, + 0, + { + "value": "balance", + "days": 30, + }, + ), + ], + } + ) + + def test_sale_order(self): + + sale_order1 = self.env["sale.order"].create( + { + "partner_id": self.partner.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": self.product.id, + "product_uom_qty": 1, + "price_unit": 100, + }, + ), + ], + "payment_term_id": self.payment_term_id.id, + } + ) + + sale_order2 = self.env["sale.order"].create( + { + "partner_id": self.partner.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": self.product.id, + "product_uom_qty": 1, + "price_unit": 100, + }, + ), + ], + "payment_term_id": self.payment_term_id2.id, + } + ) + + sale_order1.action_confirm() + sale_order2.action_confirm() + + wizard = ( + self.env["sale.advance.payment.inv"] + .with_context(active_ids=[sale_order1.id, sale_order2.id]) + .create({}) + ) + + wizard.create_invoices() + + invoices = self.env["account.move"].search( + [ + ("partner_id", "=", self.partner.id), + ] + ) + + self.assertEqual(len(invoices), 2) diff --git a/setup/sale_invoice_split_payment/odoo/addons/sale_invoice_split_payment b/setup/sale_invoice_split_payment/odoo/addons/sale_invoice_split_payment new file mode 120000 index 00000000000..080c609a714 --- /dev/null +++ b/setup/sale_invoice_split_payment/odoo/addons/sale_invoice_split_payment @@ -0,0 +1 @@ +../../../../sale_invoice_split_payment \ No newline at end of file diff --git a/setup/sale_invoice_split_payment/setup.py b/setup/sale_invoice_split_payment/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/sale_invoice_split_payment/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)