product.py 455 B

12345678910111213141516
  1. # -*- coding: utf-8 -*-
  2. # © 2016 Comunitea
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import models, api
  5. class ProductProduct(models.Model):
  6. _inherit = 'product.product'
  7. @api.multi
  8. def write(self, vals):
  9. if vals.get('image_variant', False):
  10. self.mapped('product_tmpl_id').write(
  11. {'image': vals['image_variant']})
  12. return super(ProductProduct, self).write(vals)