if date_fin == date.today :
I want the cycle statut change (activer to desactiver) and all the rest of the fields to be in readonly mode.
class ProductionCycle(models.Model):
Thanks
if date_fin == date.today :
I want the cycle statut change (activer to desactiver) and all the rest of the fields to be in readonly mode.
Thanks
Hi Ramla,
To create an onchange function, in your <models>.py file add
@api.onchange('date_fin')
def _method_name(self):
if self.date_fin:
if self.date_fin == date.today(): #assuming that date is a datetime object
self.statut = 'desactiver'
And to make the fields set to readonly in your xml file, i suggest you use
<field name="field_name" attrs="{'readonly':[('statut', '=', 'desactiver')]} />
Just work around on this and I'm sure you'll get what you want..
Hope it helps. :)
Thank you so much ^_^
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy| Aiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
|---|---|---|---|---|
|
0
huhtik. 19
|
5461 | |||
|
4
toukok. 19
|
6448 | |||
|
2
toukok. 19
|
5254 | |||
|
2
huhtik. 19
|
5737 | |||
|
1
huhtik. 19
|
6500 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.