[FIX] product: Field display_name in product template form view

Steps to reproduce the bug:
- Go to Sales app and open the form view of a product P
- With studio add the field display_name in the view
- Try to create a new product

Bug:

A access error was raised because a read was made on a record in cache

opw:2070074

closes odoo/odoo#37133

X-original-commit: 90143c18f50ff31ded5aba7d7ba3beb66423ff06
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-09-19 10:33:02 +00:00
committed by fw-bot
parent 88889b6aa8
commit ce7090001d
+1 -1
View File
@@ -400,7 +400,7 @@ class ProductTemplate(models.Model):
@api.multi
def name_get(self):
# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
self.read(['name', 'default_code'])
self.browse(self.ids).read(['name', 'default_code'])
return [(template.id, '%s%s' % (template.default_code and '[%s] ' % template.default_code or '', template.name))
for template in self]