product.py 606 B

1234567891011121314151617181920
  1. # -*- encoding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class ProductProduct(models.Model):
  4. _inherit = 'product.product'
  5. @api.multi
  6. def name_get(self):
  7. res = super(ProductProduct, self).name_get()
  8. res2 = []
  9. for name_tuple in res:
  10. product = self.browse(name_tuple[0])
  11. if not product.factory_reference:
  12. res2.append(name_tuple)
  13. continue
  14. res2.append((
  15. name_tuple[0],
  16. u'{} [{}]'.format(name_tuple[1], product.factory_reference)
  17. ))
  18. return res2