[IMP] hr_work_entry: allow change initial date to view work entries
- Add a new variable to view the initial date in calendar view. closes odoo/odoo#112548 X-original-commit: e63993764d7e7206ed0bb97de30964b4776d6adb Related: odoo/enterprise#37031 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -6,13 +6,16 @@ from odoo import models, _
|
||||
class HrEmployee(models.Model):
|
||||
_inherit = 'hr.employee'
|
||||
|
||||
def action_open_work_entries(self):
|
||||
def action_open_work_entries(self, initial_date=False):
|
||||
self.ensure_one()
|
||||
ctx = {'default_employee_id': self.id}
|
||||
if initial_date:
|
||||
ctx['initial_date'] = initial_date
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('%s work entries', self.display_name),
|
||||
'view_mode': 'calendar,tree,form',
|
||||
'res_model': 'hr.work.entry',
|
||||
'context': {'default_employee_id': self.id},
|
||||
'context': ctx,
|
||||
'domain': [('employee_id', '=', self.id)],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user