Hi all
i want to know that How can i set Age Restriction on Odoo's datepicker in odoo version 10, so that when the user click on datepicker it autoset the date 18 years ago, and make non selectable the other dates (if selecting date make the person's age below 18 years )
Please explain with every file py and xml or anything else if need
I am new here
Thanks in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Hello, I understand Odoo restriction policy must be implemented at 99% in server side.
At first: server method and fields are public with xml-rpc, because that I recommend as a good security practices implement all restrictions in server side like this:
fieldXXX = fields.Date('Field to restrict', required=True, default=fields.Date.today())
@api.one
@api.constrains('fieldXXX')
def _check_fieldXXX(self):
if (fields.Date.from_string(fields.Date.today()) - fields.Date.from_string(self.fieldXXX)).days ...............:
raise Warning(_('Anything you want to raise'))
If restrictions doesn't appear in python code third party codes must write incorrect values into your entities.
I hope this answer help you.
Hi Rafael,
thanks for your answer, i ll try it on my code for sure and then let you know.
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
0
sie 15
|
3426 | ||
|
1
lip 25
|
428 | ||
Internal Team Grouping for Calendar
Rozwiązane
|
|
2
cze 25
|
793 | |
|
1
maj 25
|
2390 | ||
|
1
kwi 25
|
3489 |