1234567891011121314151617181920 |
- # -*- encoding: utf-8 -*-
- from openerp import models, fields, api
- class ProductProduct(models.Model):
- _inherit = 'product.product'
- @api.multi
- def name_get(self):
- res = super(ProductProduct, self).name_get()
- res2 = []
- for name_tuple in res:
- product = self.browse(name_tuple[0])
- if not product.factory_reference:
- res2.append(name_tuple)
- continue
- res2.append((
- name_tuple[0],
- u'{} [{}]'.format(name_tuple[1], product.factory_reference)
- ))
- return res2
|