Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] product_configurator_sale: restore test_sale #136

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions product_configurator/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def setUpClass(cls):
)

@classmethod
def _configure_product_nxt_step(cls):
product_config_wizard = cls.ProductConfWizard.create(
{
"product_tmpl_id": cls.config_product.id,
}
)
def _configure_product_nxt_step(cls, **defaults):
vals = {
"product_tmpl_id": cls.config_product.id,
}
vals.update(defaults)
product_config_wizard = cls.ProductConfWizard.create(vals)
product_config_wizard.action_next_step()
product_config_wizard.write(
{
Expand Down
2 changes: 1 addition & 1 deletion product_configurator_sale/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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
41 changes: 20 additions & 21 deletions product_configurator_sale/tests/test_sale.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
from odoo.addons.product_configurator.tests import (
test_product_configurator_test_cases as TC,
)
from odoo.addons.product_configurator.tests.common import ProductConfiguratorTestCases


class SaleOrder(TC.ProductConfiguratorTestCases):
def setUp(self):
super(SaleOrder, self).setUp()
self.SaleOrderId = 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"]
class SaleOrder(ProductConfiguratorTestCases):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.SaleOrder = cls.env["sale.order"]
cls.productPricelist = cls.env["product.pricelist"]
cls.partner = cls.env.ref("product_configurator_sale.partenr_sale_1")
cls.currency = cls.env.ref("base.USD")
cls.ProductConfWizard = cls.env["product.configurator.sale"]

def test_00_reconfigure_product(self):
pricelist_id = self.productPricelist.create(
{
"name": "Test Pricelist",
"currency_id": self.currency_id.id,
"currency_id": self.currency.id,
}
)
sale_order_id = self.SaleOrderId.create(
sale_order = self.SaleOrder.create(
{
"partner_id": self.resPartner.id,
"partner_invoice_id": self.resPartner.id,
"partner_shipping_id": self.resPartner.id,
"partner_id": self.partner.id,
"partner_invoice_id": self.partner.id,
"partner_shipping_id": self.partner.id,
"pricelist_id": pricelist_id.id,
}
)
context = dict(
default_order_id=sale_order_id.id,
default_order_id=sale_order.id,
wizard_model="product.configurator.sale",
)

self.ProductConfWizard = self.env["product.configurator.sale"].with_context(
**context
)
sale_order_id.action_config_start()
self._configure_product_nxt_step()
sale_order_id.order_line.reconfigure_product()
product_tmpl = sale_order_id.order_line.product_id.product_tmpl_id
sale_order.action_config_start()
self._configure_product_nxt_step(order_id=sale_order.id)
sale_order.order_line.reconfigure_product()
product_tmpl = sale_order.order_line.product_id.product_tmpl_id
self.assertEqual(
product_tmpl.id,
self.config_product.id,
Expand Down
Loading