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
631 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2017 - Today:
  3. # GRAP (http://www.grap.coop)
  4. # Akretion (http://www.akretion.com)
  5. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  6. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  7. from odoo import models, fields, api
  8. class ProductProduct(models.Model):
  9. _inherit = 'product.product'
  10. @api.multi
  11. @api.depends('image')
  12. def _compute_has_image(self):
  13. for product in self:
  14. product.has_image = product.image is not False
  15. has_image = fields.Boolean(
  16. compute='_compute_has_image', string='Has Image', store=True)