Hello, I am developing a module in Odoo 8 and I have a very strange problem. I added a One2many field in product.pricelist.version model, and in account.voucher model I have the corresponding Many2one field.
class product_pricelist_version(models.Model):
_inherit = 'product.pricelist.version'pays= fields.One2many('account.voucher', 'pricelist_version_id')
Then, I override the create method of product.pricelist.item model.
def create(self, cr, uid, vals, context=None):
id_pricelist = super(product_pricelist_item, self).create(cr, uid, vals, context)
pricelist_item_obj = self.browse(cr, uid, id_pricelist, context)
pricelist_version_obj = pricelist_item_obj.price_version_id
When I create a pricelist.version with one or more "pays", I do some logic. If I check the lenght with "len(pricelist_version_obj.pays)" I get 0! Why?! If I do "len(pricelist_item_obj.items_id)" I get the correct number of items...