Reputation: 37
I want to change the value of field ( that changes to the date of the day for example) automatically or when you access an already created view the action is generate in odoo13.
Thaks
Upvotes: 0
Views: 191
Reputation: 1668
You should use fields_view_get
method, it will fired with every type of view, if you need it when a form
is open you can do something like this:
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
res = super(Movimiento, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
if view_type == 'form':
# Get today date
today = fields.Date.context_today(self)
# update your field here.
return res
I hope this answer can be helpful for you.
Upvotes: 1