As described here onchange methods are called with virtual recordset by Odoo, if a corresponding field is changed. Say I have the following onchange method:
@api.onchange('my_field')
def onchange_my_field(self):
pass
when Odoo calls this method internally, the "self" is a virtual recordset. However, I have a scenario where I would like to call this method manually, from the another object method, where I do NOT have virtual recordset, but a normal recordset instead, so if I call the onchange method like this:
self.onchange_my_field()
it gets called with ordinary recordset instead of virtual recordset (consequently the final result is as expected, except of huge difference in performance).
In order to avoid the performance penalty, I would like to get somehow virtual recordset from the ordinary "self" recordset I have for the moment and than call the onchange function using it. i.e. something like:
rec = get virtual recordset from self
rec.onchange_my_field()
it comes down to the question: How to get a virtual record/recordset from an ordinary record/recordset?