Commit Graph
383 Commits
Author SHA1 Message Date
Yannick Tivisse d0e2d1365c [IMP] hr: Expose Social Security Number of employee forms
Part-of: odoo/odoo#124222
2023-08-17 10:32:50 +02:00
Yannick Tivisse b634498fc0 [IMP] hr: Make contract type country specific
Part-of: odoo/odoo#124222
2023-08-17 10:32:49 +02:00
Louis Wicket (wil) 537b0ce712 [REM] base, *: remove binary_field_real_user from context
Formerly, using sudo() on a record had the effect of replacing the
current user with the superuser. But sometimes, knowing who the "real
user" was was necessary, so we needed to store it somewhere. This is
basically why the key `binary_field_real_user` was introduced in the
context: to keep track of who the user was before switching to sudo
mode.

Since 1e6c3bec2c, however, switching to
sudo mode no longer changes the current user; meaning that the
`binary_field_real_user` is no longer necessary.

This commit removes the remaining occurrences of the now useless
`binary_field_real_user` from the code.

* = hr, portal, web_editor

closes odoo/odoo#92032

Enterprise: https://github.com/odoo/enterprise/pull/27649
Related: odoo/enterprise#27649
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-08-16 10:23:49 +02:00
Yannick Tivisse 79e05e16ec [FIX] hr: Allow deleting departure reasons
closes odoo/odoo#131327

X-original-commit: 5db1538af8c3381ab7c9006e11db0844d8d365c1
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-08-09 19:27:23 +02:00
niyasraphy 68630aaf65 [FIX] hr: singleton error on writing user to employee
before this commit, on writing user_id to hr.employee
on multiple record in raisng single ton error.

after this commit, no error wont be raised on the
same.

closes odoo/odoo#130650

X-original-commit: ebc686b8abc84538f224ff4db205ce1231b747c3
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-08-03 19:31:40 +02:00
Thibault Delavallée 626557147c [REF] various: remove duplicated sms helper tools
RATIONALE

Simplify field management for mail / phone / sms flows. Make it working out
of the box, easier to use and tweak.

SPECIFICATIONS

Simplify model custom code when dealing with phone and sms by using helpers
and standard behavior defined on all models.

'_sms_get_partner_fields' was introduced at odoo/odoo@bdebcab0ce to have a generic
implementation of finding partners on a record. Since then another version
has been added directly in 'mail' module, using '_mail_get_partners'.

'_sms_get_number_fields' was introduced at the same time to have a generic
implementation of finding numbers on a record. Since then a generic and
improved version has been added directly in 'phone_validation' module, see
'_phone_get_number_fields'.

Those method can therefore be removed, and replaced by the generic ones
available on BaseModel.

Task-3422449 (Mail, Phone: Move and improve field helpers)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

Part-of: odoo/odoo#130468
2023-08-02 18:50:17 +02:00
Kevin Baptiste fef71bac14 [IMP] hr,hr_recruitment: add Newly Hired filter
Moves the Newly Hired search filter from hr_recruitment to hr.
This new filter is available to all employees and not restricted to Officers.

task-3346478

closes odoo/odoo#123420

Related: odoo/upgrade#4759
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-08-02 02:24:46 +02:00
Wolfgang Taferner d93efc5b5c [FIX] hr: always retrieve valid employee
if you are a multi company user and you are employee
in another company than the current one you will
end up not be able to use your department as a filter
even if the department is defined for multiple companies

closes odoo/odoo#129665

X-original-commit: 8a30dbb4937ffad93e9d310ca4996d6ff5eac268
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Wolfgang Taferner <w.taferner@wtioit.at>
2023-07-25 22:36:36 +02:00
Melanie Peyrat (MEPE)anddasz b3be3af61c [ADD] hr_homeworking: add homeworking
Users and employees can now define their usual worklocation
for a day of the week aswell as define unusual ones from the
calendar app. The worklocation is then displayed in the calendar
in two different ways: when only one person is selected, there
is a circle with an icon in it, and a ray that extends to the right
if the person is at the same location for multiple days. If there
are multiple persons selected there is no ray, instead the circles
are grouped by location type and colored accordingly to the filters
in the left panel.

closes odoo/odoo#129585

Task: 3060685
X-original-commit: c74ac3f698d4ea4c9b7a5e060fba4cf77cc9a6d7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Co-authored-by: dasz <dasz@odoo.com>
2023-07-25 21:22:46 +02:00
william-andre 0479b2b594 [IMP] account,*: manage subsidiary companies
Allow sharing records between company
* accounts
* taxes
* fiscal positions
* products
* ...and some related models

These records can be read and used in children companies.

This can be used to
* have different branding for different businesses
* allow more complex security rules
* consolidate branches differently
* manage different tax reports with different tax ids in the same
  country

task-3371677

closes odoo/odoo#125642

Related: odoo/enterprise#43215
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-07-20 11:49:06 +02:00
Kevin Baptiste 9c0d20fa27 [FIX] hr: trust account when needed
Changing the value of `allow_out_payment` when it was already set to
False would trigger an AccessError.

closes odoo/odoo#128800

X-original-commit: 74f15362beaf967cefe509d5b9b66c5436bb661b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-07-18 10:20:02 +02:00
Kevin Baptiste 427d31766d [IMP] hr, hr_contract: show fields to employee manager
Adds a mechanism to have some fields available to the employee manager
on the public employee profile.

Here `first_contract_date` is available for the employee manager.

task-2882052

closes odoo/odoo#124640

Related: odoo/enterprise#42362
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-07-11 18:03:18 +02:00
Yannick Tivisse 71b9933411 [IMP] hr_recruitment: Avoid partner duplication
Use the application form partner as work contact when converting him into
and employee.

Use the employee work contact as user partner on user creation.

The goal is to have only 1 partner over the whole recruitment process
flow, instead of three, thus reducing the confusion for end users who
don't really know who to choose.

TaskID: 3101400
2023-07-05 14:21:28 +02:00
Yannick Tivisse e8c48f824e [IMP] hr: Remove address_home_id field
Improve usability of employee form. It is confusing for end users
to create another record to encode the employee address.

Move all the private information on the hr.employee record itself.

Remove the M2O address_home_id.

TaskID: 3101400
2023-07-05 14:21:28 +02:00
Benoit Socias b6b4db5fb5 [FIX] *: adapt front-end HTML field sanitization
*: account, event_booth, gamification, hr, project,
   website_event_track, website_hr_recruitment, website_slides

HTML fields that appear in the front-end can be modified using the
website editor. Some of them are sanitized in a way that breaks the
behavior of snippets that can be dropped within them.

This commit adapts the sanitization of those HTML fields so that the
snippets behave as expected.

opw-3267589

closes odoo/odoo#126708

X-original-commit: 7fd28afaf3e45cafbef80b69aa45c58b31fb3de6
Related: odoo/enterprise#43311
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-06-29 11:59:46 +02:00
Rémy Voet (ryv) c5cb357d90 [IMP] *: add dependencies to display_name field
The previous commit introduced an optimization to reduce the number of
queries and fields fetched when we call `name_search`. But it works much
better when the dependencies of `display_name` contain field names used
in the calculation (on the same record/model).

Then, to improve the performance and the cache coherency, add `depends`
and `depends_context` depending on the custom `_compute_display_name`.
Add only the first level of dependencies (never traverse relational
field) because only these have a positive impact on the previous
optimization and the cost is very low (see `modified`).
About `depends_context`, we don't include `lang` because (when `_` is
used by example) it is unlikely to get the same display_name in the same
request with two different lang.

closes odoo/odoo#122085

Related: odoo/documentation#4639
Related: odoo/enterprise#42599
Related: odoo/upgrade#4780
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-06-28 17:41:19 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
Wolfgang Taferner 6a8562f3d1 [FIX] hr_*: unusual days + public holidays independent of employee
In case we use multi company and a user does not have an employee
in every company which is quite normal (mostly you are employed with
exactly one company), the calendar is skipping the provision of the
unusual days like public holidays or the working schedule.

To be able to access and see the calendar in such a case we fallback
to the company calendar and fixed a domain for the public holiday
retrieval whereas the public holidays are not assigned to an employee
but the company or the companies chosen to be displayed.

closes odoo/odoo#126420

X-original-commit: d80a3965b7356f9d6b1294cf428667a1057a272b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-26 22:15:34 +02:00
ravb-odoo 16ed8d3141 [IMP] hr: add default avatar of employee
Before this commit, when the user creates new resource and employee on
the fly in many2one field, the default avatar of Initial name should be
set instead of placeholder (grey icon). The reason why a grey icon is
displayed is because the `_compute_avatar` for employee set that icon
when avatar or image is not found.

This commit add default avatar of initial name when new resource and
employee is created.

task-3251689

closes odoo/odoo#123403

Related: odoo/enterprise#41823
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-06-23 16:35:07 +02:00
Prakash Prajapati 1179ceaa42 [IMP] hr: track the value on the employee for the Department change
task-3373484

closes odoo/odoo#125200

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-20 15:58:12 +02:00
Pierre Masereel e89c54b1fe [FIX] hr: Only change bank account partner when needed
When you use the salary configurator on existing employee, you get an
error because you cannot modify a trusted bank account.

Since we cannot modify the partner_id on a bank account when it is
trusted, we should only modify the partner on the accout when it is
needed, and untrust the account when it is changed.

This has been introduced in https://github.com/odoo/odoo/pull/120423

closes odoo/odoo#125096

X-original-commit: 2ef3ebe5985368e5e859ae43bc4725dd8b8ebf06
Related: odoo/enterprise#42567
Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-15 09:05:08 +02:00
Thomas Lefebvre (thle) 856f0f481c [FIX] hr_employee: synchronise if user is removed
Steps to reproduce:
-------------------
- create two employees (A and B);
- create a user;
- add the user in Related User of employee A;
- remove the user;
- add the user in Related User of employee B;
- change the Work Email of the employee B.

Issue:
------
The Work Email of the employee A is also updated.

Cause:
------
When we add a `user_id` to an employee,
we update the `work_contact_id` field.
Fields `mobile_phone` and `work_email` are inverse fields.
When we modify them, the `_inverse_work_contact_details`
method is called.
We update the `work_contact_id` linked to the employee.

When we delete an employee's `user_id`,
we don't update the `work_contact_id`.
Therefore, when we update an employee's `work_contact_id`,
we call the `_compute_work_contact_details` method
method for all employees who have the same `work_contact_id`.

The result is that we modify the `mobile_phone` and `ẁork_email`
fields for all employees linked to the `work_contact_id`.

Solution:
---------
Differentiate the case where the `user_id` is `False` (>< `None`)
when it is modified and does not contain
a value to "synchronise" the `work_contact_id`.

opw-3338188

closes odoo/odoo#123965

X-original-commit: 85ab51c7cf7c8ee011a903a9460e2aff1296f215
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-06-07 07:55:45 +02:00
Prakash Prajapati deb93f3373 [IMP] hr: make translate department name
task-3339414

closes odoo/odoo#122479

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-06-02 14:30:07 +02:00
Kevin Baptiste 58b77d5b8a [FIX] hr: open correct employee view from settings
Clicking on the 'Employee' smartbutton on a res.users form view would
lead to a traceback if the user was not part of HR Officer.

task-3279347

closes odoo/odoo#120804

X-original-commit: b5fc8a4bacdf2964f71f2ad5c7d0c6ac30a4a9b5
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-05-09 06:07:53 +02:00
Kevin Baptiste 9122884698 [IMP] hr(_contract): remove non needed information from public employee
The employment type and first contract date were made available on the
public employee, however those fields but don't need to be publicly
available.

odoo/upgrade#4539
task-3252610

closes odoo/odoo#118333

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-04-25 18:25:50 +02:00
Sébastien Theys 90cb44e1e1 [REF] mail, *: rename mail.channel to discuss.channel
* = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot,
    mass_mailing, privacy_lookup, test_discuss_full, test_mail,
    test_mail_full, website_crm_livechat, website_livechat, base

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#118354

Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-21 02:21:53 +02:00
Rémy Voet (ryv) 234db70d86 [IMP] *: Use the new API of _read_group for backend use
Part-of: odoo/odoo#110737
2023-04-19 21:58:27 +02:00
Thomas Lefebvre (thle) 4d07f55335 [FIX] hr: add private contact to employee's followers
When creating an employee with a private contact,
the contact will not be automatically added to the employee's followers.

The desired behavior is that the contact is added
to the followers even if it has a private address.
Commit: 8760a4d0575ecdb175f73a2f2674d93962fe905d

However, this behavior will not be possible because
adding a contact with a private address is forbidden.
Commit: 20536e1bbeb641539c0de44364f8376e7cef651b

Solution:
The solution is to use the private method `_message_subscribe`.
This is not a problem in the business case.
Indeed, the people who have access to the employee's file
also have access to the private contacts.
Moreover, the access rights of the public method `message_subscribe`
do not concern this business case.

opw-3249646

closes odoo/odoo#118843

X-original-commit: f53d4a28d46baaed4c862392b36bcaa73b642336
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-04-18 08:26:25 +02:00
Martin Trigaux 69f911d994 [IMP] *: enforce usage of Markup in mail
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.

Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
  self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.

In
  self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer

Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.

closes odoo/odoo#111850

Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-13 16:39:48 +02:00
niyasraphy 7bd2be754e [IMP] hr: remove tracking from binary field
before this commit, tracking is enable for the
binary field, but odoo is not tracking binary
fields to the chatter.

after this commit, the tracking attribute is
removed from the binary field

closes odoo/odoo#118297

Related: odoo/enterprise#39631
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-04-13 04:08:40 +02:00
Rohitkumar (roku) 869c7316cd [FIX] hr: fix the on/off boarding warning in employee
Steps to reproduce:
 - Install Employees App Configuration
 - Got to the Employees > Configuration > Activity Planning > Set the  On/Offboarding Plans
 - Create Test Employee With No Catch
 - Click on Launch Plan action
 - Check the Warning in Launch Plan Wizard

When employee's coach or manager empty then warning is appeared coach's/manager's
user is not set.In this commit we have shown in the warning that the coach/manager
is not set.

task-3193218

closes odoo/odoo#115889

X-original-commit: 421c238129676a83df63f00abadd539e82ced2eb
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-03-20 18:13:23 +01:00
Louis Wicket (wil) 9afe7c74c9 [IMP] *: remove "French spacing" 👺
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#114533

Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-14 15:52:10 +01:00
Roy Le 0cf04fdd85 [FIX] hr: cannot create a new employee on the application
Steps:
1. Create Employee A that related with user A / partner A in Sales
department
2. Create a channel Sales, set Auto Subscribe Departments as Sales
department
3. Archive Employee A / user A / partner A
4. Create a application B in Sales department and click button Create
Employee
5. An error occurred: duplicate key value violates unique constraint
"mail_channel_partner_partner_unique"

closes odoo/odoo#115184

X-original-commit: e5e2cc8e00d4aec6f76283e8c5a7e485d6e9ab63
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-03-14 14:39:17 +01:00
dasz 8451eabb67 [IMP] hr: focus employee smart button on main flow
The current smartbutton is Employee(s) and it redirects to kanban view by default, no matter how many
employees a user / partner has. 9 out of 10 times a user / partner only has one linked employee, this
change renames the label to 'Employee' and redirects to the form view if there is only one employee
if there are more, the previous action is called

linked upgrade: odoo/upgrade#4363
this closes odoo/odoo#111439

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-03-07 18:02:37 +01:00
Raphael Collet e962860c6f [IMP] core: introduce search_fetch() and fetch()
This fulfills the goal of searching and fetching fields in a single SQL
query.  We introduce the new method search_fetch() for that purpose.
Also introduce method fetch() to fetch some fields for a recordset if
they are not in cache yet.

The call graph is as follows:

    search()        calls   search_fetch()
    search_read()   calls   search_fetch() and _read_format()
    read()          calls   fetch() and _read_format()

    search_count()  calls   _search()
    search_fetch()  calls   _search() and _fetch_query()
    fetch()         calls   _search() and _fetch_query()

The methods _search() and _fetch_query() are usually the ones to
override to implement business-specific logic.  The method _search()
returns a Query object to retrieve the records that satisfy the given
domain and are accessible for reading.  The method _fetch_query() uses a
Query object to retrieve fields from the database and store them in
cache.

Also use search_fetch() to save one query in search_read() and the
reading of one2many fields.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet 46c23fd64d [IMP] *: _search() always returns a Query
Goal: make _search() always return a Query object, in order to make
search_read() in a single query when possible

Adapt the overrides of _search() towards the given goal.

Part-of: odoo/odoo#112126
2023-03-05 15:12:55 +01:00
Raphael Collet 7e6cff5479 [IMP] core: search() and _search() no longer have parameter count
The parameter in search() is redundant with method search_count(), and
was making the calls less readable.

The method _search() is aimed at always returning a Query object.  The
method can therefore never return an integer, hence the removal of the
parameter.  This does not actually remove any functionality from the
method; counting result is simply given by using it differently.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Pierre-Yves Dufays 4cec1e12d8 [REF] various: apply main attachment mixin on models that use the feature
Add mail.thread.main.attachment in the inheritance chain of all models that
use the main attachment feature.

Note that we remove the main attachment from crm_case_15 of the demo data as
crm_lead doesn't use that feature.

Task-2648976

Part-of: odoo/odoo#110734
2023-03-02 12:32:11 +01:00
Dossogne Bertrand 13c575afde [IMP] hr{|_hourly_cost}: move employee currency field
This commit moves the currency_id field on the
employee model from hr_hourly_cost to hr in order
for it to be used in payroll localisations.

task-3029348

closes odoo/odoo#113992

X-original-commit: 60599b735568c1873fdfde85e667b05347432382
Related: odoo/enterprise#37661
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-03-01 23:28:18 +01:00
Martin Trigaux 93af90cc1d [IMP] hr: better log message
Before this commit the message was only containing a message 'Personal
information update.' but it was not clear why the person was receiving
this message nor why he was receiving it.

closes odoo/odoo#113550

X-original-commit: de0061326bbd9e2fc5319c05448395afa5b71afe
Related: odoo/enterprise#37492
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-02-24 08:12:04 +01:00
Sylvain Francis 3642dd2646 [FIX] use correct user for work permit expiration reminder
Before this commit:
We use the employee's manager's user's idto fetch a partner by id.
This can cause the action to fail in specific cases as well as
potentially using the wrong language for the reminder

closes odoo/odoo#113282

X-original-commit: c26db495c929d60de62a36cf920c88f6f4c855b9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-02-22 11:42:00 +01:00
Raphael Collet 80ad999475 [FIX] core: cache consistency of field parent_path
The field is updated in SQL but not in cache.  Also remove hacks in the
business code to prevent potential issues from this behavior.

closes odoo/odoo#113119

X-original-commit: 8bb660c985c7a1349cae1bf58dc5bf7981bd9058
Signed-off-by: Rémy Voet <ryv@odoo.com>
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-02-20 13:44:36 +01:00
Kevin Baptiste 145ecfcc55 [FIX] hr: employee should be subscribed
The employee should be subscribed to their own record in order to
receive communication send to them.

closes odoo/odoo#112736

Taskid: 2749585
X-original-commit: 43d99b06a792a39aa14b7afb8b48aa79c2da2737
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-02-15 09:11:32 +01:00
Kevin Baptiste 901e3814fc [IMP] hr: allow users to manage plan activities
When starting an onboarding/offboarding plan on an employee, activities
were only created for the users that were part of the HR Officer group.

Regular users can't access the `hr.employee` model and it's not possible
to have activities on `hr.employee.public`.

A new model has been created to manage those activities and is only
accessible to the user and their manager.

task-3151758

closes odoo/odoo#111505

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-02-14 15:52:03 +01:00
Nicolas Bayet 9731e9be6d [FIX] web_editor,project,note: ensure same history
This commit add a mechanism to ensure that someone could never save
changes from an history that diverge (in case there is a partition in
the RTC network or a person A was disconnected while another person B
saved changes that were not transmitted to person A).

task-3002163

closes odoo/odoo#112099

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-02-09 10:49:00 +01:00
Jeremy Kersten 7ce1c614ae [FIX] hr, hr_holidays: avoid useless write on res.group or res.users
hr_holidays:
Portal user don't have responsibles group by default. But on each new
portal user we call the `_clean_leave_responsible_users` and make useless
write on res.groups.
After this commit, we only call it if at least one user (of self) have
the group to be removed.
If a user has the group, now we remove the group from the user, instead
to remove the user from the group; it reduces the risk of concurrent
update, and have more readable log.

hr:
Avoid writing on employee model if no employees match the current user.
Calling write on empty recordset call all the override for no reason.
In the case e.g. of the first connection of a portal, the tz will be set
on the res.users which will trigger all the overrides of write (including
the _clean_leave_responsible_users which update group for nothing before
this commit), while we have no employees linked to this portal user).

closes odoo/odoo#111870

X-original-commit: d8d74e6247c359e94584014adb9aeda7179f6f96
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-02-03 16:32:37 +01:00
Yannick Tivisse 7bce5f3f95 [MOV] resource: Split files according to coding guidelines 2023-02-03 10:25:00 +01:00
Miquel Raïch 317463fb21 [IMP] *: Remove unnecessary view_type
closes odoo/odoo#110817

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-01-30 19:45:59 +01:00
Thomas Lefebvre (thle) ea96e51e9e [FIX] hr: duplicate employee without keep the same contact
Steps to reproduce:
- create an employee and fill in the email address;
- duplicate this employee;
- change the email address of the new employee.

Issue:
The email address is changed on both employees.

Cause:
When we duplicate an employee, we keep the same contact.
By modifying the email address, we will modify the contact's email address.
Then we "synchronise" all employees with their contact
using the contact information.

Solution:
When an employee is duplicated, a new contact must be created.
Therefore it is necessary to avoid copying the `work_contact_id` field.

opw-3144129

closes odoo/odoo#111201

X-original-commit: 1582f6834bee2123f8703b2ae52996b0978e2311
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-01-27 12:58:46 +01:00
Kevin Baptiste 2a5b80a6d4 [IMP] hr,resource: automatically compute number of hours
- Automatically compute the average number of hours per day on
   resource.calendar;
 - Don't allow to change the working hours of an employee when they have
   a current running contract;
 - Seperate smart buttons on resources to distinguish Material / Human.

 task-3102517

closes odoo/odoo#109768

Related: odoo/enterprise#35718
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-26 10:16:53 +01:00