'odoo 11 Expected singleton

guys why is this thing happening?

I'm getting this error!

    raise ValueError("Expected singleton: %s" % self)
    ValueError: Expected singleton: product.pricelist.item(8, 9)

this is the related code:

if price is not False:
if rule.compute_price == 'fixed':
    price = convert_to_price_uom(rule.fixed_price)
elif rule.compute_price == 'percentage':
    price = (price - (price * (rule.percent_price / 100))) or 0.0
**elif rule.compute_price == 'nettech':
    if product.aed_is_true:
        price_tempo = self.env['res.currency'].search([('name', '=', 'IRR')], limit=1).rate * product.aed_in_irr + product.sud2 + (((self.env['res.currency'].search([('name', '=', 'IRR')], limit=1).rate * product.aed_in_irr + product.sud2) * (product.sud-rule.product_sub) / 100)) or 0.0
        price = round(price_tempo,-4)
    elif not product.aed_is_true:
        price = price**


Solution 1:[1]

Search the variable of the product.pricelist.item model and create a for loop on it. You have this error because there is a variable that contains an object of two records and you are trying to get one value from both. For this reason you should create a loop to get the value from each object.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak