I want to create selection drop down from a model. I want to get current year and it will calculate 5 years later and appearance at drop down. How can do it?
Thanks for your reply
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I want to create selection drop down from a model. I want to get current year and it will calculate 5 years later and appearance at drop down. How can do it?
Thanks for your reply
i believe that you can't change values of a selection field as values are loaded at form load and can`t be changed.
Can you give me an example ?
if you can add a onchange and domain,do like this
@api.onchange('partner_id')
def apply_domain_customer(self):
vehicles = self.env['fleet.vehicle'].search([('driver_id', '=',
self.partner_id.id)]).ids
return {
'domain': {
'vehicle': [('id', 'in', vehicles)]
}}
you can get date using datetime library in python
datetime.now()
and
from dateutil.relativedelta import relativedelta
new_date = old_date + relativedelta(years=5)
thanks for your answer
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
Hi,
Do you need Many2one based on condition?