Hello,
How to set default value from function for fields Date in V8?
Thank You
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
How to set default value from function for fields Date in V8?
Thank You
For example:
@api.model
def _default_date(self):
inv_type = self._context.get('type', 'out_invoice')
if inv_type == 'out_invoice':
current_date = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
return current_date
date_invoice = fields.Date(string='Invoice Date',readonly=True, states={'draft': [('readonly', False)]}, index=True, help="Keep empty to use the current date", copy=False, default=_default_date)
Create an account today to enjoy exclusive features and engage with our awesome community!
РегистрацияRelated Posts | Ответы | Просмотры | Активность | |
---|---|---|---|---|
|
2
сент. 21
|
7355 | ||
|
1
июн. 20
|
4715 | ||
|
1
мая 25
|
794 | ||
|
0
янв. 24
|
1561 | ||
|
2
мая 23
|
8433 |
yes, it's works
Thanks zbik