diff options
| author | Yannick Tivisse <yti@odoo.com> | 2020-08-04 08:47:21 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-08-14 09:29:30 +0000 |
| commit | 4afdebbb7e919878966a3b894ce99e913cf046e4 (patch) | |
| tree | e3ab438dcd04ce1265fc4802a7b6ce6538b93a2b /addons/web_editor/controllers | |
| parent | ee28ab81329c8f14d63f102a1b874f73b6310dff (diff) | |
[FIX] hr_holidays: Fix undeterministic crashing tests
The tests in hr_holidays/tests/test_company_leave.py seem like they randomly fail if the default value for
date_to is computed on a different second than the date_from (it's a dict of fields so not ordered).
Cfr https://runbot.odoo.com/runbot/build/3727451 2020-07-30 08:28:32 vs 2020-07-30 08:28:31
for which date_from > date_to.
I imagine the call to leave._onchange_request_parameters() is meant to fix it, but it occurs after
the create() which is flushed immediately, so it's too late and the date_from/date_to SQL constraint
still triggers.
It could happen for real production usage too, so we might want to do something about that outside of tests.
Options include:
1/ making the date_from/date_to fields writeable computed fields, with the compute method setting
better defaults on both fields at once
2/ alternatively, remove the default=fields.Datetime.now and override default_get instead for
deterministic defaults on both fields at once
The second solution seemed to be the better one.
closes odoo/odoo#55880
Taskid: 2312029
X-original-commit: 6908ea471dd18182f83c81046f0000a00898fb66
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/web_editor/controllers')
0 files changed, 0 insertions, 0 deletions
