Commit Graph
1188 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 6a5497c187 [REF] resource: convert section_one2many
This commit converts the old "section_one2many" field to the new
WOWL field API.

closes odoo/odoo#97984

Related: odoo/enterprise#30789
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-29 13:49:11 +02:00
Denis Ledoux 0501bbd62e [IMP] base: uniform "groups" in back-end view
This revision is to make uniform the behavior of the `groups` attribute
on the Python model fields
and on the node in the view architecture.
In both cases, remove the node from the view completely.

Before this revision,

in a back-end view:
 - In the Python model, if a field has the `groups` attribute set
   and the user is not part of
   the groups, the field is removed, completely, from the view.
 - In the view architecture, if a node has the `groups` attribute set
   and the user is not part of
   the groups, the node is made invisible (not completely removed, just
   made invisible).

in a front-end view:
 - if a node has a "groups" or "t-groups" set and the user
   is not part of the groups, the node is removed from the view.

So it's 2/3 cases removing nodes restricted to a group.
and 1/3 case making invisible nodes restricted to a group.
It's simpler to have a uniform behavior for the 3 cases,
simpler to understandard for developers.

In addition, this will help for the goal to cache back-end views.
It makes possible to convert views using the `groups_id` field
by moving the content of these views directly
in the view to which they add content which is suppose to be completely
removed when the user has not the according group.
By getting rid of the `groups_id` many2many field on `ir.ui.view`,
it makes possible to cache the view architecture without
requiring to use the groups in the cache key.
Currently, if we want to cache the view architecture,
it would be required to use the intersection of the user
groups with the `groups_id` groups of the view,
making it costly to compute the cache key,
therefore altering the performance point to cache the view
architectures.

closes odoo/odoo#95729

Related: odoo/enterprise#29592
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-19 19:10:39 +02:00
Yannick Tivisse f88a4c39b2 [FIX] resource: Fix date/datetime comparison
closes odoo/odoo#96632

X-original-commit: 4cea2adede45e51d5911278897e068bbf0abf792
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-07-27 04:53:13 +02:00
Martin Trigaux 5acb6db891 [I18N] *: export saas-15.4 source terms
closes odoo/odoo#93246

X-original-commit: 5ff6d185f70650c26c28a6aef7dd37c859ab58d2
Related: odoo/enterprise#28218
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-06-10 07:27:26 +02:00
Yannick Tivisse 2f20ec501a [FIX] resource: Allow excluding leaves on list_work_time_per_day
closes odoo/odoo#92368

Taskid: 2862737
X-original-commit: 6fbbc0b6e090ea7209d9ecf37d21f3314b06c833
Related: odoo/enterprise#27809
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-05-30 18:43:47 +02:00
William Braeckman df984fff4e [IMP] resource: improve performance of _attendance_intervals
This commit aims to improve the performance of
`_attendance_intervals_batch`.

The complexity in space has been reduced by a lot.
Prior to this commit an intervals object was generated for each resource
request.
However every resource of the same timezone will share the same ending result.
The number of calls to `localize` and `astimezone` has also been reduced
as they get quite expensive with such a high volume.

Overall we can see a 10x improvement during `test_performance_attendance_intervals_batch`

closes odoo/odoo#90933

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-05-11 16:00:34 +02:00
William Braeckman f51afa1ed4 [IMP] hr_work_entry_contract: prep work for multiple sources
Prep work to allow work entries to be created from multiple sources when
using contracts.
The end goal is to be able to generate work entries from attendance as
well as the planning app.
After that the plan is to make sure the implementation works well with
payroll for hourly wages.

This commit contains the necessary changes for the next work_entry
modules to work.

TaskId-2466871
2022-05-11 11:23:04 +02:00
Victor Feyens 42bad1a6d2 [IMP] *: remove useless keys from manifests
Remove most values uselessly specified because giving the same value as 
the default one (see _DEFAULT_MANIFEST in odoo/modules/module.py)

* auto_install is Falsy by default
* author is Odoo SA by default
* summary & description are empty strings by default
* application is False by default
* test, demo, depends and data are empty lists by default

This will reduce noise/inconsistencies between manifests specifications, 
simplify analysis of manifests content, ...

closes odoo/odoo#90209

Related: odoo/enterprise#26807
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-05-03 13:31:16 +02:00
Victor Feyens b3869ab297 [IMP] resource, hr: avoid updating resources directly after their creation
Make sure related values are correctly propagated to the
resource.resource creation, and discard the inverse update post record
creation when it doesn't change anything

closes odoo/odoo#85601

Related: odoo/enterprise#25664
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-29 10:56:25 +02:00
Vincent Larcin d2716b3f6c [FIX] resource: update default calendar timezone on first admin login
When the admin user logs in for the first time, their timezone can be updated based on the cookies of their browser.
In such case, the timezone of the default working calendar should be updated too.

Related: https://github.com/odoo/odoo/pull/83262/

Task 2759592

closes odoo/odoo#87061

X-original-commit: 3c56be1732d219ed69efe5f18bd7931959b7c333
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-25 12:40:00 +01:00
Dossogne Bertrand 2bde9ebcc3 [IMP] hr_leave: improve leave ux
Small changes in the layout of the hr_leave form view,
mainly for the manager's view point

Task : #2734842 [Time Off] ux changes

closes odoo/odoo#82976

Related: odoo/enterprise#23896
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-03-04 14:07:50 +00:00
Victor Feyens cf6855995c [IMP] resource: batch calendar resources creation
closes odoo/odoo#85532

Related: odoo/enterprise#24843
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-01 10:53:43 +00:00
Yannick Tivisse 1da5b4e802 [IMP] resource: Move test models in their own module
Purpose
=======

When creating resources, SQL request were made to this test table.

Part-of: odoo/odoo#85133
2022-02-28 17:27:07 +00:00
Florian Charlier ca0f936dd1 [IMP] hr+resource: populate: link users and resource calendars
Previously for `appointment`, now for `appointment_hr`, the computation of
users' availability for appointment slots can be dependent on that person's
work schedule if:

* The user is linked to an employee
* The user's employee has working hours defined (resource calendar)

This commit provides working hours to all employees and a user to some, within
a multi-company setup.

Task-2728093
See odoo/enterprise#22642

closes odoo/odoo#80688

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-02-01 14:37:37 +00:00
Vincent Larcin 690ac6bfb5 [FIX] resource: use admin timezone for the default working calendar
When creating a new working calendar, its timezone is set to the one of the user creating the record.

However, when first installing the resource app, the timezone of the default working calendar is always UTC regardless of the timezone of the users.

To fix this, this commit sets the timezone of the default working calendar to the timezone of the admin instead.

Task 2744201

closes odoo/odoo#83480

X-original-commit: 2ddddd0253db402542ab6359026888acd61c2464
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-01-27 13:04:04 +00:00
Audric Onockx (auon) 2933d5eb5b [FIX] resource : compute the correct default dates when planning a shift
Steps :
- Install Planning
- Users > Mitchell Admin > Preferences > Timezone :
	Europe/Brussels
- Settings > Employees > Company Working Hours > Timezone :
	Japan
- Planning > Gantt View > Week > Mitchell Admin x Friday > Click "+" button

Issue :
- Start date is set by default to Thursday 05:00
	whereas it is expected to be set on Friday 00:00

Cause :
- When we want to plan a shift on a day,
	we look into the 00:00 to 23:59 range for this day in calendar's tz
	to get the closest work time inside of it.
- Yet, this doesn't take the "resource user" into account.

Fix :
- Set these limits for the day in resource's tz.

opw-2678221

closes odoo/odoo#82555

X-original-commit: 1b248ebd58e0a57b070ebf7d67c6da78351a720a
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-01-12 16:43:24 +00:00
Prakash Prajapati 16246f8374 [FIX] resource: fix the maximum recursion depth traceback
Maximum recursion depth traceback occurs when the resource is created from planning.
This has been fixed.

Reproducing steps:
         - Planning
         - Schedule by Resource
         - Create new Resource

The issue occurs from this commit -https://github.com/odoo/odoo/commit/18952cdc76070f2a70789f2fa25e4fa0d546d470

closes odoo/odoo#81840

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-12-23 13:14:22 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Thibault Libioulle 74624f43ee [REF] resource,hr{,_contract}: obtain calendar validity per resource
This commit adds methods to easily obtain calendar validity per resource
for a given search period and get the work intervals per resource,
taking into account the validity of their calendars.

In hr, the create and departure date of an employee are taken into
account to compute the calendars validity.

In hr_contract, it looks for every contract of human resources with
employee of type student or employee existing in the search period and
consider the specific calendar of the contract as valid during the
contract-lifetime.

PR: #77362

task-2646630
2021-11-30 12:20:47 +01:00
Thibault Libioulle be23e7436d [IMP] resource: speedup tests
This commit replaces the setUp method by a classmethod in order to speed
up the tests.

PR: #77362

task-2646630
2021-11-30 12:20:31 +01:00
Thibault Libioulle 6d41b7ec7e [IMP] resource: add the false key to work intervals batch
The False key is always added in attendance and leave intervals batch
but is not added in the work_intervals batch.

To give a more smooth API, this commit aligns work_intervals behavior
with the two other methods behavior, regarding the added False key.

Furthermore, we avoid to deal with a resource_list of two empty
recordsets, in the case where the resources parameter is None or empty
recordset.

PR: #77362

task-2646630
2021-11-30 12:20:31 +01:00
Bonis ModiandKartik Chavda f4c054e473 [IMP] project, hr_timesheet, *: improve generic ux
Purpose of this commit to improve generic UX for the project app.

So, In this commit done following changes:

- add 'subtask_effective_hours' and 'total_hours_spent' fields in the page of
subtask in task form view.
- change invisible attrs to column_invisible attrs for block_by page in task
form view.
- add 'task in progress' subtype for project.task and move 'stage changed'
subtype above 'task blocked'.
- remove the 'is_close' field and all its references from project.task.type.
- unarchive all of its tasks when the user unarchives the task stage.
- sort projects on 'is_favorite'.
- internal users following the project automatically follow its updates and
their notification preferences propagated accordingly.
- duplicating a task will duplicate all of its subtasks.
- move parent task field in extra info page of task form view.
- change the label of 'edit' to 'view' in the burger menu of project kanban view.
- user can delete task without sale_order validation error.
- add constraints for 'seller_ids' field.
- add remaining_hours_so field in task tree view.
- add unusual_days in task calendar view.
- add 'no content helper' in action of burndown chart.

task-2536044

closes odoo/odoo#74018

Related: odoo/enterprise#19880
Related: odoo/upgrade#2801
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Co-authored-by: Kartik Chavda <kcv@odoo.com>
2021-11-23 12:04:00 +00:00
Philippe Wauthy da642c06e3 [IMP] resource: allow to use _adjust_to_calendar with or without leaves
Allow to use _adjust_to_calendar with or without leaves.
This PR adds a keyword argument to the _adjust_to_calendar, _get_closest_work_time and _work_intervals_batch to include or not the employee being on leave when searching for the start and end of the shift.

task-2632775

closes odoo/odoo#79127

Related: odoo/enterprise#21944
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-11-12 16:34:58 +00:00
Philippe Wauthy 88d0c49604 [FIX] resource: timezone end before assigning search_range
The end datetime is not timezoned in _adjust_to_calendar before defining the search_range and using the _get_closest_work_time method.
Since _get_closest_work_time will timezone the timestamp received to start searching, the search interval needs to refer to the same end timestamp to avoid erratic behaviors.

Task-2628876

closes odoo/odoo#79049

X-original-commit: cbf0cb6e210959b3ceea554ec68957416a125141
Related: odoo/enterprise#21915
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-10-27 21:06:48 +00:00
William Braeckman faefaf7c39 [IMP] resource: improve _attendance_intervals_batch perf
Improves on _attendance_intervals_batch to profit more from batching.
Resources are grouped by timezone since we know they will all have the
same result except for when there are resource assigned attendances.
Those have to be handled separately but are incoroporated in the same
routine.

TaskId-2674527

closes odoo/odoo#78741

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-10-26 13:22:27 +00:00
William Braeckman 4fbff6a9d4 [FIX] resource: fix timezone being overwritten
If no timezone is given to _attendance_intervals_batch, the timezone was
overwritten by the first resource's timezone.

TaskId-2674527

Part-of: odoo/odoo#78741
2021-10-26 13:22:27 +00:00
Philippe Wauthy fd69a22410 [IMP] resource: assign a search_range for calendar_end
Assign a search_range for calendar_end in the _adjust_to_calendar method in all conditions.
The search_range was only assigned a value if the start and end are on the same date before.

The _adjust_to_calendar method receives a start and end from midnight to midnight in the resource timezone.
Start and end datetimes can be set on a different day via the Gantt view set in month or year for example.
This commit ensures that a search_range is always assigned to find the calendar_end and not only when start and end are on the same day.
This allows to find the end of a shift searched over two days if the employee is only working one day.

Task-2628876

closes odoo/odoo#78746

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-10-26 07:47:47 +00:00
Philippe Wauthy 3708c7982e [FIX] planning: fix sorting of records in Gantt view
Steps to reproduce:
Open the gantt view and add a few shifts for different resources

Observed behavior:
https://nimb.ws/1t38Jl resources are not sorted by alphabetical order

Expected behavior:
https://nimb.ws/NqIAG3 resources should be sorted by alphabetical order

task-2633936

closes odoo/odoo#76621

X-original-commit: 9c4ed2bcadc417a2927877902c4c275e5d9d16d5
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-09-16 07:18:15 +00:00
Martin Trigaux ef8ad324b0 [I18N] *: export 15.0 source terms
closes odoo/odoo#76542

X-original-commit: 63e6807437295519a0f4705fb88644d6d557ca3a
Related: odoo/enterprise#20882
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-16 07:17:40 +00:00
254d6a71e8 [IMP] hr_holidays: Improve Accruals, dashboards and general UX (Back2basics)
Purpose
=======

Time Off : New Dashboard, Accruals feature, Public holidays, New time off type configuration view.

- Review of Dashboard
- Accrual feature : Currently, when you create an allocation, it's possible to create an
  Accrual, but there is no appraisal Plan. An Appraisal plan is use to define steps of accruals
  for each employee.
  In Belgium, we use accrual Allocation for European Leaves, or compensatory hours, it's a
  simple use case.  But in USA, it's possible to change the calculation mode each year.
  Also, in USA, it's possible to deal your accrual plan when you arrive on the company. It's a
  HR Officer task to create the right Accrual allocation for each new employee.
- Public Holidays :
  Improvement of global time off feature located on Working hours calendar. Now, Time off
  application have to manage Public Holidays.
- Review of Time Off type configuration

COM PR: https://github.com/odoo/odoo/pull/72511
ENT PR: https://github.com/odoo/enterprise/pull/19157
UPG PR: https://github.com/odoo/upgrade/pull/2791
TaskID:2475413

closes odoo/odoo#72511

Related: odoo/enterprise#19157
Related: odoo/upgrade#2791
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: William Braeckman <wbr@odoo.com>
Co-authored-by: Xavier BOL (xbo) <xbo@odoo.com>
Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2021-09-02 12:57:03 +00:00
jdoutreloux a8e6b57fef [IMP] resource,web : modifies the timezone_mismatch widget
This modifies the widget to allow a title option.

Task-2352428
Closes #67021

Related: odoo/upgrade#2223
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-08-31 19:54:19 +00:00
Kevin Baptiste fe161c2105 [IMP] resource: improve resources views
Improve the UX of the different resource.resource views.

closes odoo/odoo#73822

Taskid: 2566432
Related: odoo/enterprise#19695
Related: odoo/upgrade#2649
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-08-24 10:55:22 +00:00
Xavier-Do 288595f558 [FIX] *: add explicit license to all manifest
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.

closes odoo/odoo#74245

Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-26 13:09:57 +00:00
Martin Trigaux 6758868731 [I18N] *: export saas-14.4 source terms
Without demo data

closes odoo/odoo#73560

X-original-commit: 802e46541117573e028b711ea33dad9df9075a39
Related: odoo/enterprise#19602
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-07-12 10:57:37 +00:00
Adrien Widart 13266efa6b [FIX] resource: allow a working time of 24 hours
It is not possible to define a working time that lasts a whole day. This
can lead to calculation errors.

To reproduce the error:
(Need mrp,hr_payroll)
1. In Settings, enable:
    - Work Orders
2. Create a Work Center WC
    - Working Hours: <Create and Edit>
        - 2 shifts:
            - Monday, From 0 To 24
            - Tuesday, From 0 To 24
3. Create a routing R:
    - Add an operation:
        - Work Center: WC
        - Default Duration: 1440 (i.e., 24h)
4. Create a Bills of Materials BM
    - Routing: R
5. Create a MO:
    - Bill of Material: BM
    - Plan From: Next Monday
6. Save, Mark as ToDo, Plan

Error: Since the operation should last 24 hours, the end time should be
the same. However, the Planned Date field is incorrect: the end time is
one minute too late. This error is even more noticeable when increasing
the quantity to be produced.

On step 2, when setting the 'Work to' field to 24, it automatically
becomes 23:59. The first consequence is directly observable on working
time form: we should have a total of 48 hours/week but the current total
is 47.98 hours/week. Another consequence is the end of the planned date
(as described above).

OPW-2462094

closes odoo/odoo#72210

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-06-16 07:09:22 +00:00
Julien MougenotandSimon Genin 03641610c2 [REF] *: convert all modules to new asset system
Conversion of all modules to the new manifest assets declaration.

Part of task: 2352566

Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Simon Genin <ges@odoo.com>
2021-03-31 13:57:18 +02:00
Yannick Tivisse cf7e386032 [FIX] resource: Correctly pass domain if set
closes odoo/odoo#68536

X-original-commit: 62a01fa6ff2f1f078b333f5d8bb16d73d0921bdb
Related: odoo/enterprise#17371
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-30 11:24:21 +00:00
Martin Trigaux 3f13751e9b [I18N] *: export saas-14.1 source terms
Without demo data

closes odoo/odoo#63238

X-original-commit: 4e6683973b1d1ecc67f1312a8ef98b1272e2d5a5
Related: odoo/enterprise#15268
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-12-11 12:30:42 +00:00
Yannick Tivisse 0078a21876 [IMP] resource: Remove deprecated methods 2020-12-08 10:22:36 +00:00
Yannick Tivisse 0b07defece [IMP] resource: Index calendar/resources on calendar leaves
Improves performances, notably on the method  https://github.com/odoo/odoo/blame/14.0/addons/resource/models/resource.py#L487

closes odoo/odoo#62821

X-original-commit: fc962de2b60adaa1ffa3bf70bfadc5c3d17867b3
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-12-03 13:00:41 +00:00
fw-bot 53f877bf38 [FW][MERGE] l10n_be_hr_payroll: Clean tests + Handle threshold for training time off + ATN for 0€ payslips
closes odoo/odoo#62697

Taskid: 2393750
Forward-port-of: #15020
Related: odoo/enterprise#15077
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-12-02 08:48:09 +00:00
Victor Feyens f09afc4241 [REM] resource: remove duplicate constraint
The constraint is already enforced at the SQL level,
there is no need to add a duplicate python constraint to
verify the same thing.

Task Id: 2328664
COM PR: https://github.com/odoo/odoo/pull/55525
ENT PR: https://github.com/odoo/enterprise/pull/12250
2020-11-20 10:04:27 +00:00
Martin Trigaux e433bc57ff [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#61804

X-original-commit: f5d0f4a1ebf406583889e9e04912d40c0693343e
Related: odoo/enterprise#14769
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-16 16:47:28 +00:00
Yannick Tivisse c5550eed5a [FIX] resource: Fix erroneous date/datetime comparison
closes odoo/odoo#60975

X-original-commit: febd3251aa970f6711f303d539eeeabebf16e818
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-29 11:42:31 +00:00
Yannick Tivisse f3c1a8fbd9 [FIX] resource: _get_resources_day_total is ensure_one
closes odoo/odoo#60974

Valueerror: Expected singleton: resource.calendar()
X-original-commit: af94ac4b4a25048adfd82f1de7fe2dc09755fd56
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-29 11:41:15 +00:00
fw-bot 2be103239f [MERGE] l10n_be_hr_payroll: Validate the CP200 different payslips
Purpose
=======

In Belgium, the job market is divided into "sectors": chemicals, metals, banks,
department stores, pharmacies ... This breakdown is made on the basis of the
activities of the company. In order to be able to ensure the functioning of the
sectors, each sector has its own consultation body, called the "joint commission".

A joint committee is a consultation body in which representatives of employers
and unions set, after negotiation, the minimum wage conditions as well as the
working conditions in legal texts, called “collective labor agreements”. These
are applicable to all employees in a specific sector.

These are agreements that employers and workers in a given sector must make and
respect. These agreements may be different from one sector to another. Each sector
has its label and number.

The CP 200 is the auxiliary joint committee of employees (CPAE). About a quarter
of private sector companies and employees in Belgium are found in CP 200. This
makes it the largest and most diverse CP in the country!

TaskID: 2352568

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

Most of the different use cases that we can face in belgian payroll for CP200
have been tested and validated by a fiscal expert.  Briefly, it covers the following
use cases:

- Unpaid time off
- Legal time off
- Credit time
    - Classical
    - With paid time off
    - With unpaid time off
    - With sick time off
    - Starting in the middle of a month
    - Full time (O hours / week)
- Half-days in working hours
    - Classical
    - With full-day time off
    - With half-day time off
- Low salaries
- Back-to-work - Sick time off
    - Relapse
    - Guaranteed salary
    - Long sick off (+1 month)
- Student contracts
- Posted Employess
    - Without ONSS
    - Wihtout withholding taxes
- Public Holiday
    - Classical (during the working hours)
    - Compensation (during the week end)
    - After the end of the contract
    - Note: Variable compensation is not handled yet, but it's planned
- Brief Holiday (In french: "Petit Chômage")
    - 1 day
    - 1 week
    - Note: Variable compensation is not handled yet, but it's planned
    - 1 day for unpredictable reason
- End of contract in the middle of the month
- Half-days time off
- New design of the payslip to improve readability

The detailed list of the fixes/improvements is the following:

- 1/ hr_work_entry_contract: Define 1 leave work entry per presence

    Purpose:
    Some sick time off have to be defined into different work entry types, according
    to the type of sick leaves.

    Example: after 30 calendar days of sick leaves, the employee is not paid by the
    same organism and therefore, the time off should be reported into different work
    entry types.

    Specification:
    Instead of creating a big work entry per time off, create as many work entries
    as there should have been presence work entries.

- 2/ hr_work_entries: Prevent users deleting work entries

    Prefer to archive them instead.

- 3/ hr_work_entry: Display work entry type on calendar views

- 4/ web: Add styling classes for report

    Purpose:
    Those classes are useful for the payslip printed pdf reports, but some
    of them are useless for any kind of report, and thus the classes have
    been defined in the web addons.
    Task-2341886

- 5/ resources: Take company attendances/global leaves on creation

    Purpose:
    When creating a new calendar (38 hours/week) on a Belgian company,
    the new calendar is prefilled on a 40 hours/week basis, even if the
    company calendar is correctly defined.

    Specification:
    Copy the global time off + the attendances on the company calendar
    on company modification

- 6/ hr_holidays: Allow to refuse overlapping time offs

    Purpose:
    It's normally not possible to create 2 time off that overlaps on the
    same period.

    But, if for a given reason it happens on a production database, it should
    be possible to refuse those time off. Otherwise, the user is stuck with
    this wrong configuration.

- 7/ hr_holidays: Prevent creating time off of 0 hours

    Purpose:
    It makes no sense + it could cause conflicts when generating the work
    entries

- 8/ resource: Add method to retrieve the longest work day

    Purpose:
    Add a method on the calendar to retrieve the maximum number of hours
    an employee is supposed to work.

    Example:
    Monday: 8-12, 13-17
    Tuesday: 8-12, 13-17
    Wednesday: 8-12
    Thurday: Off
    Friday: Off

    The method will return 8

- 9/ hr_holidays: Adapt query counter due to changes on hr_payroll

    See: https://github.com/odoo/enterprise/pull/13848/

- 10/ hr_payroll: Update translations

    Lots of new terms have been added on the printed reports, etc...

- 11/ l10n_be_hr_payroll: Consider out of contract public holiday

    Purpose:
    If there is a public holiday less than 30 days after the end of the
    contract, the employee should be paid for that day too

- 12/ l10n_be_hr_payroll_posted_employee: Add an easy way to create a public time off

    Purpose:
    Public time off should be created via the calendar (at least for belgian companies using payroll).

    The reason behind this is that there should be a resource.calendar.leaves available even if the
    employee ends its contract. If it's created using a hr.leave, there won't be any
    resource.calendar.leave as the employee is not supposed to work anymore at that time.

    When an employee leaves the company, it's possible that he's paid for public time off if it
    occurs less than 30 days after the end of his contract.

- 13/ l10n_be_hr_payroll: Rename bank holiday into Public holiday

    Purpose:
    A bank holiday is a specific holiday name, not the generic one.

- 14/ hr_work_entry_contract: Add menuitem to access calendars

    It shouldn't be required to enter debug mode to access this information.

- 15/ l10n_be_hr_payroll_posted_employee: Add support for posted employees

    Purpose:
    https://www.socialsecurity.be/citizen/fr/travailleur-salarie-occupe-en-belgique-detache-a-l-etranger

- 16/ l10n_be_hr_payroll: Implement guaranteed wage/relapse for sick leaves

    Purpose:

    Guaranteed salary for employees:
    The employee who is incapacitated for work as a result of a work accident, an accident on
    the way to work or an occupational disease retains, at the employer's expense, the right to
    his remuneration for the first 30 days of incapacity for work. The daily allowances relating
    to this period are paid to the employer by the body responsible for industrial accidents or
    by the Fund for Occupational Diseases.

    Successive disabilities - relapse:
    It is possible that a worker will be unable to work during different successive periods.

    When two incapacities follow one another without interruption (for example, accident followed by
    illness; successive illnesses of a different nature), there is only one period of incapacity and
    the guaranteed remuneration is not due again. time.

    On the other hand, we talk about relapse when a new disability occurs after the worker has returned
    to work normally.

    In this case, the guaranteed remuneration is not due again when the new incapacity for work occurs
    within the first 14 days following the end of a period of incapacity for work giving rise to the
    payment of the guaranteed remuneration.

    However, there is still a right to the guaranteed salary for the part remaining to run, if the first
    period of incapacity has not exhausted the entire right to the guaranteed salary during the first
    period of incapacity. A new guaranteed wage is also due again when the worker establishes by a
    medical certificate that this new incapacity for work is due to another illness or to another
    accident.

- 17/ hr_work_entry_contract: Define 1 leave work entry per presence

    Purpose:
    Some sick time off have to be defined into different work entry types, according
    to the type of sick leaves.

    Example: after 30 calendar days of sick leaves, the employee is not paid by the
    same organism and therefore, the time off should be reported into different work
    entry types.

    Specification:
    Instead of creating a big work entry per time off, create as many work entries
    as there should have been presence work entries.

- 18/ test_l10n_be_hr_payroll: Add test for full time credit time

- 19/ test_l10n_be_hr_payroll: Add test for out of contract credit time

- 20/ test_l10n_be_hr_payroll: Avoid undeterministic bug on generated tests

- 21/ hr_payroll: Don't display out of contract line on pdf

- 22/ test_l10n_be_hr_payroll: Fix undeterministic test crashes

- 23/ payroll : Improve the printed payslip report

    Improves the design of the payslip report
    Generates the report in the employee's language (add a message if the lang is not official)
    Adds some data to Laurie Poiret
    Task-2341886

- 24/ test_l10n_be_hr_payroll_account: Add test for unjustified reasons

- 25/ test_l10n_be_hr_payroll_account: Add tests for small unemployment

- 26/ test_l10n_be_hr_payroll_account: Add tests for half days time off

- 27/ test_l10n_be_hr_payroll_account: Fix false positive

- 28/ hr_holidays: Prevent creating time off of 0 hours

    Purpose:
    It makes no sense + it could cause conflicts when generating the work
    entries

- 29/ test_l10n_be_hr_payroll_account: Add test for end of contract

- 30/ test_l10n_be_hr_payroll_account: Add tests for public holidays

- 31/ hr_payroll: Display amount if hourly wage

- 32/ hr_work_entry_contract: Allow creating record on gantt view

- 33/ l10n_be_hr_payroll: Add new structure for student employees

    Purpose:
    Also bring some fixes on fields display + hours/days counts
    TaskID: 2347843

- 34/ test_l10n_be_hr_payroll_account: Add test for low salaries

    Ensure the correct computation of the employment bonus.

- 35/ l10n_be_hr_payroll: Make separate lines for half/full worked days

    Purpose:
    Worked days should be separated between the complete full days and the
    half days.

    Example:
    I work on Monday, Tuesday, Wednesday (half day)

    The calculation is OK, but the number of days is, in principle, 14 in the month of
    September 2020 (9 full and 5 in half-days). This number of days should be the subject
    of 2 separate lines:

    9 days - 68.4 hours - € 1,100.77
    5 days (in the form of half-days) - 19 hours - 224.33 €.

    In this case, we cannot use the hourly formula since the monthly salary must always be
    the same, without having an identical number of working days.

    The worker benefits from 14 meal vouchers. The number of days must however correspond
    to the number of meal vouchers so that the worker can check.

- 36/ test_l10n_be_hr_payroll: Test credit time with sick leaves

- 37/ test_l10n_be_hr_payroll_account: Test credit time with unpaid leaves

- 38/ l10n_be_hr_payroll: Don't consider time off as credit times

    Purpose:
    When generating the work entries, we compare the standard attendances
    (i.e. the full time contract) and the credit time attendances to
    deduct the intervals on which the employee is on credit time.

    But if the employee is on a time off during a period, those intervals
    will be removed from the supposed attendances, and then those periods
    are considered as credit time.

- 39/ l10n_be_hr_payroll: Fix credit time amount on payslip computation

    Purpose:
    The time credit days must not include a corresponding amount.

    In fact, no remuneration is linked to the taking of time credits. The necessary modifications
    are:
    Code LEAVE300 -> no amount

- 40/ hr_payroll: Export standard calendar if needed on payslip export

- 41/ l10n_be_hr_payroll: Fix worked days lines amount computation

    Purpose:
    The amount was computed as a simple ratio based on the number of days.

    To be correct and compliant with the law, we should consider the hourly
    equivalent wage, and compute the amount based on the worked hours.

- 42/ l10n_be_hr_payroll: Fix unpaid worked days amount computation

    Purpose:
    Don't use the normal wage which is an integer btw.

    Compute the worked days amount using the classic hourly computation formula

- 43/ l10n_be_hr_payroll: Fix unpaid leaves retenues formula

    Purpose:
    Unpaid leave must be deducted from the usual gross monthly salary
    up to the number of working hours concerned.

    The formula is in principle the following:
    gross monthly salary * 3/12/38 -> “usual” hourly salary.

    So, in the case of 2 days of unpaid leave, corresponding to 15.2 hours,
    the formula is as follows: 2650 * 3/13/38 * 15.2 = 244.61 €.

    The gross for the days actually worked is € 2,650 - € 244.61, or € 2,405.39

- 44/ hr_payroll: Generate python test from arbitrary payslip

    When the payroll is incorrect, the feedback that we receive is
    generally: "this doesn't work".

    This commit add a route in the controller of hr_payroll, to export
    in a python file, all data useful to reproduce the exact employee
    situation about the incorrect payslip.

    Before testing and fixing the incorrect payslip, we need to anonymize all
    sensitive data about the employee. This commit converts all sensitive
    data into demo data.

    This commit add a button in payslip form view to use the new route to
    export all data about the incorrect payroll.

    This button is only displayed when we are in debug mode and the current
    user is a payroll manager.
    task-2337786

closes odoo/odoo#60136

X-original-commit: 60eaecb749ad68429e4d8ba00ff0200c3360cdcb
Related: odoo/enterprise#14147
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-15 19:54:53 +00:00
Martin Trigaux e79531c136 [I18N] *: export 14.0 source terms
Including demo data this time

closes odoo/odoo#58862

X-original-commit: 575abde110acb3d12b25f177a863374becef0894
Related: odoo/enterprise#13705
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-29 17:52:02 +00:00
Victor Feyens 594ccdcbf4 [FIX] *: typos and english incoherences
Mainly transifex issues but also some errors found through 'grep' checks.

Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).

closes odoo/odoo#57276

X-original-commit: 4214f05d454bca2b60fda3a288d529c098e84f77
Related: odoo/enterprise#13053
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-09-08 18:12:26 +00:00
alt-odooandPierreCourt e8f81ae39c [FIX] resource: attendance intervals should be expressed in resource timezone
closes odoo/odoo#57053

X-original-commit: efec3e57c2eeda188e0dd2cc7c7413987d58513e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
Co-authored-by: PierreCourt <pco@odoo.com>
2020-09-03 15:20:09 +00:00
Martin Trigaux 90d85eb9c5 [I18N] export saas-13.5 source terms
Without demo data

closes odoo/odoo#56869

X-original-commit: 33f251b6489455cd7221f2c62dee0400a69784b8
Related: odoo/enterprise#12836
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-01 11:18:00 +00:00