From 8ff69d4fc8356bee08bfb05523b16e11c0ad012f Mon Sep 17 00:00:00 2001 From: Lukas Tran Date: Fri, 1 Nov 2024 16:45:56 +0700 Subject: [PATCH] [MIG] account_invoice_section_sale_order: Migration to 18.0 --- account_invoice_section_sale_order/README.rst | 29 +++++++-------- .../__manifest__.py | 2 +- .../readme/CONTRIBUTORS.md | 1 + .../static/description/index.html | 7 ++-- .../tests/common.py | 9 +++-- .../tests/test_invoice_group_by_sale_order.py | 35 +++++++------------ 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/account_invoice_section_sale_order/README.rst b/account_invoice_section_sale_order/README.rst index 2c11ab99c7e..9efb05f04cc 100644 --- a/account_invoice_section_sale_order/README.rst +++ b/account_invoice_section_sale_order/README.rst @@ -17,13 +17,13 @@ Acccount Invoice Section Sale Order :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--invoicing-lightgray.png?logo=github - :target: https://github.com/OCA/account-invoicing/tree/17.0/account_invoice_section_sale_order + :target: https://github.com/OCA/account-invoicing/tree/18.0/account_invoice_section_sale_order :alt: OCA/account-invoicing .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_invoice_section_sale_order + :target: https://translation.odoo-community.org/projects/account-invoicing-18-0/account-invoicing-18-0-account_invoice_section_sale_order :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-invoicing&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -63,26 +63,27 @@ Authors Contributors ------------ -- `Camptocamp `__ +- `Camptocamp `__ - - Thierry Ducrest - - Hiep Nguyen Hoang + - Thierry Ducrest + - Hiep Nguyen Hoang + - Nhan Tran -- `Dynapps `__ +- `Dynapps `__ - - Jeroen Evens - - Raf Ven + - Jeroen Evens + - Raf Ven -- `NICO SOLUTIONS `__ +- `NICO SOLUTIONS `__ - - Nils Coenen + - Nils Coenen Other credits ------------- The development of this module has been financially supported by: -- Camptocamp +- Camptocamp Maintainers ----------- @@ -97,6 +98,6 @@ 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-invoicing `_ project on GitHub. +This module is part of the `OCA/account-invoicing `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_invoice_section_sale_order/__manifest__.py b/account_invoice_section_sale_order/__manifest__.py index 63742c794b6..262b93f7e5e 100644 --- a/account_invoice_section_sale_order/__manifest__.py +++ b/account_invoice_section_sale_order/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Acccount Invoice Section Sale Order", - "version": "17.0.2.0.0", + "version": "18.0.1.0.0", "summary": "For invoices targetting multiple sale order add" "sections with sale order name.", "author": "Camptocamp, Odoo Community Association (OCA)", diff --git a/account_invoice_section_sale_order/readme/CONTRIBUTORS.md b/account_invoice_section_sale_order/readme/CONTRIBUTORS.md index 6af2d6a7ba5..fb7f39105b0 100644 --- a/account_invoice_section_sale_order/readme/CONTRIBUTORS.md +++ b/account_invoice_section_sale_order/readme/CONTRIBUTORS.md @@ -1,6 +1,7 @@ - [Camptocamp](https://www.camptocamp.com) - Thierry Ducrest \<\> - Hiep Nguyen Hoang \<\> + - Nhan Tran \<\> - [Dynapps](https://www.dynapps.eu) - Jeroen Evens - Raf Ven diff --git a/account_invoice_section_sale_order/static/description/index.html b/account_invoice_section_sale_order/static/description/index.html index ebec976cd94..35520d54fbe 100644 --- a/account_invoice_section_sale_order/static/description/index.html +++ b/account_invoice_section_sale_order/static/description/index.html @@ -369,7 +369,7 @@

Acccount Invoice Section Sale Order

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:cda83a22f718e3acd31993bc22376dede8661afffa5b7eec0e166dc8f3430bad !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

When invoicing multiple sale orders at the same time, sale orders may be grouped by customer into a single invoice. Unfortunately when this happens, it is hard to know which invoice line belongs to which sale @@ -395,7 +395,7 @@

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.

+feedback.

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

@@ -412,6 +412,7 @@

Contributors

  • Camptocamp
  • Dynapps
  • diff --git a/account_invoice_section_sale_order/tests/common.py b/account_invoice_section_sale_order/tests/common.py index 24991186231..d11586c5628 100644 --- a/account_invoice_section_sale_order/tests/common.py +++ b/account_invoice_section_sale_order/tests/common.py @@ -1,9 +1,9 @@ from odoo.tests import tagged -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase @tagged("-at_install", "post_install") -class Common(SavepointCase): +class Common(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -17,12 +17,16 @@ def setUpClassOrder(cls): cls.product_2 = cls.env.ref("product.product_product_2") cls.product_1.invoice_policy = "order" cls.product_2.invoice_policy = "order" + cls.pricelist = cls.env["product.pricelist"].create( + {"name": "Europe pricelist", "currency_id": cls.env.ref("base.EUR").id} + ) cls.order1_p1 = cls.env["sale.order"].create( { "partner_id": cls.partner_1.id, "partner_shipping_id": cls.partner_1.id, "partner_invoice_id": cls.partner_1.id, "client_order_ref": "ref123", + "pricelist_id": cls.pricelist.id, "order_line": [ ( 0, @@ -55,6 +59,7 @@ def setUpClassOrder(cls): "partner_id": cls.partner_1.id, "partner_shipping_id": cls.partner_1.id, "partner_invoice_id": cls.partner_1.id, + "pricelist_id": cls.pricelist.id, "order_line": [ ( 0, diff --git a/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py b/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py index ce0517c1e37..1fadc7e00d5 100644 --- a/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py +++ b/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py @@ -1,6 +1,6 @@ # Copyright 2020 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -import mock +from unittest import mock from odoo.exceptions import UserError @@ -20,18 +20,14 @@ def test_create_invoice(self): "".join([self.order1_p1.name, " - ", self.order1_p1.client_order_ref]), "line_section", ), - 20: ("order 1 line 1", False), - 30: ("order 1 line 2", False), + 20: (f"{self.product_1.name} order 1 line 1", "product"), + 30: (f"{self.product_2.name} order 1 line 2", "product"), 40: (self.order2_p1.name, "line_section"), - 50: ("order 2 line 1", False), - 60: ("order 2 line 2", False), + 50: (f"{self.product_1.name} order 2 line 1", "product"), + 60: (f"{self.product_2.name} order 2 line 2", "product"), } invoice_ids = (self.order1_p1 + self.order2_p1)._create_invoices() - lines = ( - invoice_ids[0] - .line_ids.sorted("sequence") - .filtered(lambda r: not r.exclude_from_invoice_tab) - ) + lines = invoice_ids[0].invoice_line_ids.sorted("sequence") for line in lines: if line.sequence not in result: continue @@ -40,14 +36,9 @@ def test_create_invoice(self): def test_create_invoice_with_currency(self): """Check invoice is generated with a correct total amount""" - eur = self.env.ref("base.EUR") - pricelist = self.env["product.pricelist"].create( - {"name": "Europe pricelist", "currency_id": eur.id} - ) orders = self.order1_p1 | self.order2_p1 - orders.write({"pricelist_id": pricelist.id}) invoices = orders._create_invoices() - self.assertEqual(invoices.amount_total, 80) + self.assertEqual(invoices.amount_untaxed, 80) def test_create_invoice_with_default_journal(self): """Using a specific journal for the invoice should not be broken""" @@ -108,13 +99,13 @@ def test_custom_grouping_by_sale_order_user(self): invoice = (orders + sale_order_3)._create_invoices() result = { 10: ("Mocked value from ResUsers", "line_section"), - 20: ("order 1 line 1", False), - 30: ("order 1 line 2", False), - 40: ("order 2 line 1", False), - 50: ("order 2 line 2", False), + 20: (f"{self.product_1.name} order 1 line 1", "product"), + 30: (f"{self.product_2.name} order 1 line 2", "product"), + 40: (f"{self.product_1.name} order 2 line 1", "product"), + 50: (f"{self.product_2.name} order 2 line 2", "product"), 60: ("Mocked value from ResUsers", "line_section"), - 70: ("order 3 line 1", False), - 80: ("order 3 line 2", False), + 70: (f"{self.product_1.name} order 3 line 1", "product"), + 80: (f"{self.product_2.name} order 3 line 2", "product"), } for line in invoice.invoice_line_ids.sorted("sequence"): if line.sequence not in result: