From a9085f2e86930b8998c3a3b5eb52e3056de6d2ce Mon Sep 17 00:00:00 2001 From: Ruchir Shukla Date: Sun, 10 Nov 2024 18:38:36 +0530 Subject: [PATCH] [MIG][17.0] product_configurator_sale:Migration to 17.0 --- product_configurator_sale/__manifest__.py | 2 +- product_configurator_sale/tests/__init__.py | 2 +- product_configurator_sale/tests/test_sale.py | 22 +++++++++++++++---- .../tests/test_sale_order_line.py | 4 +++- product_configurator_sale/views/sale_view.xml | 8 +++---- .../wizard/product_configurator.py | 16 ++++++++++---- 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/product_configurator_sale/__manifest__.py b/product_configurator_sale/__manifest__.py index 0759141da..56d037497 100644 --- a/product_configurator_sale/__manifest__.py +++ b/product_configurator_sale/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Product Configurator Sale", - "version": "16.0.1.0.1", + "version": "17.0.1.0.0", "category": "Generic Modules/Sale", "summary": "Product configuration interface modules for Sale", "author": "Pledra, Odoo Community Association (OCA)", diff --git a/product_configurator_sale/tests/__init__.py b/product_configurator_sale/tests/__init__.py index be224966f..ae8e2f8a7 100644 --- a/product_configurator_sale/tests/__init__.py +++ b/product_configurator_sale/tests/__init__.py @@ -1,4 +1,4 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -# from . import test_sale +from . import test_sale from . import test_sale_order_line diff --git a/product_configurator_sale/tests/test_sale.py b/product_configurator_sale/tests/test_sale.py index 92b7a992a..71faf0ce6 100644 --- a/product_configurator_sale/tests/test_sale.py +++ b/product_configurator_sale/tests/test_sale.py @@ -1,30 +1,44 @@ from odoo.addons.product_configurator.tests import ( - test_product_configurator_test_cases as TC, + common as TC, ) class SaleOrder(TC.ProductConfiguratorTestCases): def setUp(self): - super(SaleOrder, self).setUp() - self.SaleOrderId = self.env["sale.order"] + super().setUp() + self.SaleOrder = self.env["sale.order"] self.productPricelist = self.env["product.pricelist"] self.resPartner = self.env.ref("product_configurator_sale.partenr_sale_1") self.currency_id = self.env.ref("base.USD") self.ProductConfWizard = self.env["product.configurator.sale"] + self.config_product = self.env.ref("product_configurator.bmw_2_series") + def test_00_reconfigure_product(self): + product_id = self.env["product.product"].create( + {"product_tmpl_id": self.config_product.id, "name": "Test Product"} + ) pricelist_id = self.productPricelist.create( { "name": "Test Pricelist", "currency_id": self.currency_id.id, } ) - sale_order_id = self.SaleOrderId.create( + sale_order_id = self.SaleOrder.create( { "partner_id": self.resPartner.id, "partner_invoice_id": self.resPartner.id, "partner_shipping_id": self.resPartner.id, "pricelist_id": pricelist_id.id, + "order_line": [ + ( + 0, + 0, + { + "product_id": product_id.id, + }, + ) + ], } ) context = dict( diff --git a/product_configurator_sale/tests/test_sale_order_line.py b/product_configurator_sale/tests/test_sale_order_line.py index d7831a926..e399b7221 100644 --- a/product_configurator_sale/tests/test_sale_order_line.py +++ b/product_configurator_sale/tests/test_sale_order_line.py @@ -68,7 +68,9 @@ def _configure_wizard(self, wizard, template_values): return wizard.action_config_done() def _configure_product(self, sale_order, product_template, template_values): - """Configure `product_template` in `sale_order` with values `template_values`.""" + """ + Configure `product_template` in `sale_order` with values `template_values`. + """ wizard = self._create_wizard(sale_order, product_template) return self._configure_wizard(wizard, template_values) diff --git a/product_configurator_sale/views/sale_view.xml b/product_configurator_sale/views/sale_view.xml index 564f5abe8..848360c3b 100644 --- a/product_configurator_sale/views/sale_view.xml +++ b/product_configurator_sale/views/sale_view.xml @@ -10,7 +10,7 @@ class="oe_highlight" groups="product_configurator.group_product_configurator" name="action_config_start" - states="draft,sent" + invisible="state not in ['draft','sent']" string="Configure Product" style="margin-top: 15px;" type="object" @@ -20,16 +20,16 @@ expr="//field[@name='order_line']/form//field[@name='product_id']" position="after" > - + - +