You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
532 B

  1. # -*- coding: utf-8 -*-
  2. # © <2015> <Akretion, GRAP, OCA>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, fields, api
  5. class ProductTemplate(models.Model):
  6. _inherit = ['product.template']
  7. _name = 'product.template'
  8. @api.multi
  9. @api.depends('field.image')
  10. def _has_image(self):
  11. for record in self:
  12. record.has_image = bool(record.image)
  13. has_image = fields.Boolean(
  14. compute='_has_image',
  15. store=True,
  16. readonly=True)