79144316

Date: 2024-10-31 10:23:16
Score: 0.5
Natty:
Report link

finally i found the answer, we can use read method to do it

def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
    res = super(inspection, self).read(cr, uid, ids, fields, context=context, load=load)
    if len(res) == 1:
        cr.execute('select id from inspection_category')
        categories = [int(c[0]) for c in cr.fetchall()]
        for ce in categories:
            res[0]['category_id_'+str(ce)] = True
    return res
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Fares Izem