0
votes

I have a custom model:

class ProductExtended(models.Model):
  ...
  product_id = fields.Many2one('product.template', 'Product')
  ...

And I am trying to do the following inside a method:

....
new_record.product_id = new_parametrized_product
....

where:

new_record = product.extended(1724,)
new_parametrized_product = product.template(1275,)

but I get:

ValueError: Expected Singleton: product.template()

Could someone help me to understand what is wrong here?

1
They were, lead me to the point where this was failing. - M.E.
These might be helpful to you. odedrabhavesh.blogspot.in/2017/02/… - Bhavesh Odedra
product_id should be used to link to product.product - qvpham

1 Answers

-1
votes

The ValueError you're seeing is because somewhere you're calling something on a product.template that does not exist. The expected singleton is empty in this case.

Without seeing the full stack trace of the error, it's hard to say exactly which bit is causing the error, but it's definitely because you have an empty recordset somewhere.