How to Disable past dates in Datepicker for a particular Date field in Odoov10?
I tried all solutions from google but still can not solve my problem.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to Disable past dates in Datepicker for a particular Date field in Odoov10?
I tried all solutions from google but still can not solve my problem.
Hi, i put this code inside a method but you can disable the method and try yourself to suit your needs :)
# this will generate pop up error message and date time module
from odoo.exceptions import UserError
from datetime import datetime
def disable_past_date(self):
selected = self.env['your.Model'].browse(self._context.get('active_ids', [])) # This will get your current record form
current_date = datetime.now() # this will get the today's date
if self.selected_date and self.selected_date < current_date: # compare todays date and selected date
raise UserError('The date selected is in the past.') # The error message
Best regards,
Altela (altelasoftware.com)
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
ธ.ค. 19
|
9797 | ||
|
0
พ.ย. 18
|
2549 | ||
|
0
พ.ย. 18
|
2218 | ||
|
1
พ.ค. 16
|
4644 | ||
|
3
มี.ค. 25
|
3783 |