Skip to content

Commit

Permalink
product_supplierinfo_for_customer: Add supplier+customer test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmequignon committed Dec 8, 2023
1 parent c4b597a commit 0d630f7
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,39 @@ def _create_partnerinfo(cls, supplierinfo_type, partner, product):
}
)

def test_partner_customer_and_seller(self):
product = self.env["product.product"].create(
{"name": "Product Name", "default_code": "Product Code"}
)
custseller = self.env["res.partner"].create({"name": "Custseller"})
self.env["product.supplierinfo"].create(
{
"product_id": product.id,
"product_tmpl_id": product.product_tmpl_id.id,
"partner_id": custseller.id,
"product_code": "seller code",
"product_name": "seller name",
}
)
self.env["product.customerinfo"].create(
{
"product_id": product.id,
"product_tmpl_id": product.product_tmpl_id.id,
"partner_id": custseller.id,
"product_code": "customer code",
"product_name": "customer name",
}
)
self.assertEqual(product.display_name, "[Product Code] Product Name")
product.invalidate_cache(["display_name"])
self.assertEqual(
product.with_context(partner_id=custseller.id).display_name,
"[seller code] seller name",
)
product.invalidate_cache(["display_name"])
product = product.with_context(partner_id=custseller.id, customerinfo=True)
self.assertEqual(product.display_name, "[customer code] customer name")

def test_default_get(self):
"""checking values returned by default_get()"""
fields = ["name"]
Expand Down

0 comments on commit 0d630f7

Please sign in to comment.