From e6ffa233bb4cfff8f1a17327737f930769702c83 Mon Sep 17 00:00:00 2001 From: Guillaume MASSON Date: Fri, 13 Dec 2024 18:19:08 +0100 Subject: [PATCH] [ADD] test_purchase_sale_stock_dropshipping_inter_company : new module for tests Add tests for purchase_sale_stock_dropshipping_inter_company when drop shipping is installed Refactor purchase_sale_inter_company to allow inheritance --- .../tests/test_inter_company_purchase_sale.py | 4 +- ...hase_sale_stock_dropshipping_inter_company | 1 + .../setup.py | 6 + .../README.rst | 69 +++ .../__init__.py | 3 + .../__manifest__.py | 17 + .../readme/DESCRIPTION.rst | 4 + .../static/description/icon.png | Bin 0 -> 3735 bytes .../static/description/index.html | 411 ++++++++++++++++++ .../tests/__init__.py | 5 + ...ompany_purchase_sale_stock_dropshipping.py | 89 ++++ 11 files changed, 608 insertions(+), 1 deletion(-) create mode 120000 setup/test_purchase_sale_stock_dropshipping_inter_company/odoo/addons/test_purchase_sale_stock_dropshipping_inter_company create mode 100644 setup/test_purchase_sale_stock_dropshipping_inter_company/setup.py create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/README.rst create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/__init__.py create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/__manifest__.py create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/readme/DESCRIPTION.rst create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/static/description/icon.png create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/static/description/index.html create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/tests/__init__.py create mode 100644 test_purchase_sale_stock_dropshipping_inter_company/tests/test_inter_company_purchase_sale_stock_dropshipping.py diff --git a/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py index 8c51f9415fc..2221b5a4623 100644 --- a/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py +++ b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py @@ -11,7 +11,7 @@ ) -class TestPurchaseSaleInterCompany(TestAccountInvoiceInterCompanyBase): +class TestPurchaseSaleInterCompanyBase(TestAccountInvoiceInterCompanyBase): @classmethod def _configure_user(cls, user): for xml in [ @@ -89,6 +89,8 @@ def _approve_po(self): .search([("auto_purchase_order_id", "=", self.purchase_company_a.id)]) ) + +class TestPurchaseSaleInterCompany(TestPurchaseSaleInterCompanyBase): def test_purchase_sale_inter_company(self): self.purchase_company_a.notes = "Test note" sale = self._approve_po() diff --git a/setup/test_purchase_sale_stock_dropshipping_inter_company/odoo/addons/test_purchase_sale_stock_dropshipping_inter_company b/setup/test_purchase_sale_stock_dropshipping_inter_company/odoo/addons/test_purchase_sale_stock_dropshipping_inter_company new file mode 120000 index 00000000000..35dfef1c022 --- /dev/null +++ b/setup/test_purchase_sale_stock_dropshipping_inter_company/odoo/addons/test_purchase_sale_stock_dropshipping_inter_company @@ -0,0 +1 @@ +../../../../test_purchase_sale_stock_dropshipping_inter_company \ No newline at end of file diff --git a/setup/test_purchase_sale_stock_dropshipping_inter_company/setup.py b/setup/test_purchase_sale_stock_dropshipping_inter_company/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/test_purchase_sale_stock_dropshipping_inter_company/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/test_purchase_sale_stock_dropshipping_inter_company/README.rst b/test_purchase_sale_stock_dropshipping_inter_company/README.rst new file mode 100644 index 00000000000..23b4a98ae97 --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/README.rst @@ -0,0 +1,69 @@ +================================================================================= +Test Inter Company Module from Purchase to Sale Order with Warehouse and Dropship +================================================================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:06f08f9f770c6fa70a6c80e1adbff5eea334313523e5def11b963a7c74715a31 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmulti--company-lightgray.png?logo=github + :target: https://github.com/OCA/multi-company/tree/16.0/test_purchase_sale_stock_dropshipping_inter_company + :alt: OCA/multi-company +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/multi-company-16-0/multi-company-16-0-test_purchase_sale_stock_dropshipping_inter_company + :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/multi-company&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon is not meant to be installed, except for running the tests. + +The basic tests are integrated within the ``purchase_sale_stock_inter_company`` addon. +This addon extends tests to Drop Shipping + +**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 +======= + +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/multi-company `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/test_purchase_sale_stock_dropshipping_inter_company/__init__.py b/test_purchase_sale_stock_dropshipping_inter_company/__init__.py new file mode 100644 index 00000000000..52f4f2dd0ad --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/__init__.py @@ -0,0 +1,3 @@ +# Copyright (c) 2024 Groupe Voltaire +# @author Guillaume MASSON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/test_purchase_sale_stock_dropshipping_inter_company/__manifest__.py b/test_purchase_sale_stock_dropshipping_inter_company/__manifest__.py new file mode 100644 index 00000000000..6b2ebdfc2c9 --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Groupe Voltaire +# @author Guillaume MASSON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Test Inter Company Module from Purchase to Sale Order with Warehouse and Dropship", + "summary": "Test Inter Company PO/SO rules with Warehouse and Drop Shipping", + "version": "16.0.1.0.0", + "category": "Hidden/Tests", + "website": "https://github.com/OCA/multi-company", + "author": "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "auto_install": False, + "depends": ["purchase_sale_stock_inter_company", "stock_dropshipping"], + "data": [], +} diff --git a/test_purchase_sale_stock_dropshipping_inter_company/readme/DESCRIPTION.rst b/test_purchase_sale_stock_dropshipping_inter_company/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..7454911c272 --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This addon is not meant to be installed, except for running the tests. + +The basic tests are integrated within the ``purchase_sale_stock_inter_company`` addon. +This addon extends tests to Drop Shipping diff --git a/test_purchase_sale_stock_dropshipping_inter_company/static/description/icon.png b/test_purchase_sale_stock_dropshipping_inter_company/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b3de330666df26b26f9648d86c9f12b1dc6fc699 GIT binary patch literal 3735 zcmV;I4ruX-P)>L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bDP4^lP<(*C%gspmK2+txzXb27A`DF+Vp&>lK451-3gy)xp@QS_s@4b4W zB-6Y5&*!F*Nk+&U`r*C4fR90+STe$^b2sX!k`jKnxO&AiBqhAMdidO`bGIC-210<& z-Eyc5p&`6{8A3yN`7(rt@bYB{4dLa>5dI$%YW)1cdG+RfN5YG&t4a0H4e|X8Ds+6h z>QGj@dND-|BO@atBO@atBO@atBO@atBcoqd{{y!1^S?QmT?POE002ovPDHLkV1n&) BKy?5B literal 0 HcmV?d00001 diff --git a/test_purchase_sale_stock_dropshipping_inter_company/static/description/index.html b/test_purchase_sale_stock_dropshipping_inter_company/static/description/index.html new file mode 100644 index 00000000000..461cbf608f7 --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/static/description/index.html @@ -0,0 +1,411 @@ + + + + + +Test Inter Company Module from Purchase to Sale Order with Warehouse and Dropship + + + +
+

Test Inter Company Module from Purchase to Sale Order with Warehouse and Dropship

+ + +

Beta License: AGPL-3 OCA/multi-company Translate me on Weblate Try me on Runboat

+

This addon is not meant to be installed, except for running the tests.

+

The basic tests are integrated within the purchase_sale_stock_inter_company addon. +This addon extends tests to Drop Shipping

+

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

+
+

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/multi-company project on GitHub.

+

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

+
+
+
+ + diff --git a/test_purchase_sale_stock_dropshipping_inter_company/tests/__init__.py b/test_purchase_sale_stock_dropshipping_inter_company/tests/__init__.py new file mode 100644 index 00000000000..88899c8a9e6 --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/tests/__init__.py @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Groupe Voltaire +# @author Guillaume MASSON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_inter_company_purchase_sale_stock_dropshipping diff --git a/test_purchase_sale_stock_dropshipping_inter_company/tests/test_inter_company_purchase_sale_stock_dropshipping.py b/test_purchase_sale_stock_dropshipping_inter_company/tests/test_inter_company_purchase_sale_stock_dropshipping.py new file mode 100644 index 00000000000..27331a9a1df --- /dev/null +++ b/test_purchase_sale_stock_dropshipping_inter_company/tests/test_inter_company_purchase_sale_stock_dropshipping.py @@ -0,0 +1,89 @@ +# Copyright (c) 2024 Groupe Voltaire +# @author Guillaume MASSON +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import Command +from odoo.tests.common import Form + +from odoo.addons.purchase_sale_inter_company.tests.test_inter_company_purchase_sale import ( + TestPurchaseSaleInterCompanyBase, +) + + +class TestPurchaseSaleStockDropShippingInterCompany(TestPurchaseSaleInterCompanyBase): + def test_purchase_sale_stock_drop_shipping_inter_company(self): + self.external_supplier = self.env["res.partner"].create({"name": "Supplier"}) + self.external_customer = self.env["res.partner"].create({"name": "Customer"}) + self.dropship_route = self.env.ref("stock_dropshipping.route_drop_shipping") + self.dropship_product = self.env["product.product"].create( + [ + { + "name": "Dropship product", + "type": "product", + "route_ids": [Command.link(self.dropship_route.id)], + "seller_ids": [ + Command.create( + { + "partner_id": self.partner_company_b.id, + "min_qty": 0, + "delay": 5, + "company_id": self.company_a.id, + } + ), + Command.create( + { + "partner_id": self.external_supplier.id, + "min_qty": 5, + "delay": 1, + "company_id": self.company_b.id, + } + ), + ], + } + ] + ) + + original_sale_form = Form( + self.env["sale.order"] + .with_company(self.company_a) + .with_user(self.user_company_a) + ) + original_sale_form.partner_id = self.external_customer + + with original_sale_form.order_line.new() as line_form: + line_form.product_id = self.dropship_product + line_form.product_uom_qty = 5.0 + line_form.price_unit = 100.0 + original_sale = original_sale_form.save() + + original_sale.action_confirm() + inter_company_po = original_sale._get_purchase_orders() + inter_company_po.button_confirm() + inter_company_so = ( + self.env["sale.order"] + .with_user(self.user_company_b) + .search([("auto_purchase_order_id", "=", inter_company_po.id)]) + ) + external_po = inter_company_so._get_purchase_orders() + external_po.button_confirm() + external_po.picking_ids.move_ids.quantity_done = 3.0 + backorder_wizard_dict = external_po.picking_ids.button_validate() + backorder_wizard = Form( + self.env[backorder_wizard_dict["res_model"]].with_context( + **backorder_wizard_dict["context"] + ) + ).save() + backorder_wizard.process() + self.assertEqual(inter_company_so.order_line.qty_delivered, 3.0) + self.assertEqual(original_sale.order_line.qty_delivered, 3.0) + backorder = external_po.picking_ids.backorder_ids + backorder.move_ids.quantity_done = backorder.move_ids.product_qty + backorder.button_validate() + self.assertEqual( + inter_company_so.order_line.qty_delivered, + inter_company_so.order_line.product_uom_qty, + ) + self.assertEqual( + original_sale.order_line.qty_delivered, + original_sale.order_line.product_uom_qty, + )