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.

20 lines
501 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. @api.multi
  8. @api.depends('field.image')
  9. def _has_image(self):
  10. for record in self:
  11. record.has_image = bool(record.image)
  12. has_image = fields.Boolean(
  13. compute='_has_image',
  14. store=True,
  15. readonly=True)