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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 8 15
|
3433 | ||
|
1
thg 7 25
|
444 | ||
Internal Team Grouping for Calendar
Đã xử lý
|
|
2
thg 6 25
|
811 | |
|
1
thg 5 25
|
2400 | ||
|
1
thg 4 25
|
3505 |