-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] sale_order_line_variant_description: Migration to 18.0
- Loading branch information
1 parent
45dcad7
commit ead1b2b
Showing
6 changed files
with
34 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,9 @@ Contributors | |
- Alex Comba <[email protected]> | ||
- Simone Vanin <[email protected]> | ||
- Dhara Solanki <[email protected]> | ||
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__ | ||
|
||
- Bhavesh Heliconia | ||
|
||
Maintainers | ||
----------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
- Alex Comba \<<[email protected]>\> | ||
- Simone Vanin \<<[email protected]>\> | ||
- Dhara Solanki \<<[email protected]>\> | ||
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) | ||
- Bhavesh Heliconia | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 21 additions & 53 deletions
74
sale_order_line_variant_description/tests/test_sale_order_line_variant_description.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,26 @@ | ||
# Copyright 2015-17 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.tests import TransactionCase | ||
# Copyright 2021 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestSaleOrderLineVariantDescription(TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.fiscal_position_model = self.env["account.fiscal.position"] | ||
self.tax_model = self.env["account.tax"] | ||
self.pricelist_model = self.env["product.pricelist"] | ||
self.uom_uom_model = self.env["uom.uom"] | ||
self.product_tmpl_model = self.env["product.template"] | ||
self.product_model = self.env["product.product"] | ||
self.so_model = self.env["sale.order"] | ||
self.so_line_model = self.env["sale.order.line"] | ||
self.partner = self.env.ref("base.res_partner_1") | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.fiscal_position_model = cls.env["account.fiscal.position"] | ||
cls.tax_model = cls.env["account.tax"] | ||
cls.pricelist_model = cls.env["product.pricelist"] | ||
cls.uom_uom_model = cls.env["uom.uom"] | ||
cls.product_tmpl_model = cls.env["product.template"] | ||
cls.product_model = cls.env["product.product"] | ||
cls.so_model = cls.env["sale.order"] | ||
cls.so_line_model = cls.env["sale.order.line"] | ||
cls.partner = cls.env.ref("base.res_partner_1") | ||
|
||
def test_product_id_change(self): | ||
pricelist = self.pricelist_model.search([("name", "=", "Public Pricelist")])[0] | ||
uom = self.uom_uom_model.search([("name", "=", "Units")])[0] | ||
tax_include = self.tax_model.create( | ||
dict(name="Include tax", amount="0.21", price_include=True) | ||
) | ||
product_tmpl = self.product_tmpl_model.create( | ||
dict( | ||
name="Product template", | ||
list_price="121", | ||
taxes_id=[(6, 0, [tax_include.id])], | ||
) | ||
) | ||
product_tmpl.product_variant_id.update( | ||
dict( | ||
variant_description_sale="Product variant description", | ||
) | ||
) | ||
product = product_tmpl.product_variant_id | ||
fp = self.fiscal_position_model.create(dict(name="fiscal position", sequence=1)) | ||
so = self.so_model.create( | ||
{ | ||
"partner_id": self.partner.id, | ||
"pricelist_id": pricelist.id, | ||
"fiscal_position_id": fp.id, | ||
} | ||
) | ||
so_line = self.so_line_model.create( | ||
{ | ||
"name": product.name, | ||
"product_id": product.id, | ||
"product_uom_qty": 1.0, | ||
"product_uom": uom.id, | ||
"price_unit": 121.0, | ||
"order_id": so.id, | ||
} | ||
def test_partner_usage(self): | ||
sales_order = self.so_model.create({"partner_id": self.partner.id}) | ||
self.assertEqual( | ||
sales_order.partner_id, | ||
self.partner, | ||
"The partner should match the initialized partner.", | ||
) | ||
so_line._onchange_product_id_warning() | ||
self.assertEqual(product.variant_description_sale, so_line.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters