Commit Graph
126256 Commits
Author SHA1 Message Date
Aurélien Warnon d9423656ce [IMP] (website_)sale: improve the exclusion mechanism in p.configurator
Targets commit d3530eb07e
References task id 1891970

Purpose
=======
- A message will be displayed when hovering a disabled attribute value's input to explain why it's disabled.
  e.g: Not available with Color: Black

  This works for both exclusions within the product and exclusions from a reference product.

- The exclusions will work in both sides, if "black" excludes "metal", "metal" will also exclude "black".
2019-03-27 15:12:48 +00:00
Alexandre Kühn 05e480acb1 [FIX] im_livechat: open website livechat window
Before this commit, when opening a website livechat window,
it crashed with the following error message in the dev tools:

```
Cannot read property 'html' of `undefined`
```

The problem was caused by the rendering of the chat window header
before the chat window widget is even mounted in the DOM. This error
has been introduced by the migration from jQuery 1.12 to 3, in which
most occurrences of `$.Deferred` have been turned into `Promise` [1].

`Widget.appendTo()` returns a `Promise` (was `$.Deferred` before).
A `Promise` is always asynchronous, whereas a `$.Deferred` with
jQuery 1.12 may be either synchronous or asynchronous. In the case
of the website livechat window, the implementation with `$.Deferred`
was always synchronous, which is no longer the case now.

[1] https://github.com/odoo/odoo/commit/126fb33f6a74916c808c8e988f55faf82f0b5759

closes odoo/odoo#32168

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-03-27 14:27:11 +00:00
Aurélien Warnon f860128159 [IMP] stock: add stock for demo data: customizable desk & conf. chair
Targets commit d3530eb07e

Purpose
=======
- The "Customizable Desk" and "Conference chair" products now have some stock in the initial inventory
  to avoid the stock warning when adding these products in a SO through the product configurator.
2019-03-27 13:46:09 +00:00
Sarah Van Bogaert ce4713cd0e [IMP] web: allow multiple fields in form views
This feature was already working in the actual version of Odoo but it is now tested. The following
features are supported:
- When the value of one widget is modified, the other ones change accordingly
- The modifiers 'invisible' and 'readonly' are applied correctly if they differ between widgets.
However, the modifiers 'required' must be equal for the several fields, otherwise the behavior
is not guaranteed.

closes odoo/odoo#32158

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-03-27 13:32:53 +00:00
Christophe Simonis 6b4758cd9a [MERGE] forward port branch saas-12.2 up to 7c1a9a8204 2019-03-27 14:29:01 +01:00
wan 29ef024b51 [IMP] account: display sample data on dashboard if empty
Task: 1893104

closes odoo/odoo#28131

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-03-25 10:23:49 +00:00
eco-odoo 3d6aa1db14 [IMP] account: improve dashboard design
Replace "Balance in General Ledger" by "Balance in GL" or simply "Balance" when both balances are equal.
Rename Import Bills > Upload bills.
Remove space between labels and values.

Task: 1893104
2019-03-25 10:23:49 +00:00
eco-odoo 7dfae39db4 [IMP] web: improve attachment files design
Task: 1893104
2019-03-25 10:23:49 +00:00
Antoine Prieels aed52bb39e [ADD] helpdesk_sale_coupon: Generate coupons from tickets
Add button to tickets to open a wizard to offer a selected coupon to a customer.

TaskID: 1909413
2019-03-21 12:30:57 +00:00
Cedric Snauwaert 4d7f052612 [FIX] account: change reconciliation widget m2o tax_id to a m2m tax_ids
closes odoo/odoo#26990

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-03-12 09:25:15 +00:00
Martin Geubelle 3b9483f170 [REF] web: correctly reuse read_group old datapoint
Rev. odoo/odoo@5c6a7c9 made a change to reuse an old group datapoint when
performing a read_group, instead of restoring *some* properties of the old
group (so basically a `_.omit` instead of a `_.pick`).

This is a bad idea as some properties were bound to the new datapoint
(`evaluateModifiers` for example) so it doesn't make any sense to update
the old datapoint with theses properties.

closes odoo/odoo#31956

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-20 09:06:25 +00:00
Christophe Monniez 8bb46e8b96 [FIX] hr_holidays: use api model instead of multi for dashboard
Before 1ced3bfca, the get_days_all_request method was called with the
context as an argument. As a consequence, because of the api.multi, the
first arg is used as the ids of the record. As the id is not used in
this method, it was not harmful. With the above mentioned fix, there is
no more argument. This causes a traceback when clicking on menu "My Time
Off/Dashboard".

With this commit, the api.model is used instead, that way, the first arg
is not considered as ids.

closes odoo/odoo#32119

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-26 09:12:33 +00:00
Robot Odoo e64ed7cece [MERGE][IMP] sale_crm : create partner from lead to new quotation
When creating a quotation from a opportunity that does not have any
customer set, we ended up on a quotation without any customer or any of
the contact information entered on the crm.lead.

With this commit, if no customer is set on the opportunity, when hitting New
Quotation button,  a modal is displayed to ask the user what to do to fill in the
customer field.

- Create a new customer : Use the information from the opportunity to create
automatically a res.partner. Set the res.partner on the quotation
and on the opportunity.
- Use an existing customer : Set this customer on the quotation
and on the opportunity.

Extra
For consistency, in the 'convert to opportunity' modal,
move the 'create a new customer' at the top of the selection values
+ change the group title to 'Customer' instead of 'Customers'

Task-1917332

closes odoo/odoo#30475

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-03-26 10:58:23 +01:00
David Beguin c092d8fc6d [IMP] crm : align partner action in lead to opportunity modal on New quotation modal
For consistency, in the 'convert to opportunity' modal,
move the 'create a new customer' at the top of the selection values
to be align with the New quotation - set partner modal
(crm.quotation.partner)
+ change the group title to 'Customer' instead of 'Customers'

Task ID : 1917332
Closes PR #30475
2019-03-25 14:50:55 +00:00
David Beguin 4c9c249cc3 [IMP] sale_crm : create partner on new quotation if no customer set on opportunity
When creating a quotation from a opportunity that does not have any
customer set, we ended up on a quotation without any customer or any of
the contact information entered on the crm.lead.

If no customer is set on the opportunity, when hitting New Quotation button,
a modal is displayed to ask the user what to do to fill in the customer field.

- Create a new customer : Use the information from the opportunity to create
automatically a res.partner. Set the res.partner on the quotation
and on the opportunity.
- Use an existing customer : Set this customer on the quotation
and on the opportunity.

Task ID : 1917332
Closes PR #30475
2019-03-25 14:50:55 +00:00
Christophe Monniez 9ea4fefed2 [FIX] web: avoid click on home menu in community
A fix attempt for the clickEveryWhere test was made in 39e71353c5.
Unfortunately, the last modification of the fix were not tested on the
runbot and introduced two new issues.

1) The click method on the home menu has been changed to use an enhanced
   _click function. This function crash when the jquery element is empty.
   As this menu does not exists in community, the test miserably fails.

2) A "focus" event was added in the _click function that simulates a real click.
   But the "focus" event is not a mouse event and as nothing to do there.

With this commit, the _click function returns immediatly when the
element is empty.

Also, the "focus" event is removed from the _click
simulation but a focus method is used to give focus to the close button.

Giving the focus to the cancel button is itself a fix for the
DateTimePicker field (see 39e7135).

closes odoo/odoo#32082

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-25 08:16:24 +00:00
Raphael Collet d87443a213 [FIX] convert: enable kwargs in tag <function>
closes odoo/odoo#31417

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-03-22 16:42:14 +00:00
Raphael Collet 1ced3bfca4 [FIX] *: pass context in kwargs in rpc calls 2019-03-22 16:42:08 +00:00
Raphael Collet 579965adc5 [IMP] api: RPC calls must always pass context as a keyword argument 2019-03-22 16:36:06 +00:00
Christophe Simonis 5df4746c9a [MERGE] forward port branch saas-12.2 up to 230ad8c381
closes odoo/odoo#32088

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-25 11:13:41 +00:00
Christophe Monniez 39e71353c5 [FIX] web: focus on close button when before closing a modal
During the clickEverywhere test, when a modal is opened, the hide method
is called to bypass it. This is not realistic and does not work in some
cases.

For example in Point of sale, menu "Reporting/Sales Details", a modal is
opened with a DateTimePicker (tempus dominus) already opened.
When hiding or closing the modal, the DateTimePicker needs to perform
some cleanup. If the modal is simply hidden, the DateTimePicker is not
cleanly destroyed.

With this commit, a modal is closed by clicking on its close button and
before that, the focus is set on the close button to let the
datepicker widget do its stuff on losing focus.

Also, a more realistic click is done by trigerring more events (code
adapted from tour helper).

closes odoo/odoo#32038

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-22 10:28:15 +00:00
Swapnesh Shah 3a56e34169 [IMP] mail: highlight re-send alert in BS style
closes odoo/odoo#31890

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-03-22 09:18:01 +00:00
Arnold Moyaux eff31f5336 [IMP] account: allow to override _get_reason
Do not pass the function reference instead call it
on self in order to be able to override it.

task_id: 1909413

closes odoo/odoo#30993

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-03-21 08:59:36 +00:00
Arnold Moyaux 277e32d2dc [IMP] stock: allow to change picking on returns
The code that generate the return lines is moved inside
an onchange. The purpose is to allow an inherit that will
modify the picking_id of the wizard. It should trigger the
new return lines without a call to default_get.

task_id 1909413
2019-03-20 14:22:09 +00:00
Antoine Prieels 8a7b6a4f9c [IMP] repair: Hide lot_id and do not systematically reset lot_id
- Hide lot_id field when product is not tracked
- There was an onchange on the product_id that systematically set the lot_id to `False`.
When giving default values for the lot_id and product_id through the context,
the default value of the lot_id would be overwriten by the onchange.
To fix this, we only reset the lot_id when it is inconsistent with the product_id.

TaskId: 1909413
2019-03-06 06:45:13 +00:00
Christophe Monniez e480406773 [FIX] web: click on home menu on next tick
Since odoo/enterprise@b830ea7ed2, the enterprise home menu is asynchrnonous.
Because of that, the clientActionCount variable is updated too late and
this counter is screwed up, making the test fail.

With this commit a setTimeout 0 is used to click on home menu in the
next tick and then update the current action count.

Also
 * the test is adapted to stop immediately when an error is catched.
 * the initial click on home menu is moved into debug manager because
   the python test launcher uses the correct location already.

Thanks to @VincentSchippefilt and @aab-odoo

closes odoo/odoo#31949

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-21 12:15:30 +00:00
wan 31f199597f [IMP] account: add option to group journals
It can be useful to be able to select several journals in 1 click in the
financial reports

Task: 1857934

closes odoo/odoo#26711

Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2019-03-21 08:45:43 +00:00
Alexandre Kühn 755e565538 [FIX] website, *: improved no content helper title
*: base

Revision on https://github.com/odoo/odoo/commit/a87d761fdbf345ada5dc93e0a686b08a0f5a0417

- suggested by @sswapnesh (https://github.com/odoo/odoo/commit/a87d761fdbf345ada5dc93e0a686b08a0f5a0417#commitcomment-32825219)
- implemented by @alexkuhn

closes odoo/odoo#32005

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-03-21 09:56:09 +00:00
Pragya Ladda 8e2f9a4fe2 [IMP] website: cannot deactivate language if set in language_ids for website
closes odoo/odoo#31520

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-12 10:14:29 +00:00
svs-odoo ea70cb2f1f [FIX] stock: traceback on routes report
As putaway strategies were replaced by putaway rules, some properties
were renamed but were unchanged in the report, causing traceback.

opw-1957005

closes odoo/odoo#31938

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-03-20 12:25:32 +00:00
Kaushalya Mandaliya 3cbb8d518e [IMP] mail: bigger attachment previews in chat window
Purpose of the task is to increase the size of attachment previews
in chat windows.

Task-ID 1941601

closes odoo/odoo#31904

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-03-19 05:45:20 +00:00
Robot Odoo 3b38197f27 [MERGE] hr_payroll: Refactor payroll engine + Move to enterprise
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

hr_payroll: rename hr.benefit into hr.work.entry
------------------------------------------------

It makes more sense to name an entry in the employee schedule like that.

TaskID: 1941598

hr_holidays: Group team leader imply group user
-----------------------------------------------

Currently, group Team Leader does not imply group user.
However a team leader is always a user and should be member of
the corresponding group.

hr_holidays: Allow Team leader to approve
-----------------------------------------

Currently, a Team leader can't approve a leave of an employee
in his team if the leave type requires an allocation.

The reason is the `ir.rule` for `base.group_user` restricting allocation
read access to only your own allocation
(`[('employee_id.user_id', '=', user.id)]`). There are no `ir.rule` for group
Team leader. Therefore, a team leader can't read allocations for his team
members.

Fix: add an `ir.rule` to allow a team leader to read allocations
of employees in his team.

+ add associated tests

hr_payroll: Fix contract access to approve leave
------------------------------------------------

When a `hr.leave` is approved, a `resource.calendar.leave`
is created in the employee's calendar and in the
contract's calendar if it's different.
However, a user in `group_holiday_user` but not in
`group_hr_contract_manager` does not have access rights
to read a contract.
This leads to an `AccessError`

Fix: use `sudo` to read the contract.

hr_contract: group_hr_contract_manager implies group_user
---------------------------------------------------------

A user with only the contract access rights should be able to create
a contract.

l10n_be_hr_payroll_fleet: Fix access rights issues
--------------------------------------------------

If a user is member of `hr_contract.group_hr_contract_manager`
but not member of `fleet.fleet_group_manager` some access issues arise
The issues are related to the `car_id` field of `hr.contract`
because the user has no access rights for `fleet.vehicle`.

Fix to solve the issue:
Make all car related field of contracts available
to fleet manager only.

If the contract manager want to be able to manage cars on
contracts, he must manually be granted fleet manager access.
This is a requirement if the contract manager want to use the
company car feature.

hr_payroll: Allow a contract manager to read salary structures
--------------------------------------------------------------

An employee with only the contract user group should be able to create
a contract. It implies to be able to read a salary structure and
a salary structure type.

hr_payroll: Add leave type One2many on benefit type
---------------------------------------------------

Purpose
=======

Currently, linking a benefit type and a leave type is done through
the leave type form view.
This is anoying because it requires to first create the benfit type,
then go to the leave type and link it.
Moreover, linking is the role of a payroll manager which should be
able to do it from the Payroll app.

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

Add a One2many field `leave_type_ids` on `hr.benefit.type` to
allow to link a leave type when creating a benefit type.

commit a9f97a2c43
Author: Lucas Lefèvre <lul@odoo.com>
Date:   Mon Mar 4 16:06:33 2019 +0100

hr_payroll: Make payroll groups imply holiday groups
----------------------------------------------------

Purpose
=======

Currently, groups `hr_holidays.group_hr_holidays_[user|manager]`
and `hr_payroll.group_hr_payroll_[user|manager]` are independant.

A member of payroll groups is not able to approve/refuse a leave.

This is a problem as they should be able to approve/refuse leaves before generating payslips.
This is the  point of `hr.benefits`: a global way of managing
attendances and leaves before generating payslips.

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

Payroll groups should imply the corresponding
holiday group.

1. User
`hr_payroll.group_hr_payroll_user`
implies
`hr_holidays.group_hr_holidays_user`

2. Manager
`hr_payroll.group_hr_payroll_manager`
implies
`hr_holidays.group_hr_holidays_manager`

hr_contract: Allow contract managers to manage employee
-------------------------------------------------------

Contract managers should be able to create/manager employees.
This make sense when a contract manager hires someone.
He first creates the employee, then his contract.

This also allows contract managers to access private addresses
by transitivity.
This is also intended to allow a contract manager to set
a driver (private  partner) on the employee's company car
or to access `km_home_work` for transport reimbursment
(l10n_be_hr_payroll).

hr_payroll: Improve benefits conflict performance
-------------------------------------------------

This commit changes the way benefits overlaps are detected.
Currently, all benefits are read from db and the
overlap detection is done in Python.

After this commit, use a single sql query to
only retreive overlapping benefits.
The query takes advantage of the postgresql
range type `tsrange` and the intersection operator

Performance improvements:
Tests with 500 employees and benefits generated for
15 months (~300000 records in the table)
Conflict detection over 1 month (~20000 records)
=> ~5X speedup (from more than 2s to less than 0.5s)

hr_holidays: Fix validation string typo
---------------------------------------

hr_holidays: Test access rights post install
--------------------------------------------

Some module can inherit leave models and override some methods.
The overridden method could access some models which require other
access level.
In this case, the access issues would not be found by tests because
other modules are not yet installed.

e.g.
Recently, the `_create_resource_leave` was overridden in hr_payroll and
is reading the employee's contract. A HR user approving a leave
would raise an access error because he doesn't have contract rights.
If the tests would have been executed post install, this bug would
have been detected.

project_timesheet_holidays: Fix leave validation rights issues
--------------------------------------------------------------

Currently, when a leave is validated, an `account.analytic.line`
is automatically created. However, the approver may not have
the access rights to do so.

This commit fixes the issues by using sudo to generate the line.

hr_holiday: Don't check access rights on allocation if no employee
------------------------------------------------------------------

If there are no employee set on the allocation request and if the user
is a leave officer, don't check the access rights as it would lead to
a traceback.

hr_payroll: enable color edition on hr benefit types
----------------------------------------------------

TaskID: 1947281

hr_payroll: extract common behaviour from custom calendar view
--------------------------------------------------------------

In order to implement the same features both in the calendar and in the
gantt view, we need to extract the behaviours that will be common into a
mixin.

TaskID: 1947281

base: enable usage of js_class on the gantt view
------------------------------------------------

TaskID: 1947281

hr_payroll: Use the structure type on contract instead of structure
-------------------------------------------------------------------

For usability purposes, it's better to set a structure type
on a contract (eg: CP200: Belgian Employee) instead of having
to choose between 'Belgian Salary', 'Double holidays', ...

hr_holidays: Don't check approval rights in onchange
----------------------------------------------------

When this method is called in the context of an onchange
`self.ids` is an empty list.

This is a problem when calling `holiday.check_access_rule('write')`
because it does not find any valid holidays and thus raises an AccessError.

hr_holidays: Skip validation rights if no validation
----------------------------------------------------

If validation type is set to `no_validation`, checking
if a target state is achievalbe should bypass
normal checks for the user's own leaves.
Otherwise, ir.rule raises an AccessError as the user
doesn't normally have the rights for leave in
state `validate`.

l10n_be_hr_payroll: Manage employee departure
---------------------------------------------

Compute notice duration and if the notice duration is not respected,
a report about termination fees is generated.
At the end of the notice duration, we can generate a certificate
about time off not taken and an other about time off for the next
year.

TaskID: 1914556

hr_payroll: replace contribution register by partner_id
-------------------------------------------------------

We replace contribution register model by a many2one on res.partner
directly on the payslip.line

Task 1928607

hr_payroll: add multicompany rule for payslip lines
---------------------------------------------------

TaskID: 1928607

hr_payroll: Use date_to_str on work entries generation
------------------------------------------------------

Purpose
=======

This aim to avoid sending a datetime that will be converted into UTC
and that way have a wrong date set on the payslip.

hr_payroll: Move to enterprise
------------------------------

For more information about this decision, please read
https://www.odoo.com/fr_FR/blog/notre-blog-5/post/odoo-community-enterprise-532

closes odoo/odoo#31806

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-03-19 12:55:27 +01:00
Yannick Tivisse 77944721ce [MOV] hr_payroll: Move to enterprise
For more information about this decision, please read
https://www.odoo.com/fr_FR/blog/notre-blog-5/post/odoo-community-enterprise-532
2019-03-19 10:53:06 +01:00
Yannick Tivisse 6806b8f8d8 [FIX] hr_payroll: Use date_to_str on work entries generation
Purpose
=======

This aim to avoid sending a datetime that will be converted into UTC
and that way have a wrong date set on the payslip.
2019-03-19 09:35:32 +01:00
RomainLibert a8e8ef634f [FIX] hr_payroll: add multicompany rule for payslip lines
TaskID: 1928607
2019-03-19 09:35:32 +01:00
RomainLibert db6c8b750d [REF] hr_payroll: replace contribution register by partner_id
We replace contribution register model by a many2one on res.partner
directly on the payslip.line

Task 1928607
2019-03-19 09:35:32 +01:00
jbm-odoo a9f5ece25a [IMP] l10n_be_hr_payroll: Manage employee departure
Compute notice duration and if the notice duration is not respected,
a report about termination fees is generated.
At the end of the notice duration, we can generate a certificate
about time off not taken and an other about time off for the next
year.

TaskID: 1914556
2019-03-19 09:35:31 +01:00
Lucas Lefèvre c0bb910dff [FIX] hr_holidays: Skip validation rights if no validation
If validation type is set to `no_validation`, checking
if a target state is achievalbe should bypass
normal checks for the user's own leaves.
Otherwise, ir.rule raises an AccessError as the user
doesn't normally have the rights for leave in
state `validate`.
2019-03-19 09:35:31 +01:00
Lucas Lefèvre 492764c559 [FIX] hr_holidays: Don't check approval rights in onchange
When this method is called in the context of an onchange
`self.ids` is an empty list.

This is a problem when calling `holiday.check_access_rule('write')`
because it does not find any valid holidays and thus raises an AccessError.
2019-03-19 09:35:31 +01:00
Yannick Tivisse 0281858c2a [IMP] hr_payroll: Use the structure type on contract instead of structure
For usability purposes, it's better to set a structure type
on a contract (eg: CP200: Belgian Employee) instead of having
to choose between 'Belgian Salary', 'Double holidays', ...
2019-03-19 09:35:31 +01:00
RomainLibert 762df380f6 [IMP] base: enable usage of js_class on the gantt view
TaskID: 1947281
2019-03-19 09:35:31 +01:00
RomainLibert be0134e879 [REF] hr_payroll: extract common behaviour from custom calendar view
In order to implement the same features both in the calendar and in the
gantt view, we need to extract the behaviours that will be common into a
mixin.

TaskID: 1947281
2019-03-19 09:35:31 +01:00
RomainLibert 6280be10a5 [IMP] hr_payroll: enable color edition on hr benefit types
TaskID: 1947281
2019-03-19 09:35:31 +01:00
Yannick Tivisse 661a9986ea [IMP] hr_holiday: Don't check access rights on allocation if no employee
If there are no employee set on the allocation request and if the user
is a leave officer, don't check the access rights as it would lead to
a traceback.
2019-03-19 09:35:31 +01:00
Lucas Lefèvre adc4eb0af3 [FIX] project_timesheet_holidays: Fix leave validation rights issues
Currently, when a leave is validated, an `account.analytic.line`
is automatically created. However, the approver may not have
the access rights to do so.

This commit fixes the issues by using sudo to generate the line.
2019-03-19 09:35:31 +01:00
Lucas Lefèvre b1c4f4058e [IMP] hr_holidays: Test access rights post install
Some module can inherit leave models and override some methods.
The overridden method could access some models which require other
access level.
In this case, the access issues would not be found by tests because
other modules are not yet installed.

e.g.
Recently, the `_create_resource_leave` was overridden in hr_payroll and
is reading the employee's contract. A HR user approving a leave
would raise an access error because he doesn't have contract rights.
If the tests would have been executed post install, this bug would
have been detected.
2019-03-19 09:35:31 +01:00
Lucas Lefèvre b98bc70350 [FIX] hr_holidays: Fix validation string typo 2019-03-19 09:35:31 +01:00
Lucas Lefèvre 74246d288f [IMP] hr_payroll: Improve benefits conflict performance
This commit changes the way benefits overlaps are detected.
Currently, all benefits are read from db and the
overlap detection is done in Python.

After this commit, use a single sql query to
only retreive overlapping benefits.
The query takes advantage of the postgresql
range type `tsrange` and the intersection operator

Performance improvements:
Tests with 500 employees and benefits generated for
15 months (~300000 records in the table)
Conflict detection over 1 month (~20000 records)
=> ~5X speedup (from more than 2s to less than 0.5s)
2019-03-19 09:35:31 +01:00
Lucas Lefèvre 29633756b0 [FIX] hr_contract: Allow contract managers to manage employee
Contract managers should be able to create/manager employees.
This make sense when a contract manager hires someone.
He first creates the employee, then his contract.

This also allows contract managers to access private addresses
by transitivity.
This is also intended to allow a contract manager to set
a driver (private  partner) on the employee's company car
or to access `km_home_work` for transport reimbursment
(l10n_be_hr_payroll).
2019-03-19 09:35:31 +01:00
Lucas Lefèvre a9f97a2c43 [FIX] hr_payroll: Make payroll groups imply holiday groups
Purpose
=======

Currently, groups `hr_holidays.group_hr_holidays_[user|manager]`
and `hr_payroll.group_hr_payroll_[user|manager]` are independant.

A member of payroll groups is not able to approve/refuse a leave.

This is a problem as they should be able to approve/refuse leaves before generating payslips.
This is the  point of `hr.benefits`: a global way of managing
attendances and leaves before generating payslips.

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

Payroll groups should imply the corresponding
holiday group.

1. User
`hr_payroll.group_hr_payroll_user`
implies
`hr_holidays.group_hr_holidays_user`

2. Manager
`hr_payroll.group_hr_payroll_manager`
implies
`hr_holidays.group_hr_holidays_manager`
2019-03-19 09:35:31 +01:00