Can a timesheet period be locked at a certain point in time so that no new timesheet activities can be entered for that period? For example, I would to have the possibility to lock the previous month on the first day of the new month. This to motivate employees to enter their hours worked in a timely manner :-)
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ờ
Bob,
You can implement this by adding an odoo constraint to check if the start date entered is of previous month then , raise an error...
your constraint: _constraints = [(_check_date_validation, 'YOUR_MESSAGE', ['date_from', 'date_to'])]
method:
def _check_date_validation(self, cr, uid, ids, context=None):
for self_obj in self.browse(cr, uid, ids, context=context):
date_from = datetime.strptime(self_obj.date_from, '%d/%m/%Y').date()
# datetime.now().month is your current month and
# date_from.month is the month selected in the from date
if datetime.now().month > date_from.month and date_from.day==1:
return False (or you can raise exception here only to display custom message)
elif YOUR OTHER CONDITIONS
return False (or you can raise exception here only to display custom message)
return True
Hope it helps!
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 12 24
|
1178 | ||
|
3
thg 5 23
|
4717 | ||
|
1
thg 10 22
|
3549 | ||
|
0
thg 11 21
|
2498 | ||
|
1
thg 5 21
|
3159 |