diff options
| author | Nasreddin (bon) <bon@odoo.com> | 2021-02-09 15:09:44 +0000 |
|---|---|---|
| committer | Nasreddin (bon) <bon@odoo.com> | 2021-02-09 15:21:44 +0000 |
| commit | 1ec4aa0b61777739d8bc82bbee968b9838f58410 (patch) | |
| tree | 23747e8f7269883363abb3e4ab2f32616a2726ed /addons | |
| parent | b358e67fae8d60e2e9935613d6fcdeff64121ad2 (diff) | |
[FIX] hr_holidays: Display correct number of days
Issue
- Install `Time Off` module
- Go to `Time Off` and switch to month calendar view (default view)
- Select range of date
In wizard, `duration` is not set.
Cause
`date_to` and `date_from` are overided on default get request.
Solution
Do not override default value of `date_from` and
`date_to` if provided in default get request.
opw-2447931
closes odoo/odoo#65830
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_holidays/models/hr_leave.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index 9206804e59b..356d912c87d 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -84,10 +84,10 @@ class HolidaysRequest(models.Model): defaults['state'] = 'confirm' if lt and lt.leave_validation_type != 'no_validation' else 'draft' now = fields.Datetime.now() - defaults.update({ - 'date_from': now, - 'date_to': now, - }) + if 'date_from' not in defaults: + defaults.update({'date_from': now}) + if 'date_to' not in defaults: + defaults.update({'date_to': now}) return defaults def _default_get_request_parameters(self, values): |
