Commit Graph
92 Commits
Author SHA1 Message Date
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
Kevin Baptiste a3a42f335c [IMP] hr_contract: restrict HR Responsible to contract's company
HR Responsible should be limited to the employee's of the contract's
company.

closes odoo/odoo#78320

Taskid: 2668125
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-10-19 10:50:58 +00:00
Yannick Tivisse 0ca0fdcee3 [IMP] hr_contract: Make a method callable on an empty recordset
closes odoo/odoo#76604

X-original-commit: 7126040738cabe7d16412224f7b3baa1d41df014
Related: odoo/enterprise#20912
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-09-16 11:19:50 +00:00
Yannick Tivisse 5193594a64 [FIX] hr_contract: Fix multi-company issue on api.constrains
Purpose
=======

Avoid mismatch between contracts from different companies and clarify
error message.

closes odoo/odoo#75553

Related: odoo/enterprise#19647
Related: odoo/upgrade#2777
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-08-30 16:47:49 +00:00
Yannick Tivisse 56d8c387ba [IMP] hr_contract: Display first contract date on employee public form
Purpose
=======

The "first contract date" is a usefull information for anybody who onboards
new colleagues. Issue: this information is not on the "public employee" and so,
visible only by hr officer (minimum).

With this task, we would like make this field public and visible by any internal
user in the system. In this way, we don't have to provide too many access rights
to any employees.

closes odoo/odoo#73552

Taskid: 2584098
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-07-12 10:07:17 +00:00
Yannick Tivisse e91e6307e6 [IMP] hr_contract: Improve general UX (back2basics)
- 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

closes odoo/odoo#72402

Taskid: 2558171
Related: odoo/enterprise#19124
Related: odoo/upgrade#2583
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-06-28 14:39:44 +00:00
dht-odoo 5ce7ad709c [IMP] hr: improves field type from text to html
Replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).

Models -> Fields

1) fleet.vehicle -> description
2) fleet.vehicle.log.contract -> notes
3) hr.job -> description
4) hr.contract -> note
5) hr.leave.allocation -> notes
6) hr.applicant -> description
7) lunch.product -> description
8) lunch.order -> product_description
9) lunch.product.report -> description

Task Id: 2499504

X-original-commit: afe52b050a7667f3f20696cd48cd922f635a941c
2021-06-07 05:24:08 +00:00
William Braeckman a5bcd6b1b9 [IMP] hr,hr_contract: hide fields according to country
Hide fields related to belgian localisation when not using a belgian
company.

Task Id: 2496597

closes odoo/odoo#69691

Related: odoo/enterprise#17881
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-05-19 07:28:31 +00:00
Raphael Collet 35a9f6c27a [FIX] core: SELF_READABLE_FIELDS and SELF_WRITEABLE_FIELDS on res.users
Avoid setting up those lists with method __init__() on the model, since
the model's class no longer has the expected parent classes.
2021-05-06 07:30:24 +00:00
Yannick Tivisse 14fa57788d [FIX] hr_contract: Add index for resource_calendar_id on hr.contract
X-original-commit: 8f174020d2dc8f8de81fe0c52e6fbba5c527a8a3
2021-04-28 19:36:23 +02:00
Yannick Tivisse 6c11a1c15b Revert "[FIX] hr_contract: update date_end when closing contract"
This reverts commit 825b533ec964fd8a9923dd4d2091f122b92d8759.

For the following reasons:
- This is a behavior change on a stable release. See our stable policy:
  https://github.com/odoo/odoo/wiki/Contributing#what-does-stable-mean
- If a contract end date is set, it's erased when moving the contract afterward.
- There is a cron which is moving the expired contracts automatically,
  this will rewrite the end date on it, which is not a big deal, but this
  is useless.
- Modifying the contract end date also unlink all the work entries that are
  outside of the new contract period. If there is an open payslip, it also
  recomputes the worked days lines, and the payslip lines.
  That way, it's possible to recompute a payslip by introducing unpaid
  time off inside of it. If the payroll officers are checking the payslips
  at that time, and don't notice it (already checked, etc...), then at the
  validation, this could lead to some more serious issues (wrong net salary
  paid to the employee, wrong accounting entries, wrong declaration to the
  state, etc).

If the contract end date is badly configured, this is normal that the
reporting is wrong. No need to add some magic that people don't understand,
that could lead to wrong behaviors later on the process.

closes odoo/odoo#68541

X-original-commit: c34b6bc3d0d25e8b8b1bcb6684331627b823f57d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-30 12:17:20 +00:00
Yannick Tivisse 8444643cc6 [FIX] hr_contract: Allow manager to modify current employee contract
closes odoo/odoo#68259

X-original-commit: c60672e123e996a82a706a8aed5456ddd2288578
Related: odoo/enterprise#17259
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-03-25 10:24:19 +00:00
Yannick Tivisse b74dcb975d [FIX] hr_contract: Include archived employees on _get_all_contracts
Purpose
=======

When we want to retrieve all the contract (running for instance), we
don't care about the fact that the employee is archived or not.

For example when we generate the work entries to generate the payslips,
we actually pay the employee, even if he's archived (which is the
normal flow).

closes odoo/odoo#66836

X-original-commit: 262bf8598f9d885382c05e523543019767b521bf
Related: odoo/enterprise#16677
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-25 12:34:31 +00:00
Adrien Widart 1ba41abed3 [FIX] hr_contract: update date_end when closing contract
When changing a contract's state to "Expired", if the contract has an
end date, the latter is not updated. As a result, contracts' reporting
contains some error.

To reproduce the error:
1. Create an employee E
2. Create a contract C
    - Employee: E
    - Start date: in the past
    - End Date: in the future (! at least after the current month)
3. Set contract's state to "Expired"
4. Go to Employee > Reporting > Contracts
5. On pivot view, change the rows:
    - Total must be split into "Date > Month"
    - Current month must be split into "Employee"

Error: on current month, "# Departure Employee" of E-employee is 0. It
should be 1. This value's computation is based on `contract.date_end`,
but when changing the state to "Expired", the variable will not be
updated if it already has a value. So "# Departure Employee" will be
equal to 1 for the month of end date defined on step 2, instead of
current month.

Note: The fix result can not be directly tested. The end date must be
done for the departure to be effective (`contract.date_end` < 'today').
Since this fix updates `contract.date_end` to 'today', "# Departure
Employee" will not count this contract until the following day.

OPW-2445504

closes odoo/odoo#66002

X-original-commit: 3cfc1e7dc3ad8396a92d12f74b65485e5938077a
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-02-11 16:18:30 +00:00
Yannick Tivisse 0506d4e6fa [IMP] hr_contract: Add stat button to access contracts from calendars
Purpose
=======

Currently there's no easy way to retrieve all the contract using a given
calendar.

closes odoo/odoo#65621

Related: odoo/enterprise#16157
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-05 14:06:01 +00:00
fw-bot 5b1696d6a8 [FIX] hr_contract: Add method to ease inheritance
closes odoo/odoo#64723

X-original-commit: d32ff05d6b9a21cfd4ca711f66a21821e1014c7b
Related: odoo/enterprise#15818
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-18 18:43:15 +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 8d32f8724e [FIX] *: adapt python constraints to support multi recordsets
Otherwise, they may crash or be incorrectly verified when
creating/updating recordsets containing multiple records.

Also improve the constraint error messages to be more detailed.

When possible, use a sql constraint instead to speed up the records
validation.

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
Laurent Stukkens (LTU) 76489303c8 [IMP] hr_contract: ease contract management through contract history
Before this commit:

    It was complicated to manage the contracts as they were all displayed in
    one view.
    When the contract was a time credit one (which is by definition a temporary
    situation) the data used was based on the time credit and not on the full time
    equivalent. This usually forced the HR to create fake new contracts without
    time credit for the appraisals.

After this commit:

    A new report will ease the followup of contracts with the time running.
    It comes with a new view that highlight the reference information which
    allow to easily manage credit time. Simulation is also made on FTE data which
    eases HR work.
    This commit also fixes a bug in the simulation with the meal voucher (only one
    was taken into account in the summary right panel.
    The wage on signature is now populated when the document is signed.

Closes odoo/odoo#58120
Related PR: odoo/enterprise#13384, odoo/upgrade#1802

task-2326407

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-11-03 15:08:45 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
Anh Thao Pham (pta) 3bd345597f [REF] hr*: convert onchange methods to stored-editable computed fields
Impacted modules:
hr, hr_contract, hr_recruitment, hr_payroll, fleet, hr_skills, hr_appraisal, ....

Several onchanges have been converted to computed fields in the following modules :
    Community :
        - hr
        - hr_contract
        - hr_recruitment
        - hr_work_entry
        - hr_maintenance
        - hr_expense
        - hr_expense_check
        - hr_holidays
        - sale_expense
        - account_analytic_default_hr_expense

    Enterprise:
        - hr_contract_salary
        - hr_referral
        - hr_payroll
        - hr_payroll_expense
        - test_l10n_be_hr_payroll_account

There are still 2 onchanges with complex behavior that couldn't be converted easily:
- an onchange that updates "tz" (timezone) that is defined as a related field
  to "resource_id.tz". Apparently it is useless except to initialize the default
  value of "tz".
- an onchange that updates "name" that is defined as a related field to
  "resource_id.name".
  the applicant.

closes odoo/odoo#45414

Taskid: 2169099
Related: odoo/enterprise#8572
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-20 10:32:45 +00:00
Kevin Baptiste e3189298cb [IMP] hr_contract: remove unused medic_exam field
The field `medic_exam` is not used anywhere and can thus be removed.

closes odoo/odoo#49631

Taskid: 2239321
Related: odoo/upgrade#1075
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-16 08:16:31 +00:00
Yannick Tivisse e4c66d7d28 [IMP] hr_contract: remove unused field
+ Add helper method to retrieve the contract wage.

Those methods are supposed to be overriden in some cases.

closes odoo/odoo#48258

Taskid: 2222984
Related: odoo/enterprise#9454
Related: odoo/upgrade#980
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-24 12:47:12 +00:00
Yannick Tivisse d77f5eb820 [IMP] hr_contract: Move payroll structure type from hr_payroll to hr_contract
Purpose
=======

Even if you don't manage your payroll using Odoo, it could interesting to
categorize your contract (CP200, ...), in case you manage several kind
of workers or employees in your company.

TaskID: 2148537
2020-03-16 08:45:50 +00:00
Lucas Lefèvre 119eddf7cc [FIX] hr_contract: Allow HR user to read first contract date
An HR user (without any rights on contracts) could not open
an employee form view since it needs the `first_contract_date`
field which needs contracts access rights.

closes odoo/odoo#47561

X-original-commit: 14855eee0f9c5737ee5aaa792defe88e138e0d7d
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
2020-03-13 09:27:17 +00:00
fw-bot 047e222373 [FIX] hr_contract: Avoid error when changing template contract stage
Before this commit:
When we change a contract to stage 'open', we write this contract
on employee. But it causes error when it's a template contract
(without employee).

After this commit:
When we change a contract to stage 'open', we write this contract
on employee only if contract has an employee.

[FIX] hr_contract: Allow overlapping in template contract

Before this commit:
We check for all contract that there are no overlapping for a
same employee.

After this commit:
We check that there are no overlapping for contract with
employee.

[FIX] hr_payroll, hr_holidays: Avoid some constrains with company time off

Before this commit:
We can't create company (or team) time off if you have 2 or more
template contract in your database.
We can't create mutliple company or team time off that overlaps.

After this commit:
We can create company (or team) time off if you have 2 or more
template contract in your database.
If a time off is set across multiple contract, print those contracts
in error message.
We can create multiple company or team time off that overlaps.

closes odoo/odoo#45696

Taskid: 2196185
X-original-commit: 3fdada6f8f19ae7123d9b35b3e7c557d072c1bc0
Related: odoo/enterprise#8553
Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
2020-02-19 11:04:40 +00:00
Prakash Prajapati 5ffbcd57ae [IMP] hr_contract: improve the contract general usability
Purpose fo the task is to improve the usability of hr contract and
automatic alert before contract expired
  -improve sign demo data
  -improve kanban state field in contract kanban
  -improve contract Form view ui
  -set first contract date on employee form
  -added the date of last completed contract on the new contract
  -improve signature request form
  -create automatic activity before the week of contract expired date

closes odoo/odoo#40789

Task: 2049413
Closes: #40789
Related: odoo/enterprise#7454
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-03 10:27:54 +00:00
jbm-odoo 41a465bc86 [FIX] hr_work_entry: Closed contract
When a contract is closed, set the date of the day.
In the contract cron, ensure that all closed contracts have
an end date if it is followed by a new contract.
Add multi-edit on work_entry list

closes odoo/odoo#44118

Taskid: 2180263
X-original-commit: 0b5d8ce756eac904a040ca700f44ea860daefcb4
Related: odoo/enterprise#7991
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-28 14:16:21 +00:00
jbm-odoo 6b5bdbb476 [IMP] hr_[contract,employee,recruitment,work_entry]: Add multi edit in view
Make some fields editable in multi edit.
Some onchange are tranformed in compute fields.

id=2078674

closes odoo/odoo#39711

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-06 10:08:50 +00:00
RomainLibert 51ace5d1a5 [FIX] hr_contract: some information should not be copied
closes odoo/odoo#37186

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-20 09:19:28 +00:00
RomainLibert e1eca412fb [FIX] hr_contract: change the company when changing employee
closes odoo/odoo#37164

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-19 15:37:54 +00:00
Prakash Prajapati c058562d73 [IMP] various: Add multi company domains on views
When the many2xxx field relates to a model where company_id is required, set
this  domain [('company_id','=',company_id.id)]

When the company_id field of the related model is not required, set this domain
['|',('company_id','=',company_id.id),('company_id','=',False)]

When setting the domain on a field which is in the treeview of a xxx2many field
evaluate against the company_id of the 'parent'.

Some constraints have been added on sereval models. Take a look at the complete
specification for more details.

TaskID: 2024446
Closes: #35266

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-16 11:17:28 +00:00
Naglis Jonaitis 0fe2b4530f [IMP] *: remove digits attribute from Monetary fields
* account, hr_contract, hr_expense, point_of_sale, sale_margin,
website_sale_delivery, website_sale_wishlist

digits only works on Float fields, on Monetary fields it has no
effect:

- The column_type of a monetary field is always numeric
- It is not applied in `convert_to_column()` or `convert_to_cache()`
- It is not part of `description_attrs`, so it will not be included in
the output of `fields_get()`

closes odoo/odoo#35336

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-02 11:17:12 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Martin Trigaux fd15ca1918 [MERGE] Forward port of saas-12.4 to master up to 1f5a4649a6
closes odoo/odoo#34850

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-15 08:12:26 +00:00
Martin Trigaux 1f5a4649a6 [MERGE] Forward port of saas-12.3 to saas-12.4 up to 87fc1554d6
closes odoo/odoo#34820

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-12 13:59:35 +00:00
Christophe Simonis 66bb578ac9 [MERGE] forward port branch saas-12.2 up to be5e8fdab8 2019-07-05 16:14:48 +02:00
Yannick Tivisse 7fc9421042 [FIX] hr_contract: Track employee_id modification on contracts
closes odoo/odoo#34483

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-07-01 11:20:48 +00:00
Christophe Simonis 71a50a2214 [MERGE] forward port branch saas-12.3 up to 409679866b 2019-06-06 11:54:35 +02:00
Christophe Simonis c8d7ad9a6b [MERGE] forward port branch saas-12.2 up to 995aa1685e 2019-06-03 15:49:31 +02:00
Christophe Simonis cfe0523714 [MERGE] forward port branch 12.0 up to 8f21148e1a 2019-05-31 14:37:38 +02:00
Nicolas Martinelli 8f21148e1a [FIX] hr_contract: contract type name
Make the contract type name translatable.

opw-2003957

closes odoo/odoo#33781

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-31 05:41:25 +00:00
Lucas Lefèvre 55bfc0a97e [REM] hr_contract: Remove social secretariat field
Social secretariat is a Belgian concept. It does not make
sense to have this in the standard contract app.

Will be reintroduced in l10n_be_hr_payroll (or internal)
if really needed.

Move `job_id` in the right group to easily add fields
on the right with view inheritance.
2019-05-31 12:58:15 +02:00
Yannick Tivisse f755e57fb8 [IMP] hr_contract: Split files according to models 2019-05-31 10:21:21 +02:00
RomainLibert 1044a0e889 [IMP] hr_contract: Adapt module with new hr.employee.public model 2019-05-31 10:21:21 +02:00
Yannick Tivisse f5dfe4727c [IMP] api.py: Rename company_id/company_ids into company/companies
The goal is to be coherent with the user property.

Actually, company_id and company_ids on the environment are no fields.

Calling env.company_id returns a browse record, not an id.
2019-05-29 08:09:15 +00:00
Christophe Simonis 60e71302a3 [MERGE] forward port branch saas-12.2 up to 243a4ae5cb 2019-05-13 11:02:27 +02:00
Kevin Baptiste f17655dd77 [IMP] hr_contract: Replace some contract states by kanban status
Purpose
=======

Having some usability check to be sure to make the pay
for everyone, and don't loose contracts.

We would like to remove incoming and to renew columns in
hr.contract and replace them by a kanban state.  In employee, we would
like to add warning on the kanban to warn the hr responsible there
is no contract or a contract is about to expire

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

hr.contract kanban:

- add a kanabn state
- it becomes red automatically when the contract is in running and  expire in 7 days
- add aquick search in filter to filter on expered soon
- the kanban state can be changed manaually (in case of there is several rh)
- sort by contract end date set first (more close of today first)

Employee kanban

- add an red icon if there is no contract in Runnig status OR there is a
kanban state red in their contract (whatever the status).
- add a quick seaach on employee with warning

- State pending + green = incoming
- State confirmed + red = about to expire / to renew

closes odoo/odoo#33489

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-28 06:59:32 +00:00
Lucas Lefèvre 22437e331a [IMP] hr_contract: Sync employee and contract calendars mismatch
Purpose
=======

An employee and its current contract should have the same
calendar. Currently, if the contract's calendar is changed,
the employee's calendar is not changed.
In the same way, if a contract is created directly in `open`
state, the employee's calendar is not changed.
Finally, the calendar synchronization when the employee
contract is changed is only done in payroll, for no reason.

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

Fix the three issues described above.

If the employee's calendar is nonetheless manually changed, a warning
should be displayed if there is a mismatch between both calendars.
2019-06-13 10:02:10 +02:00