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

  1. import json
  2. from odoo import models, fields, api
  3. class ProductTemplate(models.Model):
  4. _inherit = 'product.template'
  5. # technical field used in POS frontend
  6. supplier_barcode_json = fields.Char(
  7. "Supplier barcode list", readonly=True,
  8. compute="_compute_supplier_barcode_json")
  9. @api.multi
  10. def _compute_supplier_barcode_json(self):
  11. for t in self:
  12. supplier_barcode_json = [x for x in t.mapped('seller_ids.barcode') if x]
  13. t.supplier_barcode_json = json.dumps(supplier_barcode_json)