Commit Graph
23 Commits
Author SHA1 Message Date
Victor Feyens 24ccf7d9b0 [CLN] *: useless type info for actions
The type fields of actions already defaults to
the model name in the base model definition.

Therefore, specifying `ir.actions.server`, `ir.actions.act_window`
& so on as type is useless (and adds noise since it's the same as
the action model).

closes odoo/odoo#114539

Related: odoo/enterprise#37855
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-08 17:33:37 +01:00
sofiagvaladze 2a4795d3e2 [FIX] hr_contract: proceed cron action even when ValidationError occurs
The method update_state is called from cron. When the contracts are
updated couple things are checked. There are constraints set that can
throw ValidationError. As a result, none of the contract states are updated.

In this PR we do the following:
In case the ValidationError occurs when we run the cron, we update
contracts that can be updated, and silently pass the invalid contracts.

task - 3069480

bloupbloup

closes odoo/odoo#114566

X-original-commit: bce0d7d0f11d46c671bc2b902d17d80febeefa5f
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-03-07 18:03:19 +01:00
Xavier-Do 930c3c8f69 [FIX] hr_contract: fix demo contract starting
With the new year transition, some demo data relative to the current
time are now inconsistent with each others:

- Some payslips starts 2 mount before now.
- the contract starts this year, first January.

This means that
- the contract starts 2023-01-01
- the payslips ends 2022-12-01

Leading to an error
"The following employees have a contract outside of the payslip period"

Note that it looks like there is a also a demo/admin inconsistency
in data but this is out of the scope of this fix.

X-original-commit: ae259f93b6ccaaec17a8d32df6282278e015c395
Part-of: odoo/odoo#108884
2023-01-01 20:14:49 +01:00
Dossogne Bertrand 228c6401d4 [IMP] hr_contract: ease contract navigation
Before this commit, the contract smartbutton on the
employee page redirected to the contract history page.
After this commit, the user will be redirected to the running
contract or any contract if there is some, or towards a new
contract form otherwise. To access the contract history view,
a new smartbutton has been added on the contract form.

Also added some hr_responsible_id to contract in demo datas
to avoid having empty required fields for employee contracts.

task-3056891

closes odoo/odoo#105416

Related: odoo/enterprise#33799
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-11-29 14:22:59 +01:00
Yannick Tivisse f9adbaf422 [IMP] hr: Improve demo data
closes odoo/odoo#98027

Taskid: 2784316
Related: odoo/enterprise#30398
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-08-12 20:16:50 +02:00
Yannick Tivisse c6d1f71bf0 [IMP] hr: Allow plans to directly request signatures
closes odoo/odoo#84976

Related: odoo/enterprise#24577
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-22 09:41:54 +00:00
William Braeckman 9e3b9317a1 [IMP] hr_contract: Improve demo data for payroll dashboard
Part-of: odoo/odoo#83836
2022-02-07 19:03:42 +00:00
Thibault Libioulle 0caef93408 [IMP] hr_contract: add demo data
This commit adds demo data in hr_contract.

PR community : #75553

task-2559061
2021-08-30 16:47:49 +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
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
Victor Feyens d4e0fe018d [IMP] *: use ref= instead of eval="ref(' in xml field tags.
* Code cleanup
* Avoid a safe evaluation of the field value when loading those records.

closes odoo/odoo#44883

Related: odoo/enterprise#8283
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-02-11 13:07:06 +00:00
Yannick Tivisse 285f2f9d47 [FIX] hr*: Grant user's rights to demo user for HR applications 2019-09-23 07:56:12 +00: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
Yannick Tivisse b631280999 [REF] hr_payroll: Remove parent_id hierarchy + Add structures categorization
1/ Remove the parent-children relation on salary structures

Currently it is difficult to see what rules are applied on salary structures.

Most of the structures are inheriting 3 rules (Basic, Gross, Net) from the
'Base for new structures', and those rules are not shown. Same issue if a
structure has another one as parent (as in the French localization).

This bring more annoying issues:

- Since the saas-12.1, we can already set different accounts for different
  companies on the salary rules for which we want to post journal entries.
  But for the parent rules, like the 'NET' amount, it's impossible to post
  the journal entries on different account for different salary structures.
  (eg: for CP200 employees and CP200 workers). As the rules are following
  a M2M relation on the structure, we have to remove the parent_id and to
  recreate all the rules in the final structure.
- If we are not at ease with the M2M relation (which is the case for most
  of the end users), we will simply modify the rule on the parent structure.
  This was already done on the French localization on which we modified the
  code, sequence and the name. This could have some desastrous consequences
  as this will break the order on which the rules are computed for other
  structures for the sequence, or break other integration with the payroll
  as we also modify the code, for example the salary configurator.

As this parent-children relation on structure could cause several issues
difficult to spot and as this is quite difficult to correctly visualize the
structure composition, it is better to remove it and define all the rules
inside the structure itself. This improves also the code readability as we
are not trying to recursively retrieve the rules and find a proper sequence
inside them.

2/ Make the rules on the salary structure a o2m instead of a m2m

The issues described just above indicates that it would be better to remove
the M2M relation between salary structures and salary rules, and make it
a O2M relation instead. That way, no more confusion and misconfiguration of
the rules fields (code, sequence, accounts, ...).

3/ Remove the parent-children relation on rules

A salary rule can have a parent salary rule. This mechanism, which is
not obvious at all for an end user allows to specify a parent rules.
If the condition is met for the parent rule (eg: the employee has at least
1 child), all the children rules could be applied (eg: Deduction of 90 euros
if the number of children is between 1 and 1).

Visually it doesn't make a lot of sense, as it displays one line with an
amount of 0 for the parent, and one line with the real amount for each
applied child. On the other hand, no child rule is linked to the structure
and an end user has to click on the parent rule, to see the children and
understand that something mystic and hidden is existing.

This is equivalent to define as many classic rules as we have children, or
even better, define 1 rule that will compute the real amount directly,
as the number of children can be accessed from the localdict when computing
the salary line.

This commit also removed the relation.

4/ Clean some brols in the code (technical)

The 3 first points of the spec allow us to clean a little the code readability
and complexity.

5/ Adapt all the localizations for these changes

All the localizations are impacted by those changes. What is done in this commit
is mainly:

- l10n_be_hr_payroll: Make 3 separated files for the 3 existing structures (the
  fourth one, belgian worker, is not correct and is removed). For each
  structure, define explicitely the rules (in the correct order by sequence).
  This multiplies the total number of rules as some of them were shared (like
  the withholding tax rule for example), but all the code that is supposed to be
  modified each year/quarter/whenever the government decides to modify the law
  has been moved into a python file, and is available the computation context.
  This will also allow us to update the computation rules without having to
  update the module.
- l10n_fr_hr_payroll: There were 3 rules following this scheme:
                              Base for new structure
                                        |
                                 Basic structure
                                        |
                              ----------------------
                              |                    |
                           Cadre                Non-Cadre
  All the rules parent rules have been duplicated into the 2 remaining
  structures, cadre and non-cadre. There were a lot of parent-children relations
  between the rules that have been adapted to the new model.
- l10n_in_hr_payroll: There was a lot of rules in data, and a structure in demo
  data, which was using 4 or 5 of these rules. As the rules doesn't seem to make
  a lot of sense altogether, everything was moved in demo data.

6/ Introduce a new Salary Structure Type model

Currently we have a model hr.contract.type with a M2O on the contracts. This has
never been used in 9 years and is removed in this commit. On the other hand, we
would like to define a new model hr.payroll.structure.type (eg: CP200 Employee),
which will line all the salary structures the Belgian localization could bring
(Classic salary, double holidays, 13th month, ...). This field is defined on the
structure, and is displayed on the contract (as the same place than the contract
type we just removed).

On this model we could also define some fields like:
- The default pay period: Selection field, default = monthly. This is applied on
  the contract when selecting the structure.
- The Working Schedule, m2o. This is applied on the contract when selecting the
  structure

For example, on the 'commission paritaire' for teachers, we could set the
default pay period to 'Every 15 days' and the working schedule to '19 hours /
week'. Every contract under this structure would take those values.

Migration
=========

For a migration point of view:
- All the rules that had a parent_rule_id should be set to
  appears_on_payslip=False. The column parent_rule_id can be dropped afterward.
- All the rules that are coming from a parent structure or higher should be
  duplicated and the field 'struct_id' should be set on the current structure.
  The column parent_id can be dropped afterward.
- All the rules that were defined on the structure should have the field
  'struct_id' defined on them.
- The rules that are not linked to a structure should be unlinked.
- The column type_id on the contract could be dropped, no need to keep the
  values too.
- A default structure type is defined in data ('Employee'). This could be set to
  all the existing structure for the newly created 'type_id' field.

TaskID: 1942832
2019-03-19 09:24:23 +01:00
Lucas Lefèvre 20bc2bbab5 [IMP] hr_payroll: add multi contract support
Purpose
=======

We would like to be able to manage multi contracts payslips and contract transitions.

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

General flow:
1/ Benefits are generated based on contracts's calendar.
2/ When validating additionnal benefits, calendar.attendances are created in the contract's calendar
3/ Create one payslip per contract in state [open|pending|close]
4/ For each payslip, generate worked day lines based on the contract's calendar

New Constraints:
1/ An employee cannot have more than one contract at the same time (excluding draft, closed and cancelled contracts).
2/ A leave cannot overlap multiple contracts.
3/ A contract cannot have starting and ending dates such that a leave become in the middle of
   two contacts.

New state for a contract: Incoming. It means it's ready and will be running soon.
An incoming contract automatically becomes 'Running' if the start date is passed (cron)

Number of hours and days are always correct (according to the contract's calendar) on payslips as the
flow starts from the contract's calendar.
However, it is not correct in the Time Off app because it's counted based on the employee's calendar.
The number of days/hours for hr.leaves should be computed according to
the contract at the time of the leave.
e.g. If I currently work full time and I request 2 weeks off next month where I'll be working only
3 days/week and 5hours/day (other contract), It should count 6 days and 30 hours.

- in hr.benefits form view show the contract (below employee field)

TaskID: 1903483

closes odoo/odoo#30181
2019-02-01 12:16:54 +00:00
lul-odoo 9eda75182e [IMP] hr_contract: Add demo data 2018-12-03 15:10:54 +01:00
Thibault Delavallée ba76985196 [IMP][FIX] hr_contract: merge both state update cron into onee and fix the method
Purpose

 * lessen number of crons in Odoo
 * fix the method that seems buggy, probably to backport
2017-07-11 15:59:10 +02:00
Thibault Delavallée b9c37e794b [IMP] hr_contract: remove dependency to base_automation
Purpose of this commit is to remove the link between Hr Contracts and
base automation. This has two consequences

 * automated actions used to compute contracts state are transformed
   into scheduled actions. Crons will do the job just as fine;
 * option to use employee contract in automated actions is removed
   and put in its own bridge module;

This allows to remove the dependency between the two addons.
2017-01-03 19:11:08 +01:00
Yannick Tivisse 319a939339 [MOV] base_action_rule: rename and move base_action_rule to base_automation
First step towards cleaning and improving automated actions is to
correctly name things. base_action_rule module is therefore renamed
to base_automation. Model is also renamed to base.automation.
2017-01-03 19:11:07 +01:00
Yannick Tivisse 8fa9f7d6d4 [REF] ir_actions: refactor and simplify ir.actions.server
Main idea of this commit is to simplify the various options of
ir.actions.server model. Purpose is to make it a simple tool to
execute some actions or python code. This has two main consequences

 * create and update server actions are simplified to update only the
   current record. Complex options can always be achieved by python code
   instead of error-prone option building mechanism;
 * condition of server actions is removed. If a condition is necessary it
   can either be included in a code server action, or integrated in an
   automated action;

This commit features :

 * remove 'client_action' server action type. Indeed this can be achieved
   with a code server action returning an action;
 * remove 'condition' on ir_actions_server model. From now on conditions
   and triggers are managed in server action code or using automated
   or scheduled action;
 * clean 'create and copy a record'. Create and link are the proposed
   options. Copy of the record or of a selected record is removed. Link
   is simplified by removing the parsed expression that allowed complex
   path update. It is simpler to write code than write python-like
   expression in char fields;
 * remove 'use_write' options. It now simply updates a record;
 * remove 'write_expression' as it is replaced by code actions;
 * remove 'ref_object' not used anymore with the removal of "choose
   a record";
 * remove helper to build an expression not used anymore with the removal
   of "write expression";
 * remove object ID finder;
 * removed template display when choosing an email template; just go
   on the template if you want more details;
 * refactor server action form view to reflect changes. It will be used
   in future commits as base view for automated and scheduled actions;
 * add 'sequence' in list view;
 * add new 'usage' selection field allowing to distinguish which model
   uses the server action. Indeed as server action will soon be used
   in scheduled or automated actions having a clue about the usage
   is always helpful;

Thanks to @fpodoo for the original idea and preliminary work. Thanks to
@jpr-odoo for first developments. Thanks to @jem-odoo and @rco-odoo
for reviewing.
2017-01-03 19:11:06 +01:00
Jeremy Kersten a55ee3858c [FIX] *: convert action server to new syntax
Use record / records instead of deprecated locals
2016-11-18 10:03:48 +01:00
fka-odoo 095d0174fd [MIG] hr_contract : migrate the code to new api 2016-04-14 10:47:39 +02:00
fka-odoo 2196b511ee [MOV] hr_contract: organised files in data, models and views directory 2016-04-14 10:47:38 +02:00