Commit Graph
16 Commits
Author SHA1 Message Date
Goffin Simon ec6459d42a [FIX] resource: Wrong default value for Time Efficiency
The time efficiency cannot be set to 0 otherwise it raised an error
when creating a workorder.

opw:752251
2017-07-13 11:12:33 +02:00
Christophe Simonis 3bac72ba74 [MERGE] forward port branch 10.0 up to aaadb232b2 2017-06-26 13:00:18 +02:00
Nicolas Martinelli 34736b0a6c [FIX] resource: force start_dt
Set up:
- Use the usual working schedule from 8:00 to 12:00 and 13:00 to 17:00.
- Set the OS and user TZ to Australia/Sidney TZ (restart your browser)
- Create a BOM with 3 work orders, taking 1, 2 and 3 minutes (you can
  use the 'Assemble Furniture' routing)
- Create a MO using the previously created BOM, e.g. for '[FURN001]
  Computer Desk'

Case 1: Plan to start the next day at 08:00, e.g. 2017-06-08

The result is amazing. The system probably hit a flaw in the space-time
continuum, which can only be explained with M-theory:
- WO1 is planned from 2017-06-08 08:00:00 to 2017-06-07 08:01:00
- WO2 is planned from 2017-06-07 08:01:00 to 2017-06-06 08:02:00
- WO3 is planned from 2017-06-06 08:02:00 to 2017-06-05 08:03:00

Case 2: Plan to start the next day at 11:00, e.g. 2017-06-08

Once again, the result is literally a piece of art:
- WO1 is planned from 2017-06-08 11:00:00 to 2017-06-08 08:01:00
- WO2 is planned from 2017-06-08 08:01:00 to 2017-06-07 08:02:00
- WO3 is planned from 2017-06-07 08:02:00 to 2017-06-06 08:03:00

To solve the problem, a first commit is made in MRP to force the end
date to be larger than the start date. That hides the issue, but it
doesn't solve it.

To prevent the system to hit the 88 mph and go back in time, we force a
'hard limit' to prevent any selection of intervals starting before the
requested start time.

opw-745905
2017-06-19 08:40:19 +02:00
Christophe Simonis 96595772e0 [MERGE] forward port branch 10.0 up to dc8b473a03 2017-06-15 18:35:46 +02:00
Thibault Delavallée 577eb10c0b [FIX] resource: return correct date when planning hours
Planning hours can be done forwards or backwards. In first case the
returned datetime should be the last one aka the date when the job is
finished. In second case it should be the first one, aka the date when
the job begins. Those are the dates user want to know and manipulate when
programming working hours.
2017-06-13 10:56:25 +02:00
Olivier Dony c047b1619c [MERGE] Forward-port 10.0 up to 7d7d6ee5af 2017-06-07 23:48:08 +02:00
Nicolas Martinelli 506ac45537 [FIX] resource: get working hours
- Use the demo resource calendar (40h/week)
- Create a project forecast for the Administrator
- Set the 'Start date' and 'End date' to 2017-07-07
- Plan 8 hours

The % of time should be 100 %, but it's not always the case.

The core of the issue comes from `get_working_hours`.

Case 1:
Call with start_dt = end_dt = 2017-07-07 00:00:00
`get_working_hours_of_date` is called twice with the following start/end
dt:
- 2017-06-07 00:00:00, 2017-06-07 00:00:00        => 0 hours
- 2017-06-08 00:00:00, 2017-06-08 23:59:59.999999 => 8 hours

This is obviously not correct, we don't care about what happens on
2017-06-08. The number of hours is correct in total, but it comes from
the wrong day.

Case 2:
Call with start_dt = 2017-07-07 00:00:00 and end_dt = 2017-07-07 23:59:59
`get_working_hours_of_date` is called twice with the following start/end
dt:
- 2017-06-07 00:00:00, 2017-06-07 23:59:59.999999 => 8 hours
- 2017-06-08 00:00:00, 2017-06-08 23:59:59.999999 => 8 hours

This is obviously not correct either...

We change how the `until` parameter is computed. This way, the correct
call is the second call (Case 2), and `get_working_hours_of_date` is
calld once with the following start/end dt:
- 2017-06-07 00:00:00, 2017-06-07 23:59:59.999999 => 8 hours

opw-745253
2017-06-07 16:10:01 +02:00
Christophe Simonis 777a87cde8 [MERGE] forward port branch 10.0 up to 2ef43281c2 2017-03-13 16:22:57 +01:00
Laurent Mignon (ACSONE) 1dea8a53fb [FIX] resource: correct also microsecond information
A lot of methods are designed to work with pure datetime objects as args. If
the value comes from the database it will be rounded at the level of seconds
(0 microsecond). If it comes from a call do datetime.now() / datetime.utcnow()
the datetime object has a value != 0 for its mircroseconds attribute. Therefore
some methods have unpredictable results depending of the origin of the values
manipulated since the microsecond argument is missing into all the calls to
datetime.replace

Closes #15768
2017-03-09 14:07:58 +01:00
qdp-odoo 4f29b77e3d [MERGE] foward port of 10.0 up to revision 84a650e33a 2016-12-30 17:21:25 +01:00
Thibault Delavallée 84a650e33a [FIX] resource: fix computation of limited attendances
Due to an error introduced when migrating the module at new API
at commit a4e57ea16c limited attendances
having date_from and / or date_to were not correctly taken into
account.

Tests have been added to avoid regression.
2016-12-30 16:38:02 +01:00
cst-odoo 9a777f315e [IMP] resource: Improve time_efficiency help tooltip
Rewrote help tooltip to improve English and clarity.

Closes #14696
2016-12-13 10:04:37 +01:00
Christophe Simonis 3bb022d57c [MERGE] forward port branch saas-12 up to 6f8e40c 2016-10-27 18:17:59 +02:00
Thibault Delavallée 82635140b3 [IMP] resource: add default value on calendar manager being the current user to ease calendar use 2016-09-14 15:44:49 +02:00
Mansi Gandhi a4e57ea16c [MIG] resource: Migrated to new api. 2016-07-13 12:53:34 +02:00
Ravi Gohil 22ef7c15b5 [MOV] resource: Organized/renamed files as per new api guidelines. 2016-07-13 12:53:34 +02:00