0

I have a custom model with an init view for _auto = False when I access the list view I got wrong data in a Many2one field analytic_line_type_id ! Debugging results:

 > /odoo/odoo-server/odoo/models.py(3247)_read_format()
-> for record, vals in data:
(Pdb) record[name], record.analytic_line_type_id,  self.env[self._name].search_read([('id','=',record.id)],['analytic_line_type_id'])[0]
(account.analytic.line.type(1,), account.analytic.line.type(1,), {'id': 9057, 'analytic_line_type_id': (15, "Temps d'assemblage atelier")})
(Pdb) record[name], record.analytic_line_type_id,  self.env[self._name].search_read([('id','=',record.id)],['analytic_line_type_id'])[0]
(account.analytic.line.type(15,), account.analytic.line.type(15,), {'id': 9057, 'analytic_line_type_id': (15, "Temps d'assemblage atelier")})
(Pdb) record[name], record.analytic_line_type_id,  self.env[self._name].search_read([('id','=',record.id)],['analytic_line_type_id'])[0]
(account.analytic.line.type(15,), account.analytic.line.type(15,), {'id': 9057, 'analytic_line_type_id': (15, "Temps d'assemblage atelier")})

Why record.analytic_line_type is not correct in the first call ?
As you can see the search_read value is different to direct access to the field!

m3asmi
  • 1,252
  • 1
  • 16
  • 36
  • without the modules involved and a way to debug it it's almost impossible to tell you why that it's happening – aekis.dev Aug 25 '23 at 14:29

0 Answers0