For more clarity, we added some fields on the list view of work entry.
task - 3264920
closesodoo/odoo#118050
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit aims to improve usability of work entries by improving the form and adding a default start and end hour going from 9 to 17
task - 3062158
closesodoo/odoo#118252
X-original-commit: 36eca7e6b0ad6b3570ce2478b10ec4da1a157617
Related: odoo/enterprise#39592
Signed-off-by: Kevin Baptiste <kba@odoo.com>
The fix introduced in #110559 was partially wrong, the employee ID was
not properly added to the list and would crash.
> TypeError: 'int' object is not iterable
closesodoo/odoo#117217
X-original-commit: a7914d43d7d1835a76486bb66de753b29a24dd70
Signed-off-by: Kevin Baptiste <kba@odoo.com>
*: hr_attendance,hr_skills_slides,hr_timesheet,hr_work_entry
Don't show smartbuttons that lead to a view without records
task - 3134772
closesodoo/odoo#113105
Related: odoo/enterprise#37274
Signed-off-by: Kevin Baptiste <kba@odoo.com>
before this commit, the pivot view of hr.work.entry model
is not showing the details by default.
after this commit, the pivot view will be expanded by
employee and work entry type and duration is added
as measure for the pivot view.
closesodoo/odoo#115303
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Purpose
=======
Currently the on_delete='restrict' implicit constraint prevents
the user deletion in case it's linked to a personal calendar filter
record.
Set the on_delete attribute to 'cascade' as the record is not
of any usage without the user anyway.
Taskid: 3222941
Part-of: odoo/odoo#114656
Add an external code field on the hr_work_entry model to have
a custom code when exporting the work entries to another system.
task-2929493
closesodoo/odoo#104326
Related: odoo/upgrade#3998
Related: odoo/enterprise#33337
Signed-off-by: Kevin Baptiste <kba@odoo.com>
- Add a new variable to view the initial date in calendar view.
closesodoo/odoo#112548
X-original-commit: e63993764d7e7206ed0bb97de30964b4776d6adb
Related: odoo/enterprise#37031
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Calls to `_error_checking()` would look for every work entries between 2
dates, even if we were only modifying one employee's.
Because of that the leave creation on big production database would take
a long time.
Now the method allows for filtering to the employees.
task-3142610
closesodoo/odoo#110987
X-original-commit: f54b7c34bc89140e2d31f0b602911ec9cda3ed0d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit separate the templates, one for the card and another one for
the menu (the ellipsis dropdown).
The new template, called 'kanban-menu', will only contain the dropdown.
Note that, this behaviour is the same as the one used for the kanban
tooltips.
closesodoo/odoo#107589
Task-id: 3096776
Related: odoo/documentation#3284
Related: odoo/enterprise#34962
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*:
hr_contract
hr_work_entry
hr_work_entry_contract
This commit changes several views and methods to improve general usability of the payroll application
TaskID #2783013closesodoo/odoo#89311
Related: odoo/enterprise#26466
Related: odoo/upgrade#3534
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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
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, ...
closesodoo/odoo#90209
Related: odoo/enterprise#26807
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Reorder smart buttons on the hr_employee to have them in the following order:
1. Documents
2. Holiday status
3. Time Off
4. Planning
5. Timesheets
6. Equipments
7. Cars
8. Contracts
9. Appraisal
10. Work Entries
11. Payroll
12. Attendance
13. Extra Hours
- Log in the chatter the name of the plan that has been started via the button "Launch Plan"
- When on mobile, open the Time Off Calendar in month view
- When sending a sms without any message, only display Message once in the invalid fields
- Avoid the sms-help info disappearing when clicking on it and there are characters in the body of the message
- Update the tooltip of phone number in the send sms wizard
- Avoid the employee name to be displayed on two lines on mobile if the name is too long. Reduce the font size instead
task-2735679
closesodoo/odoo#83745
Related: odoo/enterprise#23886
Signed-off-by: Kevin Baptiste <kba@odoo.com>
The query below
https://github.com/odoo/odoo/blob/81497125d8100c6bdd2dc30434232a88a419a3e3/addons/hr_work_entry/models/hr_work_entry.py#L92-L115
has bad performance without the bespoken indices on `date_start` and
`date_stop`. We can speed it up more with an index on `employee_id`.
This is not enough for DBs with many work entries (500K+), specially
during upgrades.
Here we optimize the query to take into account only the work entries
being modified.
This issue was observed during an upgrade saas~12.3->13.0 where the
payslip recomputation never ends due to the increased amount of hr work
entries created. Note how the first 1K payslips are processed in 1 hour
(~16 payslips per minute), while the latest 3 (before the upgrade
was killed) took 1 min.
```
2021-11-02 21:05:44,403 2229 INFO db_42897 odoo.modules.migration: module hr_payroll: Running migration [$saas~12.4.1.0] end-compute-amount
2021-11-02 21:06:44,577 2229 INFO db_42897 odoo.upgrade: [1.61%] 1120/69635 payslip processed in 0:01:00.036716 (total estimated time: 1:02:12.729213)
2021-11-02 21:07:44,602 2229 INFO db_42897 odoo.upgrade: [2.66%] 1853/69635 payslip processed in 0:02:00.062972 (total estimated time: 1:15:11.918540)
...
2021-11-05 09:59:46,565 2229 INFO db_42897 odoo.upgrade: [47.95%] 33390/69635 payslip processed in 2 days, 12:54:02.025479 (total estimated time: 5 days, 7:00:30.261882)
2021-11-05 10:01:04,990 2229 INFO db_42897 odoo.upgrade: [47.95%] 33393/69635 payslip processed in 2 days, 12:55:20.450549 (total estimated time: 5 days, 7:02:32.725840)
```
opw-2672031
closesodoo/odoo#80898
X-original-commit: 47b7a760c5788782c65136e529c8283fe5f0cce2
Signed-off-by: Nicolas Seinlet (nse) <nse@odoo.com>
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
closesodoo/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>
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.
closesodoo/odoo#74245
Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
- hr_contract: Add kanban view on contract history action
- hr_contract: Display the avg wage, not the sum on aggregates
- hr_contract: Improve contract history list view
- hr_contract: Improve contract history tree view
- hr_contract: Improve contract history search view
- hr_contract: Display wage on contract kanban view
- hr_contract: Improve contract tree view
- hr_contract: Improve contract search view
- hr_contract: Make hr_responsible required
It is useful in multiple HR flows.
- hr_contract: Improve contract history form view
- hr_contract: Improve contract form view
- hr_work_entry: Improve work entry computed name
- hr_work_entry: Improve work entries tree view
- hr_work_entry: Improve work entry type form view
closesodoo/odoo#72402
Taskid: 2558171
Related: odoo/enterprise#19124
Related: odoo/upgrade#2583
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.
Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient
Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.
closesodoo/odoo#69819
Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
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>
Before this commit, 'hours' was on the next row instead of the same line.
closesodoo/odoo#66640
X-original-commit: 6820eef1e9dfe2695560ebcf265a5d69c38e4f91
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
For odoo-master Transifex project, no demo data
closesodoo/odoo#66500
X-original-commit: 813931ac850e5ba4181259a5957ec72226fb670c
Related: odoo/enterprise#16510
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Allow to set the work entry button as primary or secondary.
closesodoo/odoo#66047
Taskid: 2447940
X-original-commit: ab00e33796e3083714649e46beb0514e9333ce74
Related: odoo/enterprise#16299
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Purpose
=======
There is no way for _error_checking() to detect conflicts in work
entries that have been introduced in concurrent transactions, because of the transaction
isolation.
So if 2 transactions create work entries in parallel it is possible to create a conflict
that will not be visible by either transaction. There is no way to detect conflicts
between different records in a safe manner unless a SQL constraint is used, e.g. via
an EXCLUSION constraint [1]. This (obscure) type of constraint allows comparing 2 rows
using special operator classes and it also supports partial WHERE clauses. Similarly to
CHECK constraints, it's backed by an index.
1: https://www.postgresql.org/docs/9.6/sql-createtable.html#SQL-CREATETABLE-EXCLUDEclosesodoo/odoo#64028
Taskid: 2357844
Related: odoo/enterprise#15546
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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
closesodoo/odoo#60136
X-original-commit: 60eaecb749ad68429e4d8ba00ff0200c3360cdcb
Related: odoo/enterprise#14147
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The `_error_checking()` context manager is used to perform validation
and cleanup after changes on work entries, and is implemented using a
try/finally clause.
This mechanism fails to take into account that the alteration operation
can fail due to a concurrent update (in another transaction). In such a
situation the db cursor becomes instantly invalid, and any attempt to
use it will fail with:
`psycopg2.InternalError: current transaction is aborted`.
This exception will be raised in the `finally` block, and will therefore
discard the original TransactionRollbackException.
The result: instead of being silently retried as expected,
the transaction fails and the user receives a cryptic error message.
Steps to repro: repeatedly click on the button to validate a leave
Solution: specifically handle PostgreSQL `OperationalError` exceptions
and do not attempt to use the cursor when they occur - just let the
exception bubble up.
closesodoo/odoo#59612
X-original-commit: 7ba47e7215df69b6556a848532e4f33ef4243e83
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>