I've inherited the pos.session model with a function triggered when an index changed:
class divina_session(models.Model):
_inherit = 'pos.session'
order_paid = fields.Integer('Order Paid', store=True, default='0')@api.multi@api.multi
def _write(self, vals):
res = super(divina_session, self)._write(vals)
for record in self:
record.set_data_write(vals, record)
return res
def set_data_write(self, vals, record):
if vals.get('order_paid'):
my code here
The method is used to update a whole record on another model (pos.adm).
Pos.adm has a tree view, and I would like to update the view from button, since it doesn't update automatically after db changed... However I don't know what syntax should I use on my button definition and, most important, how to trigger it on pos.session since my index (order_paid) will not change on button press.
Any clue?
Thanks.
F.
Solved (for now) calling directly the menu item from a button in my view. Simple and effective, even with a little drawback.
This will update the view exactly like will do when calling the menu item itself (that is hidden on a 2 levels submenu), without the need to refresh the whole page. I'm still working on it to force an update manually but for now I can spend my effort on other issues I need to solve with other functions.