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:
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)
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
2
sept. 21
|
8112 | |||
|
1
juin 20
|
5329 | |||
|
3
juil. 25
|
9844 | |||
|
1
mai 25
|
2067 | |||
|
0
janv. 24
|
2669 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
yes, it's works
Thanks zbik