Commit Graph
223 Commits
Author SHA1 Message Date
Martin TrigauxandXavier Morel 49838338e0 [FIX] *: sanitize action content reading
The open_action_with_context was not using _for_xml_id, producing an
error when reading the action content.

In open_action, the action_name was taken from the context and needs
sanity checks. Ensure only actions from the account module can be
read and only if the user has access to the target model.
This is a limitation of the previous behaviour but, at the moment, all
known calls are made refering to an action from the account module.
Limit the scope of this method while the 14.0 is still early to avoid
having a door open to ready any action, and difficult to close later.

Remove old action fetching from the context in create_move that is no
longer used.

closes odoo/odoo#61602

X-original-commit: a39e94f7e4dc74e850650ac90bbc5f85af130bc8
Related: odoo/enterprise#14695
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-11-10 16:04:29 +00:00
Yannick Tivisse 64b1056e5c [IMP] hr: Add a warning when changing employee's company
closes odoo/odoo#57973

Related: odoo/upgrade#1784
Related: odoo/enterprise#13312
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-09-18 11:00:25 +00:00
Yannick Tivisse 2511f5a889 [FIX] hr: Allow editing some missing fields on My Profile
Purpose
=======

Some fields weren't editable, even when the option is enabled on
the settings.

closes odoo/odoo#57842

X-original-commit: 57d595e87642fa6f7bec62cbb88a39c35cc72589
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-09-16 14:06:59 +00:00
Francois (fge) 093641cd73 [FIX]hr: employee and user image synchronization
Remove the employee's image by default to avoid unnecessary image storage.
Add a placeholder in the kanban view.

closes odoo/odoo#55243

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-13 07:55:07 +00:00
Dharmraj Jhala 610ba98539 [FIX] mail, crm: do not display body in creation message when having a subtype
Right now on few business objects (like leads, invoices, tasks, helpdesk
tickets etc) creation message contains
  * subtype description;
  * generic creation message;

This looks like multiple creation message on chatter after creation of the
record as you generally have "Task Created - Task created" (subtype description
then generic message).

This happens when we provide custom subtype on creation by by overriding
`_creation_subtype` method.

This commit fixes the issue by only using provided creation subtype and
removing default body. If creation subtype is not provided default creation
message is posted as before.

In this commit we also fix subtype for Lead/Opportunity creation and make
it generic ('Lead/Opportunity created') to avoid inconsistent behavior.

Finally some cleaning is made in method naming. Semi followup of 92e9e84b63

LINKS

Task ID-2288458
PR odoo/odoo#56631
PR odoo/enterprise#12707

closes odoo/odoo#56688

X-original-commit: 2ebbeb4b5443c6405dd9a3b202a1eee9c5c67ebb
Related: odoo/enterprise#12728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-28 07:59:24 +00:00
Thibault Delavallée f5c6f14bb1 [REF] mail: move generic methods from thread to BaseModel
PURPOSE

Since v13 some commits added code in mail thread file. This file is already
quite long and keeping it organized allow to understand its content.

SPECIFICATIONS

Some methods defined on mail.thread may actually be called on models
not inheriting from mail.thread . Instead of having model methods on mail
thread receiving a records parameter it seems better to have those available
directly on BaseModel.

Move static_message_track on BaseModel in models.py. This method is now called
_mail_track, to be coherent with othe rmail-related naming. It is used in
accounting to track values in line model that does not inherit from mail.
thread. Update accounting accordingly (followup of d862965).

Move _message_get_default_recipients_on_records in models.py. Renaming it
_message_get_default_recipients() allow to be compatible with current behavior
and current override available in some addons (like CRM, event, ...).

Move _notify_get_reply_to_on_records in models.py. Renaming it
_notify_get_reply_to() allows to be shorter and coherent.

Move _alias_check_contact_on_record in models.py. Renaming it
_alias_check_contact_() allows to be shorter and coherent. Its override in
hr is also moved on BaseModel.

LINKS

Task ID-2327096 (code cleaning)
PR #56631

X-original-commit: f5df1ed912455e5ed52a65df3149f30a9d424de0
2020-08-28 07:59:23 +00:00
Barad Mahendra 7fee15258d [FIX] hr: Properly define the compute method to avoid access error
Currently, Due to _compute_phones method when going to read
the work_phone and mobile_phone from salary configurator then
it will randomly failed on read access right for those two fields.

So in this commit, Defined the _compute_phones method properly and
remove the compute from mobile_phone as it's not computed anymore.

TaskID: 2283753
Closes: #56205
2020-08-21 04:40:03 +00:00
Raphael Collet 69869ab681 [IMP] core: introduce subqueries in search
Make the method `_search` return a `Query` object, and make that object
generate a subquery when used on the right-hand side of a condition.

closes odoo/odoo#52403

Related: odoo/enterprise#10945
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-08-18 13:02:41 +00:00
Martin Trigaux 6156f98288 [FIX] *: adapt action content retrieval
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.

Add sudo for other operations on ir.actions.*
2020-08-17 09:09:02 +00:00
Francois (fge) c06bb52f57 [IMP]hr_recruitment: Back2Basic - Improve Recruitment usability
Added a new tour for the module hr_recruitment

Hr.job:
Form view:
- Using a notebook view for increased clarity
Kanban view:
- Added a toggle button to publish/unpublish a job offer.
- In the menu, added the « Create Interview Form » button to create an interview form.

Hr.applicant:
Generale:
- Use of the "Applicant: Acknowledgement" template by default when an application is moved to the "First Interview" stage.
Form view:
- Possibility to consult an interview after this one and not before
- The "CREATE EMPLOYEE" button no longer directly creates an employee. The employee will be created if the "SAVE" button is pressed.

Hr.employee:
Generale:
- Added of two new certifications.
And some other minor style and name changes.

closes odoo/odoo#55928

Related: odoo/enterprise#12420
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-14 14:51:41 +00:00
Baptiste Vergote 8de815e8fc [FIX] hr_employee: company_id required
On the dashboard of Time Off (calendar view), the banner displaying
the remaining leaves is not shown as _get_contextual_employee_id
of hr_leave_type.py is returning False due to the missing required
on the company_id of hr.employee.

A fix was made in 2bd5e9a but missing the part that the employee_id
is not required. Confirmed by YTI

close opw-2252479

closes odoo/odoo#53109

Related: odoo/upgrade#1596
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-12 10:36:50 +00:00
Kevin Baptiste d24de2554e [IMP] hr,hr_attendance,hr_contract,hr_holidays,hr_presence: update employees presence icons
Make the employee presence icons more descriptive.
Allow to quickly filter the Presence Reports based on the user status.

closes odoo/odoo#54527

Taskid: 2246447
Related: odoo/upgrade#1488
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-05 12:22:29 +00:00
Simon Genin (ges) 8a6a4766d9 [IMP] hr_employee: improve form usability
Improve slightly the layout of some forms related to employee and contracts.

Modified modules:
hr
hr_expense
hr_holidays
timesheet_grid
hr_contract_salary
hr_payroll_account

Task ID 2277298

closes odoo/odoo#52981

Related: odoo/enterprise#11156
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-04 09:21:00 +00:00
Yannick Tivisse 7d281b3f7f [FIX] hr: Don't link another menu_id when lauching an onboarding plan
closes odoo/odoo#53814

Taskid: 2219194
X-original-commit: 2050bd95bf6773f0fd3174d13843f763641e00ab
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-06-29 14:07:00 +00:00
Hardik Prajapati 999507007e [IMP] hr: Sync some data between user and employee
Purpose of the task is to improve the employee image and phone
behaviour while changing the user.

So in this commit, IF there is no pitcure on employee then apply the
image of user while adding the user to employee from cretae, write
and onchage. do not  change the employee image if employee image is
already set while creating employee or changing the user on employee.

Also improve the phone behaviour when changing the company,
  - Never change the mobile_phone when switching the company
on employee
  - Always change the work_phone when switching the company, except
if empty on res.company.

closes odoo/odoo#50115

Taskid: 2240167
Closes: #50115
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-06-23 11:53: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
Nasreddin (bon) e6df7bb718 [FIX] hr: Empty required name on quick create department
Issue

	- Open console in debugger of the browser.
	- Install "Employees" app
	- Go to "Employees" and edit or create any employee
	- In 'Department' field, quick create one

	Error is raised in console and the modal department form view is opened.

Cause

	'name' field is required but empty since 'complete_name'
	is the one set as _rec_name in 'Department' python model.

Solution

	Cherry-pick of 7c0fed48a1

opw-2267356

closes odoo/odoo#52489

X-original-commit: 056618914e9f1f437f8855459c302fc0ac6663c5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-06-05 10:19:01 +00:00
Yannick Tivisse f1e2fde734 [IMP] hr: Improve settings layout
closes odoo/odoo#51334

Taskid: 2241726
Related: odoo/upgrade#1202
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-26 07:13:59 +00:00
Yannick Tivisse 12b526432f [IMP] hr: Display chat icons on employee kanban/form views
Purpose
=======

On the Employees App, we dont have a smart way to start a discuss
with a colleague or an employee.

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

Style for each button :
- use fa-comments
- use primary color/action color (green)

On private/public employees form/kanban views, add a button to
start a chat with the user

closes odoo/odoo#51484

Taskid: 2252207
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-25 14:50:19 +00:00
Yannick Tivisse 03a11b5a0e [REV] hr: revert f33644df65bcd4133689855018850c1b1deac7a6
Purpose
=======

By using the user's related company to create a employee, we prevent
creating several employees for the same users on the basic flow.

But this is exactly the way we want people to use the system.

Example: Jojo is working in Belgium, has a belgian employee liked
to a belgian user in the system.

Now Jojo is about to work during 1 year in another company, based in
the USA. Jojo wants another employee, to manage the HR things
properly (payroll, ...), but he doesn't want to have 2 users, he
prefer to manage all its notifications in the same place.

We create another employee for Jojo, in the US company.

So instead of creating the employee in the user's company (Belgian),
as it would raise an error for the second employee, we should use the
contextual company instead, allowing to create the second employee
smoothly.

closes odoo/odoo#51435

X-original-commit: 0318f0acc5e98950c274c90a86a94d4588d2966d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-18 11:58:10 +00:00
Swapnesh Shah 665c2d536f [FIX] hr: use correct company for new employee
Before this commit, Creating New Employee from User's form was taking default company from the current logged-in User instead of the User for which it Employee is being created.

With this commit, We take default company from User for which employee is created.

closes odoo/odoo#51014

X-original-commit: 9206cc4db2a8dc5a7fbc281c1574f09bfba76544
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-11 10:13:29 +00:00
Swapnesh Shah e3b4eac59b [IMP] hr: in plan, display activity name when raising the error about unassigned activity
Before this commit, the user was not aware of the activity for which
configuration is missing. In this commit, we display `Activity name` in the
warning to helpfixing configuration.

Based on Feedback at https://github.com/odoo/odoo/pull/44922#issuecomment-584057134

closes odoo/odoo#50529

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-06 06:24:51 +00:00
Yannick Tivisse 85b199b9be [IMP] various: Set a default random color on certain tags
Purpose
=======

For a tag to be displayed on a kanban card, it needs to have a color set.
We won't be changing that behaviour, since it would mean having
two options > the color, and whether or not to show it in the kanban

The purpose of this task is to set a color on new tags to make the user
save a bit more time, set a color for him as he might not find the feature,
and make sure the tag will be on the kanban cards.

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

For each of the following models, at creation, set a random integer between
1 and 11 in field 'color'

Models:
res.partner.category
crm.tag
project.tags
hr.applicant.category
helpdesk.tag
hr.employee.category
event.track.tag
mrp.eco.tag
repair.tags

closes odoo/odoo#49967

Taskid: 2234527
Related: odoo/enterprise#10112
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-22 11:32:35 +00:00
Lucas Lefèvre 45170ceeb5 [IMP] various: Hide default user image for unassigned records
Impacted modules: account_analytic_default, crm, event,
hr_recruitment, maintenance, mass_mailing, project,
purchase_requisition, stock_picking_batch, website_slides

The default image displayed when the record is unassigned is
confusing, so we are removing it.

FP request
Task 2234524

closes odoo/odoo#49333

Related: odoo/enterprise#9834
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-28 13:16:29 +00:00
Swapnesh Shah 7c8ae751f8 [FIX] hr: allow to copy employee linked to user
Before this commit, It was not possible to copy An employee which is already linked to User due `user_uniq` constraints.

Now we add `copy=False` on `user_id` field, so Employee will be copied without linked User.

closes odoo/odoo#49915

X-original-commit: 2a63df03859166414be338c6655ee8c4052666b7
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-22 07:28:29 +00: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
Tiffany Chang (tic) 1ac243c21c [IMP] various: Replace incorrect use of "edition"
"Edition" is a French-English false friend word. "Edition" in English
means "version" whereas "edition" in French means "editing". This commit
updates user facing strings/documents that incorrectly use "edition" instead
of "edit" or "editing". Attempts were made to clean up English around
"edition" usage so please excuse any errors from lack of context
knowledge. Code comments and names incorrectly using "edition" were NOT
updated.
2020-03-31 10:31:35 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
jbm-odoo b446a1e958 [IMP] hr: Add user slash if no employee set
If employee is not set, the default picture will be user-slash
instead of camera.

Task ID 2221250

closes odoo/odoo#48114

Related: odoo/enterprise#9398
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-20 13:17:31 +00:00
Rémy Voet (ryv) c5e6511e8d [IMP] mail: ease bounce email content update based on alias security
PURPOSE

When incoming emails bounce due to alias security bounce email is quite
generic. Purpose of this task is to ease its customization and update.

SPECIFICATIONS

In order to improve the flexibility of alias, add a customizable html field
on the alias model. This html content will be send as bounce email core content
in case of bounced/unauthorized mail received for this alias,

Obviously it has no effect on 'everyone' security setting as no email will
bounce due to that issue.

If it is not set a default generic mail will be send depending on security
setting. It allows to keep void html fields when no specific bounce content
is required

In HR, an old template allowing some light customization for employee based
security option is removed as it is completely replaced by the new feature.

Also add references message-id of the mail received to the answer so that
threads are correctly set.

LINKS

Task ID 2126509
2020-03-12 13:54:32 +00:00
jvm-odoo 3da7db8cb6 [FIX] hr: fix employee creation from user form
Issue

- Install Employees
- Create a new user
- Click on "Create employee"

Traceback

Cause

In 999ced42989f, we add the user_id key but we
already have in the action_create_employee method

The key is duplicated so this is why there is a
traceback

Solution

Remove the key in action_create_employee since
we have it in _sync_user

OPW-2205354

closes odoo/odoo#46375

X-original-commit: e0c29f1a4cd8d95654963b024fd0b0e1b0578776
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-02-26 16:31:34 +00:00
qho 64460c38ac [FIX] hr: quick user creation and assign user to employee
When creating a new user on-the-fly on the employee detail page (HR Settings/Related User), if the employee is never linked with a user before, the new created user will not be linked with the employee automatically and we have to select the user again.

With this commit, the new created user will be linked with the employee automatically.

Fixes #44442

closes odoo/odoo#46125

X-original-commit: 136c0dbea0ab00ff27daac69c27dc0824a16ff70
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-24 14:44:37 +00:00
Prakash Prajapati da591f5c6c [IMP] hr: Default employee gender should be null rather than male
Purpose of the task is, when creating a new employee, the default
gender should be empty.

closes odoo/odoo#42843

Taskid: 2165484
Closes: #42843
Related: odoo/enterprise#7648
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-02-12 09:57:58 +00:00
Swapnesh Shah 5e63519c66 [FIX] hr: Remove unnecessary argument
Followup on 5ce8f1e375
Before this commit, There would be traceback on Launching Plan with `Responsible` set to `other` and No `Responsible Person` defined on activity due to Extra argument.

In this commit, We remove that extra Argument.

closes odoo/odoo#44965

X-original-commit: 009e5526ee398415693d1d3df8f3c2ac546fd258
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-02-10 11:52:59 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
yhu-odoo 32fc38ef58 [IMP] hr_appraisal: Improve employee archiving flow
PURPOSE
=======

When you close a payroll (employees), there are often a lot of document
linked. Archiving an employee should archive the contract, cancel future
leaves, archive the private address

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

Add departure date (hr):
  - Add a Date field to both hr.departure.wizard and hr.employee. In
    the wizard, the field is required.
  - In toggle_active() method in hr.employee, set departure_date to
    false when unarchive the employee.
  - If user has a current running contract, a user error will raise if
    user enter a departure date earlier than the start date of the
    contract.
Add checkbox to set a closing date on hr.contract (hr.contract):
  - In the hr.departure.wizard, set the departure date to be the end
    date of runing contract. Set the states of all draft contracts to
    "cancel".
Add checkbox to free car (hr.fleet):
  - In the hr.departure.wizard, set end_date to
    fleet.vehicle.assignation.log, if there is no end_date or end_date >
    departure_date
  - Go through fleet.vehicle, find records with dirver_id to be the
    employee, set it to False.
Add checkbox to archive private address (hr):
   - when the private address not link to a internel user, set
     employee.address_home_id.active to Flase
   - unarchive it after the employee unarchived
Add checkbox to cancel future appraisals (hr.appraisal)
   - find all appraisals link to the employee and state in
     ['new', 'pending'], set their state to 'cancel'.
Add checkbox to cancel future leaves (hr.holidays):
   - only consider leaves are not in state ['refuse', 'cancel'],
     find leaves with to_date > departure_date, set their state to
     'cancel'.

PR #42526
Task 2153106

Related: odoo/enterprise#7471
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-29 10:05:12 +00:00
Nisha patel b7c5b28b9c [IMP] hr(_expense,_holidays): modify help message
In Employee / Work information / Responsible: there is a lack of
information on the "help message" The objective is to change text
in the help message by the ones below:

Field "Coach":
  -Employee responsible of this employee.
  -The "coach" has no specific rignts or responsibilities by default.
Field "Time Off":
  -User responsible for approving "time off" of this employee.
  -If empty, the approval is done by any administrators or approvers (determinated in settings/users)
Field "expense":
  -User responsible for approving "Expenses" of this employee.
  -If empty, the approval is done by any administrators or approvers (determinated in settings/users)

TaskId :2168330

closes odoo/odoo#43467

Closes: #43467
Related: odoo/enterprise#7778
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-24 09:59:40 +00:00
Andrea Grazioso (agr-odoo) ba69b1d534 [FIX] hr: fix badge generation for cashier
Open Employees>[DEMO]. Go to HR Settings and generate badge id
Now go to POS Settings, enable "Login with Employees". Now open
the session and login by scanning the [DEMO] employee badge.

The badge will not be recognized, this is caused by the fact that the
badge is 8 digits randomly generated, while the parser recognize
cashiers only if the barcode has a prefix of 041.

Fixed the badge id generation, and adjusted the length to other barcodes
in the system

opw-2151942

closes odoo/odoo#43228

X-original-commit: 90bcda64ba6058169b48ff8214e7c2a98eb9a0f8
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-13 15:52:04 +00:00
Swapnesh Shah f13fdbb699 [IMP] hr: Improve model description
Fixes https://github.com/odoo/odoo/issues/42559

closes odoo/odoo#42648

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-02 17:53:36 +00:00
jbm-odoo 9725eadfdd [Fix] hr_employee: Fix compute fields
When we add a user to employee, we can have problem with leave,
expense or coach manager. It's due to those compute fields.

closes odoo/odoo#40795

Related: odoo/enterprise#6865
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28 10:40:34 +00:00
Victor FeyensandMichaël Mattiello 0eadc0aa5e [IMP] mail: better prevent activity type removal and add a fallback mechanism
Current activity types master data cannot be unlinked through a quite harsh
override of unlink using xml id existence, introduced at 2602642a78.
Some of them are real master data, other could be unlinked if users want it.
Finally custom activity types may cause errors when removed if used in some
side models like server actions or automated actions.

To allow more flexibility we remove the removal constraint and implement
a fallback mechanism. It is implemented in mail.activity.mixin when calling
activity_schedule(xmlid, ...). If the given xmlid is not found
_default_activity_type() specifies the default activity to use. It can
be overridden in modules if some specific behavior is wanted.

e.g.

def _default_activity_type(self):
    """Define a default fallback activity type when xml id not found
    only used in in activity_schedule() for now.
    """
    try:
        return self.env.ref('mail.mail_activity_data_todo')
    except Exception:
        return False

In this commit we also

  * restrict deletion of activity type (hr.plan and ir.actions.server);
  * fallback on default activity type if xmlid ref not found in
    activity_schedule;
  * correct calls to activity_schedule and replace some manual creation calls
    by activity_schedule;

Task ID 1961156
PR #39013

Related: odoo/enterprise#6238
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Victor Feyens <vfe@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2019-11-25 14:17:31 +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
Victor Feyens 9215e73fa2 [IMP] * : replace with_context(force_company=c) by with_company(c) 2019-11-18 12:25:05 +00:00
jbm-odoo 83ab007377 [FIX] hr: Fix consitency in employee form
Before this commit:
Private email and phone are related of partner 'address' fields.
But the phone was read-only and the email is editable.

After this commit:
As phone and mail are related, they are read-only. We must edit
them on the partner of Address field.

close #38518

closes odoo/odoo#38872

X-original-commit: ed6fb25ca0671a520c9d003a58eefefcf93dbc1a
Signed-off-by: jbm-odoo <jbm-odoo@users.noreply.github.com>
2019-10-16 11:52:06 +00:00
Swapnesh Shah 6f128fa959 [FIX] hr: Display archived employee on user form
closes odoo/odoo#38143

Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-10-07 19:53:55 +00:00
Stéphane Bidoul (ACSONE) c8c8413e3e [IMP] mail: enforce kw args for message_{post/notify/log}
Since there are message_post overrides using the form `def message_post(self,
**kwargs)` in some modules, this method is intended to be invoked with keyword
arguments only.

This commit enforces this behavior. Calls such as `message_post("body")` will
fail regardless of which addon is installed, forcing users to use
`message_post(body="body")`.

It also fixes a message_post override in hr, and applies the same
mechanism to message_notify, and _message_log.

closes odoo/odoo#33306

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-02 15:42:04 +00:00
Geoffroy Larue 9a39194813 [MOV] hr, resource: unavailability methods
Move and adapt gantt unavailability related methods (
_get_work_interval() and _get_unavailable_intervals() ) from
hr.employee to resource.resource. This move allows the unavailability
to be generated for users without related employees (like in FSM in
enterprise).

Task-2069861

closes odoo/odoo#36785

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-09-30 07:59:10 +00:00
Yannick Tivisse b72aaca051 [FIX] hr: Correctly compute last_activity date 2019-09-23 07:56:12 +00:00
Yannick Tivisse cb55db51b7 [FIX] hr,hr_presence: Correctly retrieve config parameters values 2019-09-23 07:56:12 +00:00
Lucas Lefèvre 79228dd4d0 [FIX] hr_holidays: Call onchange parent_id
Currently, parent_id is defined on hr.employee. This field
as an onchange defined.

But the inherit of hr.employee.base in the leave module
adds an onchange('parent_id'). The onchange method is never
called because the onchange in hr.employee does not call super
(which it's not supposed to do because the parent model
does not have the parent_id field).

To fix the issue, parent_id and all its onchange methods
are now defined on hr.employee.base
2019-09-20 09:23:27 +00:00