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.

17 lines
485 B

  1. import json
  2. from odoo import models, fields, api
  3. class Product(models.Model):
  4. _inherit = 'product.product'
  5. # technical field used in POS frontend
  6. multi_ean_json = fields.Char(
  7. "Multi EAN list", readonly=True,
  8. compute="_compute_multi_ean_json")
  9. @api.multi
  10. def _compute_multi_ean_json(self):
  11. for p in self:
  12. multi_ean_json = [x for x in p.mapped('ean13_ids.name') if x]
  13. p.multi_ean_json = json.dumps(multi_ean_json)