[FIX] product: The pricelist variable must be a recordset, not a list

Steps to reproduce the bug:

-On an empty database, install the sale module
-Activate product variants : Sales > Settings > Check Products can have several attributes, defining variants (Example: size, color,...)
-Activate advanced pricelists : Sales > Settings > Check Advanced pricing based on formulas (discounts, margins, rounding)
-Activate the developer mode
-Go to the product.templates list : Sales > Products
-Go to the debug menu > Edit TreeView and add the price field in the view
-Search for a pricelist : Type the name of an existing pricelist, then go to the pricelists proposal,
open the list of proposed pricelists, and select the pricelist

Bug:

A traceback was raised.

opw:762663
This commit is contained in:
Sylvain GARANCHER
2017-08-09 09:13:50 +02:00
committed by Goffin Simon
parent 483a4fd8d7
commit 10f6e145dd
+3 -1
View File
@@ -164,7 +164,9 @@ class ProductTemplate(models.Model):
# Support context pricelists specified as display_name or ID for compatibility
if isinstance(pricelist_id_or_name, basestring):
pricelist = self.env['product.pricelist'].name_search(pricelist_id_or_name, operator='=', limit=1)
pricelist_data = self.env['product.pricelist'].name_search(pricelist_id_or_name, operator='=', limit=1)
if pricelist_data:
pricelist = self.env['product.pricelist'].browse(pricelist_data[0][0])
elif isinstance(pricelist_id_or_name, (int, long)):
pricelist = self.env['product.pricelist'].browse(pricelist_id_or_name)