<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/resource/tests, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FW][MERGE] resource,calendar,hr_holidays: Improve the performances</title>
<updated>2020-08-25T13:22:24+00:00</updated>
<author>
<name>Yannick Tivisse</name>
<email>yti@odoo.com</email>
</author>
<published>2020-05-19T09:18:00+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=8c96a887d3f05680c923dcd44f9c70c0e5e0bd32'/>
<id>8c96a887d3f05680c923dcd44f9c70c0e5e0bd32</id>
<content type='text'>
TL;DR
=====

Improve performances with nearly a factor of 2. Use case, call action_validate on hr.leave for 100 employees
- 1987 requests -&gt; 844 requests
- 1300 ms -&gt; 700 ms

Purpose
=======

The first purpose of this commit is to add a test ensuring the number of request while creating
a company leave for 100 employees, if 15 of them already have a leave during that period.

It includes, the mass leave generation, and the conflicts resolutions. (Cancelling/Splitting the
already existing one and adapting the dates accordingly).

The second one is to reduce the number of request for this test.

In term of requests, currently we have:
- 5154 requests without bypassing the mail tracking + the activities management
- 1987 requests when bypassing the mail post-process (this is the current value, the bypassing was
  already done several month ago)
- 844 requests with all the optimization done in resource/calendar/hr_holidays

In terms of execution time, we have a reduction from +- 1300 ms to call the method action_validate
to +- 700 ms

As the performances issues severity increases with the number of leaves to create and the real time access
to the database, on the production base, we reduced the execution time to generate more than 500 hr.leaves
from several minutes to 21 seconds. A fix to avoid deadlock was already made at
https://github.com/odoo/enterprise/pull/10740/files

Some contortions were made to avoid changing a signature method in a stable release and thus
introducing for each method a second one, with the "batched" implementation, to keep a retro-compatibility
for the existing custom code.

But surely this could be cleaned in the master version. The old one will be deprecated while waiting to be
removed in a few versions.

closes odoo/odoo#56477

Taskid: 2256705
X-original-commit: 8820db912f9e8ca71a57d3b0d32d2020d35b963f
Related: odoo/enterprise#12642
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
TL;DR
=====

Improve performances with nearly a factor of 2. Use case, call action_validate on hr.leave for 100 employees
- 1987 requests -&gt; 844 requests
- 1300 ms -&gt; 700 ms

Purpose
=======

The first purpose of this commit is to add a test ensuring the number of request while creating
a company leave for 100 employees, if 15 of them already have a leave during that period.

It includes, the mass leave generation, and the conflicts resolutions. (Cancelling/Splitting the
already existing one and adapting the dates accordingly).

The second one is to reduce the number of request for this test.

In term of requests, currently we have:
- 5154 requests without bypassing the mail tracking + the activities management
- 1987 requests when bypassing the mail post-process (this is the current value, the bypassing was
  already done several month ago)
- 844 requests with all the optimization done in resource/calendar/hr_holidays

In terms of execution time, we have a reduction from +- 1300 ms to call the method action_validate
to +- 700 ms

As the performances issues severity increases with the number of leaves to create and the real time access
to the database, on the production base, we reduced the execution time to generate more than 500 hr.leaves
from several minutes to 21 seconds. A fix to avoid deadlock was already made at
https://github.com/odoo/enterprise/pull/10740/files

Some contortions were made to avoid changing a signature method in a stable release and thus
introducing for each method a second one, with the "batched" implementation, to keep a retro-compatibility
for the existing custom code.

But surely this could be cleaned in the master version. The old one will be deprecated while waiting to be
removed in a few versions.

closes odoo/odoo#56477

Taskid: 2256705
X-original-commit: 8820db912f9e8ca71a57d3b0d32d2020d35b963f
Related: odoo/enterprise#12642
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: Find intervals in the resource timezone</title>
<updated>2020-06-24T12:35:11+00:00</updated>
<author>
<name>Lucas Lefèvre</name>
<email>lul@odoo.com</email>
</author>
<published>2020-05-27T11:44:38+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=103feca347321f36627c556569fa5377e7980fb9'/>
<id>103feca347321f36627c556569fa5377e7980fb9</id>
<content type='text'>
With a user with timezone "Europe/Brussels", add a
slot on the gantt view where the preceding day is a working day.
The default starting time will be the previous day.
Reason: the default starting time is midnight, adjusted to
the closest attendance interval in the employee's calendar.
However, midnight in "Europe/Brussels" is actually 10pm UTC
the previous day.
The method adjusting the datetime to the closest attendance only
checks within the corresponding day.

Two ways to fix this:
1) the business code calling `_adjust_to_calendar` should
   timezone the datetimes itself. To avoid similar bugs in the future,
   the method should be modified to only accept timezoned datetimes.

2) Change `_adjust_to_calendar` to convert datetimes it was given
   to the resource's timezone and consider the dates in those converted
   datetimes.

Option 2 is chosen because it seems to take care of the problem at a lower
level which allows the business code to not think about those timezone details.
While this is technically an API change (in a stable release), the method was
introduced recently by b058ca1 as a fix for an already broken method.

closes odoo/odoo#53582

X-original-commit: c6cecac60360a1d8b0c62ee155a818a3a28505e1
Related: odoo/enterprise#11399
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With a user with timezone "Europe/Brussels", add a
slot on the gantt view where the preceding day is a working day.
The default starting time will be the previous day.
Reason: the default starting time is midnight, adjusted to
the closest attendance interval in the employee's calendar.
However, midnight in "Europe/Brussels" is actually 10pm UTC
the previous day.
The method adjusting the datetime to the closest attendance only
checks within the corresponding day.

Two ways to fix this:
1) the business code calling `_adjust_to_calendar` should
   timezone the datetimes itself. To avoid similar bugs in the future,
   the method should be modified to only accept timezoned datetimes.

2) Change `_adjust_to_calendar` to convert datetimes it was given
   to the resource's timezone and consider the dates in those converted
   datetimes.

Option 2 is chosen because it seems to take care of the problem at a lower
level which allows the business code to not think about those timezone details.
While this is technically an API change (in a stable release), the method was
introduced recently by b058ca1 as a fix for an already broken method.

closes odoo/odoo#53582

X-original-commit: c6cecac60360a1d8b0c62ee155a818a3a28505e1
Related: odoo/enterprise#11399
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: Adjust time span to calendar</title>
<updated>2020-05-07T08:22:22+00:00</updated>
<author>
<name>Lucas Lefèvre</name>
<email>lul@odoo.com</email>
</author>
<published>2020-04-02T14:40:09+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b674e4401d1e4b4ae15940db84f04f822293f0d7'/>
<id>b674e4401d1e4b4ae15940db84f04f822293f0d7</id>
<content type='text'>
The method `_get_work_interval` has several problems:

1) The name is not self explanatory in any way

2) It should be defined on the `resource.mixin`

3) It simply does not work (as described in its docstring).
   Here is a simplified example (only concerned about hours):
   Currently, given two attendances: 8-12 and 13-17,
   with parameters start=9 and end=18 it returns (9, 17)
   while it should return (8, 17).

   This leads to strange behaviors in the planning app:
   Given employee A with calendar 8-17 and employee B 8-16.
   Create a planning slot and assign employee A: the start and end times
   are set to 8-17.
   Then assign employee B, the start and end times are correcly set to 8-16.
   Now reassign employee A: the start and end times are not set to 8-17.

Task 2229296

closes odoo/odoo#50804

X-original-commit: 7dfab89bc0025cf6424f00b6992fef1f42463ffe
Related: odoo/enterprise#10426
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
Signed-off-by: lul-odoo &lt;LucasLefevre@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The method `_get_work_interval` has several problems:

1) The name is not self explanatory in any way

2) It should be defined on the `resource.mixin`

3) It simply does not work (as described in its docstring).
   Here is a simplified example (only concerned about hours):
   Currently, given two attendances: 8-12 and 13-17,
   with parameters start=9 and end=18 it returns (9, 17)
   while it should return (8, 17).

   This leads to strange behaviors in the planning app:
   Given employee A with calendar 8-17 and employee B 8-16.
   Create a planning slot and assign employee A: the start and end times
   are set to 8-17.
   Then assign employee B, the start and end times are correcly set to 8-16.
   Now reassign employee A: the start and end times are not set to 8-17.

Task 2229296

closes odoo/odoo#50804

X-original-commit: 7dfab89bc0025cf6424f00b6992fef1f42463ffe
Related: odoo/enterprise#10426
Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;
Signed-off-by: lul-odoo &lt;LucasLefevre@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] resource: Manage calendars over 2 weeks</title>
<updated>2019-06-25T08:02:14+00:00</updated>
<author>
<name>jbm-odoo</name>
<email>jbm@odoo.com</email>
</author>
<published>2019-03-06T09:01:01+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=1e8db023685108a137593188e653d6bf8f8298a9'/>
<id>1e8db023685108a137593188e653d6bf8f8298a9</id>
<content type='text'>
Purpose
=======

In Belgium, we need to support some partial time on 2 weeks.
For instance, a mid time, means you could work on monday, tuesday
and wednesday on week1 and monday and tuesday on week 2. Others payroll
softwares manage this.

Specification
=============

Add a checkbox on resource calendar to manage 2 weeks. --&gt; Consider even/odd weeks.
Add sections on calendars (Like sales orders)
Modify methods in resources to apply this behavor generically.

Check that attendances aren't overlapped

Write an integration test for holidays - benefits - payslip
to check all this, + "credit temps" and wage modification.

Note
====

For the sake of simplicity, we only manage calendars over 2 weeks
to consider the odd/even weeks and keep an easy implementation.
For more complicated calendars (eg: over a months with specific targetted days),
it's better to create specific allocation requests and apply specific leaves
for those days, as it would be the case for parental leaves.

closes odoo/odoo#31674

Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Purpose
=======

In Belgium, we need to support some partial time on 2 weeks.
For instance, a mid time, means you could work on monday, tuesday
and wednesday on week1 and monday and tuesday on week 2. Others payroll
softwares manage this.

Specification
=============

Add a checkbox on resource calendar to manage 2 weeks. --&gt; Consider even/odd weeks.
Add sections on calendars (Like sales orders)
Modify methods in resources to apply this behavor generically.

Check that attendances aren't overlapped

Write an integration test for holidays - benefits - payslip
to check all this, + "credit temps" and wage modification.

Note
====

For the sake of simplicity, we only manage calendars over 2 weeks
to consider the odd/even weeks and keep an easy implementation.
For more complicated calendars (eg: over a months with specific targetted days),
it's better to create specific allocation requests and apply specific leaves
for those days, as it would be the case for parental leaves.

closes odoo/odoo#31674

Signed-off-by: Yannick Tivisse (yti) &lt;yti@odoo.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: Make get_leave_days_data private</title>
<updated>2019-02-18T15:28:15+00:00</updated>
<author>
<name>Yannick Tivisse</name>
<email>yti@odoo.com</email>
</author>
<published>2019-02-14T09:25:17+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=624a1fc56b06c22889da8c1ca7b2cc65d5eebd41'/>
<id>624a1fc56b06c22889da8c1ca7b2cc65d5eebd41</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: Make get_work_days_data private</title>
<updated>2019-02-18T15:28:15+00:00</updated>
<author>
<name>Yannick Tivisse</name>
<email>yti@odoo.com</email>
</author>
<published>2019-02-14T09:14:42+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9cbc68b8ab804a5e72db8c00767969243c35421e'/>
<id>9cbc68b8ab804a5e72db8c00767969243c35421e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch saas-11.3 up to b09f624f207</title>
<updated>2018-11-22T19:06:48+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2018-11-22T19:06:48+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b4e1be8ab07d883637a7f0f00c37d9bbf5ef6ee8'/>
<id>b4e1be8ab07d883637a7f0f00c37d9bbf5ef6ee8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch 11.0 up to 263b388c504</title>
<updated>2018-11-22T16:52:57+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2018-11-22T16:52:57+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b09f624f20781d65baf2060df40383898e6f86e5'/>
<id>b09f624f20781d65baf2060df40383898e6f86e5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: Fix work/leaves hours count methods</title>
<updated>2018-11-21T15:42:48+00:00</updated>
<author>
<name>Дмитро Катюха</name>
<email>dmytro.katyukha@maao.com.ua</email>
</author>
<published>2017-11-28T10:45:39+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f68c5261f9209aba7d8f19a33f1892d863c3c448'/>
<id>f68c5261f9209aba7d8f19a33f1892d863c3c448</id>
<content type='text'>
Purpose
=======

Buggy example:
I have a 35h working schedule. I work every week day:
- From 8h to 12h
- From 12h to 16h

Let's say that I want to retrieve the working hours from Wednesday 14h03
to Thursday 11h03.

The working hours are:
- From 14h03 to 16h --&gt; 1h57
- From 8h to 11h03  --&gt; 3h03
----------------------------
TOTAL                   5h

Currently the result will be 1.95, i.e. 1h57 because the second day
is not taken into account as start time &gt; end time, and thus rrule
doesn't manage this correctly and returns only the datetime corresponding
to the first day.

Specification
=============

Force the until parameter of rrule to be set at the end of the day, do
avoid skipping the second day. Do this in the methods that compute the
work hours and the leave hours.

Add a test to ensure the robustness of the fix.

Closes #21297

closes odoo/odoo#28920</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Purpose
=======

Buggy example:
I have a 35h working schedule. I work every week day:
- From 8h to 12h
- From 12h to 16h

Let's say that I want to retrieve the working hours from Wednesday 14h03
to Thursday 11h03.

The working hours are:
- From 14h03 to 16h --&gt; 1h57
- From 8h to 11h03  --&gt; 3h03
----------------------------
TOTAL                   5h

Currently the result will be 1.95, i.e. 1h57 because the second day
is not taken into account as start time &gt; end time, and thus rrule
doesn't manage this correctly and returns only the datetime corresponding
to the first day.

Specification
=============

Force the until parameter of rrule to be set at the end of the day, do
avoid skipping the second day. Do this in the methods that compute the
work hours and the leave hours.

Add a test to ensure the robustness of the fix.

Closes #21297

closes odoo/odoo#28920</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] resource: increase the rounding factor in resource_mixin</title>
<updated>2018-11-21T13:04:55+00:00</updated>
<author>
<name>RomainLibert</name>
<email>rli@odoo.com</email>
</author>
<published>2018-11-21T11:51:52+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=1d28525d6b9516ab7a380287c55557769aebd087'/>
<id>1d28525d6b9516ab7a380287c55557769aebd087</id>
<content type='text'>
In order to be more precise in the number of hours shown in leaves, we
need more precision in resource_mixin

closes odoo/odoo#28907</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to be more precise in the number of hours shown in leaves, we
need more precision in resource_mixin

closes odoo/odoo#28907</pre>
</div>
</content>
</entry>
</feed>
