I need to set @api.constraints for people under 18. they shall not pass. pls help me
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 会計
- 在庫
- PoS
- Project
- MRP
この質問にフラグが付けられました
1
返信
2240
ビュー
Hi,
Below is a sample code by which you can get age from date of birth:
today = date.today()
if rec.date_of_birth:
rec.age = today.year - rec.date_of_birth.year
else:
rec.age = 1
Video: https://youtu.be/NlbdnA6WMd8?t=632
then you can check the age is less than 18 or not and return the validation using constrains:
See: https://www.youtube.com/watch?v=8Lz4Fy7ozfY
Thanks
関連投稿 | 返信 | ビュー | 活動 | |
---|---|---|---|---|
|
0
2月 22
|
4 | ||
|
1
3月 15
|
4922 | ||
|
1
3月 15
|
8417 | ||
|
3
6月 25
|
1231 | ||
|
1
1月 25
|
18034 |