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
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
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!
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
0
dic 24
|
1171 | ||
|
3
mag 23
|
4691 | ||
|
1
ott 22
|
3531 | ||
|
0
nov 21
|
2463 | ||
|
1
mag 21
|
3127 |