Skip to content

Commit

Permalink
[MIG] sale_order_line_variant_description: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Feb 6, 2025
1 parent 45dcad7 commit ead1b2b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 58 deletions.
3 changes: 3 additions & 0 deletions sale_order_line_variant_description/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------
Expand Down
2 changes: 1 addition & 1 deletion sale_order_line_variant_description/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Sale order line variant description",
"version": "16.0.1.1.0",
"version": "18.0.1.0.0",
"category": "Sales Management",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-variant",
Expand Down
3 changes: 3 additions & 0 deletions sale_order_line_variant_description/readme/CONTRIBUTORS.md
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

Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</li>
<li>Simone Vanin &lt;<a class="reference external" href="mailto:simone.vanin&#64;agilebg.com">simone.vanin&#64;agilebg.com</a>&gt;</li>
<li>Dhara Solanki &lt;<a class="reference external" href="mailto:dhara.solanki&#64;initos.com">dhara.solanki&#64;initos.com</a>&gt;</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
<li>Bhavesh Heliconia</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
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)
6 changes: 2 additions & 4 deletions sale_order_line_variant_description/views/product_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<field name="description_sale" position="attributes">
<attribute
name="attrs"
>{'invisible': [('product_variant_count', '&gt;', 1)]}</attribute>
<attribute name="invisible">product_variant_count > 1</attribute>
</field>
<field name="description_sale" position="after">
<field
name="variant_description_sale"
attrs="{'invisible': [('product_variant_count', '=', 1)]}"
invisible="[('product_variant_count', '=', 1)]"
colspan="2"
nolabel="1"
placeholder="This note is added to sales orders and invoices."
Expand Down

0 comments on commit ead1b2b

Please sign in to comment.