Commit Graph
2946 Commits
Author SHA1 Message Date
David Monjoie addeae990f [IMP] base,doc: add scales attribute to gantt view
closes odoo/odoo#31210
2019-02-19 08:28:29 +00:00
David Monjoie 7c48315d7a [IMP] base,doc: add offset attribute
Depending on the scale, the number of units to add to today to
compute the default period. Examples: An offset of +1 in default_scale
week will open the gantt view for next week, and an offset of -2 in
default_scale month will open the gantt view of 2 months ago.
2019-02-19 08:27:53 +00:00
Christophe Monniez fec86404e7 [IMP] tests: replace browser_js success and failure strings
When evaluating js tests using the browser_js method, they are
considered a success when 'ok' is found in the console log and a failure
if 'error' is found instead.

This is not very robust and recently failed with this commit : 7410de111f
It adds a filter named 'Error' in a view, when the 'click_all' test
clicks on this filter, a message with the name of the filter is written
in the console, wrongly leading to a test failure.

With this commit, the browser_js method expects a log message in the
browser console with the explicit text "test successful".
On the other hand, any error in the console log will lead to a test
failure but a test can be forced to fail with the explicit error message
in the browser console "test failed".

As a bonus, the python logger should now also log browser js trace messages.

closes odoo/odoo#31158
2019-02-19 08:06:07 +00:00
Sébastien Theys 1302654646 [IMP] base,web,website_sale: add tests for product image and mixin
This commit will add tests for the PR #30656 which added the following commit:
7daa85dd12

The tests in the current commit achieve 100% code coverage for:
- the `image.mixin`
- the overridden `image.mixin` methods in `product.product`
- the `_get_images` methods of ecommerce
- the size logic in method `content_image` (route `/web/image`)

PR: #31181
2019-02-18 09:43:06 +00:00
David Monjoie 867df179ca [IMP] base,doc: re-add consolidation feature to gantt view
closes odoo/odoo#31159
2019-02-18 07:23:32 +00:00
57b5e8d9f5 [IMP] base, doc: adapt according to the new gantt view
The view has been rewritten from scratch so the doc and the RNG validation
needed to be adapted.

Co-authored-by: dmo-odoo <dmo@odoo.com>
Co-authored-by: aab-odoo <aab@odoo.com>
Co-authored-by: jat-odoo <jat@odoo.com>

See odoo/enterprise#3437

Task 1856235
2019-02-14 16:44:40 +00:00
7daa85dd12 [IMP] base,product,website_sale,*: improve product images
* = account, purchase, website_sale_comparison, website_sale_wishlist

Raw Image & Mixin
=================

Previously, the main image from a product was stored resized. This caused
inconsistencies with the size of the images on ecommerce: the main image was
resized, but the extra images were not.

Now, we always store all raw images, thanks to the new mixin. This way, product
images that were created before the installation of ecommerce will be ready to
be used in ecommerce without any other change.

We also store the resized versions instead of computing them on the fly: this
will take more disk space, but significantly increase the speed of the
pages when displaying images, as well as reduce server CPU load.

Images on variants
==================

Previously, it was only possible to set the extra product images on a template,
and not on a variant.

Now, we allow extra images also on the variants, this gives more flexibility to
the user.

Both extra images on template and variant have been given a sequence field to be
able to sort them easily.

On /shop we always display the image of the template for performance reasons.
On /product we never display the image of the template, unless the variant has
no image, then the template image is the fallback.

Carousel
========

The carousel view has been cleaned and improved:

- remove the duplicate XML that was created with the product configurator fix
- use a single loop from a single source to get all the images, instead of
	merging the different sources in the view with complex conditions
- improve the HTML structure, reduce the CSS with appropriate classes

Preview Image
=============

Both in website and backend: make better use of `preview_image` to display
a small image whenever possible, to reduce download size for the end user.

task-34045
PR: #30656

Co-authored-by: Parth Gajjar <pga@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2019-02-14 16:37:25 +00:00
Sébastien Theys 413c63556f [IMP] tools,base,web: improve image tools
Add support for a 256*256 image, to be used in the following commit.

Define sizes in named variables instead of being hard-coded in several places in
the code.

Allow parameters `preserve_aspect_ratio` and `upper_limit` to be passed from
the different helper methods.

Factorize the code inside `image_resize_images` to make it easier to read.

Add new function to compute whether the size of an image is above a given size.

task-34045
PR: #30656
2019-02-14 16:03:09 +00:00
Robot Odoo 1f2766a955 [IMP] Add employee profile
[IMP] hr_*: introduce the employee profile
================================

## General Purpose

We want an 'Employee profile' gathering every data about an employee.
The main form view is modified to become this employee profile.
A user can also see his own profile through the Preferences menu.
The new profile replaces the current Preferences view if the `hr` module is installed and the current user is linked to an employee. The Profile will show the employee of the current company.

A user should be able to see and edit his own profile.

*Problem*:
Many fields on hr.employee are protected by `groups="hr.group_hr_user"`.
Therefore, a regular user cannot see or edit those fields.

This protection must be bypassed to allow read/write access to the regular user's own data.
A similar mechanism already exists for `res.users` (for Preferences)

The better (least worst) solution found is to reuse this mechanism by adding related fields on `res.users`.

Pros:
- Don't change security access on hr.employee
- Don't implement yet another custom security layer, risking to add new security breaches
- A lot of fields are added by other modules on hr.employee.
  It would have required to integrate them with the custom security layer.
- Fields added by other modules on the user's preferences view (normal view, not the profile)
  are automatically included in the employee's profile view.
- Allow the hr.employee form view to be different than the user profile accessible
  through the Preferences menu.
  E.g. add custom buttons only relevant to the logged in user such as "Request a leave".
Cons:
- Each field from hr.employee that you want to appear on its profile
  must be added as a related field on res.users
- Those related fields must be added to user's preferences view (duplicate views)
- They also must be added to `SELF_[READABLE | WRITABLE]_FIELDS`

Note:
When the front-end loads the views it gets the list of available fields for the user (according to its access rights). Later, when the front-end wants to populate the view with data, it only asks to read those available fields. However, in this case, we want the user to be able to read/write its own data, even if they are protected by groups (groups are kept on the related fields on res.users). The front-end need to be made  aware of those fields by sending all field definitions.

## Changed modules

### hr_attendance

Adds a stat button to this employee profile showing the number of hours worked last month.

Remove the Boolean computed field `manual_attendance`.
This field is just a shortcut to add/remove the employee's user in the "Manual Attendance" group.
The checkbox is confusing on the employee's form and this should be done through the normal group management screens.

### hr_presence

Display the presence status on the employee kanban template.
The status is a colored chip which can be green (present), orange (to define) or red (absent).

Currently, the presence status is only computed when accessing the report view. As this commits displays it on the employee kanban, it should be updated more frequently.
The state should not be updated every time the kanban view is loaded since the computation is a bit heavy. Instead: add a cron to update status every hour.
-> The status is accurate on the report view (status is still updated
   when loading the view)
-> The status in accurate at 1 hour on the kanban view

### [ADD] hr_attendance_presence

Bridge module between `hr_attendance` and `hr_presence`.

This PR integrates `hr_presence` module in the employee profile and adds the presence status on the employee kanban view. But `hr_attendance` adds at the same place a similar status icon for checkin/checkout.
This bridge module makes the status from `hr_presence` invisible as `hr_attendance` should be the main presence control mechanism.

Also, this commit adds the ability (through a new setting option) for `hr_presence` to take into account checkin/checkout to determine the presence status.

### l10n_be_hr_payroll
integration with employee profile

[ADD] hr_skills: Introduce a new module for employee resumé and skills
=======================================================

Purpose
-----------

Consultancy companies need resumé and skills of their consultants.
For big projects, they often need to send them to their customers.
These information are also useful to statistics.

Specification
-----------------

### New models

####  `hr.resume.line.type`
Types of resumé lines. e.g. *Experience*, *Education*, *Hobbies*

#### `hr.resume.line`
It is a line in the resumé of an employee.

#### `hr.skill`
Name of a skill. e.g *French*, *Python*, *Piano*

#### `hr.skill.type`
Skills can belongs to a particular type. A skill type has skill levels associated.
e.g. *Languages*, *Dev*, *Music*

#### `hr.skill.level`
Levels available for a particular skill type. Each level has a label
and a progress (between 0 and 100) associated.
e.g. *Intermediary (20%)*, *Advanced (85%)*, *Expert (100%)*

#### `hr.employee.skill`
These are skills which employees have. It links an employee with a particular skill
and level.
e.g. Mitchell has an *Intermediary* level in *Python*

### Access Rights

Only a `hr_user` can create/edit `hr.resume.line.type`, `hr.skill`, `hr.skill.level`, `hr.skill.type`.
If employees are allowed to edit their infos (setting), they can also create/edit `hr.resume.line`,
`hr.employee.skill` for themselves.

### UI

Resumé lines are displayed, grouped by type, in a new 'Resumé' tab in the employee
form. Resumé lines can be reordered (handle widget)

Emloyee skills are displayed in the Resumé tab, grouped by skill type.

[IMP] hr, hr_holidays, hr_expense: Change onchange parent_id behaviour
=========================================================

Purpose
-----------

When the manager (parent_id) of an employee changes, it doesn't always mean that other responsibles (Leave responsible, expense responsible, coach) should also change.

Specification
-----------------

When changing the employee's manager, the leave responsible, the expense responsible and the coach should be changed only if the field was not set or if the responsible is the previous manager. In that case, they should be set to the new manager. Otherwise, it means the field was most probably set manually and it should be left unchanged.

Task 1913089

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#30502
2019-02-14 19:09:34 +01:00
Lucas Lefèvre d77ce4c2a9 [IMP] hr_*: introduce the employee profile
General Purpose
===============

We want an 'Employee profile' gathering every data about an employee.
The main form view is modified to become this employee profile.
A user can also see his own profile through the Preferences menu.
The new profile replaces the current Preferences view if the hr module is installed
and the current user is linked to an employee.

A user should be able to see and edit his own profile.

*Problem*:
Many fields on hr.employee are protected by groups="hr.group_hr_user".
Therefore, a regular user cannot see or edit those fields.

This protection must be bypassed to allow read/write access
to the regular user's own data.
A similar mechanism already exists for res.users (for Preferences)

The better (least worst) solution found is to reuse this mechanism by adding related fields on res.users.

Pros:
- Don't change security access on hr.employee
- Don't implement yet another custom security layer, risking to add new security breaches
- A lot of fields are added by other modules on hr.employee.
  It would have required to integrate them with the custom security layer.
- Fields added by other modules on the user's preferences view (normal view, not the profile)
  are automatically included in the employee's profile view.
- Allow the hr.employee form view to be different than the user profile accessible
  through the Preferences menu.
  E.g. add custom buttons only relevant to the logged in user such as "Request a leave".
Cons:
- Each field from hr.employee that you want to appear on its profile
  must be added as a related field on res.users
- Those related fields must be added to user's preferences view (duplicate views)
- They also must be added to SELF_[READABLE | WRITABLE]_FIELDS

Note:
When the front-end loads the views it gets the list of available fields
for the user (according to its access rights). Later, when the front-end wants to
populate the view with data, it only asks to read those available fields.
However, in this case, we want the user to be able to read/write its own data,
even if they are protected by groups (groups are kept on the related fields on res.users).
The front-end need to be made  aware of those fields by sending all field definitions.

hr_attendance
=============

This commit integrate attendance in the new employee profile.
It also adds a stat button to this employee profile showing
the number of hours worked last month.

Remove the boolean computed field 'manual_attendance'.
This field is just a shortcut to add/remove the employee's user
in the "Manual Attendance" group.
The checkbox is confusing on the employee's form and this should
be done through the normal group management screens.

hr_presence
===========

Display the presence status on the employee kanban template.
The status is a colored chip which can be green (present),
orange (to define) or red (absent).

Currently, the presence status is only computed when accessing
the report view. As this commits displays it on the employee kanban,
it should be updated more frequently.
The state should not be updated every time the kanban view is loaded
since the computation is a bit heavy. Instead: add a cron to update
status every 15 minutes.
-> The status is accurate on the report view (status is still updated
   when loading the view)
-> The status in accurate at 15 minutes on the kanban view

[ADD] hr_attendance_presence
============================

Bridge module between hr_attendance and hr_presence.

This commit integrates hr_presence module in the employee
profile and adds the presence status on the employee kanban view.
But hr_attendance adds at the same place a similar status icon for
checkin/checkout.
This bridge module makes the status from hr_presence invisible as
hr_attendance should be the main presence control mechanism.

Also, this commit adds the ability (through a new setting option)
for hr_presence to take into account checkin/checkout to determine
the presence status.

l10n_be_hr_payroll
==================
integration with employee profile
2019-02-14 16:28:54 +01:00
Jorge Pinna Puissant e270e9e0cc [IMP] tools: float_utils, precision rounding must be positive
Adding a new rule to verify that precision_rounding is positive.

Before this commit:
when a precision_round was 0 or smaller than 0 the float_utils
functions gave as results:
* float_is_zero(0.0, precision_rounding=0.0) -> False
* float_round(1.25, precision_rounding=0.0) -> 0.0
* float_compare(1.0, 1.0, precision_rounding=0.0) -> 1

These results where at least not correct at worst not logic.

Now, the function raises an error when the precision_rounding
is not positive
2019-02-13 07:05:13 +00:00
Pratima Gupta ba5a2b47ac [IMP] base: Allow to sum fields on partner merge wizard
When merging 2 partners, we could want to sum fields instead of
keeping one of the values. Example: Loyalty Points

This commit adds the necessary support to achieve this.

This commit is related to task #1869488.

closes odoo/odoo#30141
2019-02-13 10:35:42 +00:00
Martin Geubelle 06de564074 [REF] web, *: remove JSONP support
JSONP can be entirely replaced by the CORS mechanism, which is simpler.
We support CORS in our routes since 8.0 (odoo/odoo@9cce88a), so it's about time
to get rid of JSONP.
2019-02-13 09:38:30 +00:00
Martin Geubelle 016f9612ba [REF] web: clean ajax and session 2019-02-13 09:38:30 +00:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
Odoo Translation Bot 56c39dd784 [I18N] Update translation terms from Transifex 2019-02-10 06:03:40 +01:00
Christophe Simonis 87924cb5ad [MERGE] forward port branch 12.0 up to a46138cb01 2019-02-07 13:14:02 +01:00
XavierDo b60224c41c [IMP] mail, base: add out of office status to user.
This status can be edited by user in preferences, indicates if user
is available or not.
2019-02-07 08:54:33 +00:00
RomainLibert 5fcf891e07 [IMP] various: optimize _name_search
In the overrides of _name_search we should avoid creating domains with
huge lists of ids as it is inefficient.
We can also make sure that we optimize the empty search as in this case
the custom domain doesn't make sense, we can simply search on an empty
domain and, thanks to the limit argument, still keep a fast query.

Linked to task 1918906

Thanks to @odony and @nseinlet

closes odoo/odoo#30155

closes odoo/odoo#30887
2019-02-06 13:26:33 +00:00
Christophe Simonis 530f364547 [MERGE] forward port branch saas-11.3 up to 0c42a607ec 2019-02-06 11:59:44 +01:00
Christophe Simonis 0c42a607ec [FIX] base: correct TestCursor test to explicitly close the cursor 2019-02-05 18:38:19 +01:00
Christophe Simonis 9c6acbaaa0 [MERGE] forward port branch 11.0 up to e0b14bf9a7 2019-02-05 17:53:35 +01:00
Christophe Simonis 8263547468 [MERGE] forward port branch saas-15 up to 66efbf2b5b 2019-02-05 15:22:04 +01:00
Christophe Simonis 66efbf2b5b [MERGE] forward port branch saas-14 up to 53ba83579b 2019-02-05 12:36:15 +01:00
Christophe Simonis 53ba83579b [MERGE] forward port branch 10.0 up to 8cb2965e23 2019-02-05 11:41:23 +01:00
Thanh Dodeur a86b726a27 [FIX] base: fixes http redirection
The 7d85ab1eac refactor of 'ir.http' introduced changes in `web/image` that
caused the route to no longer return early (to avoid data processing steps)
in the case of redirection and that caused `binary_content` to not set the
mimetype of the `ir.attachment` when it was an URL.

This commit fixes those issues, allowing `web/image` to redirect properly.

closes odoo/odoo#30777
2019-02-04 10:16:12 +00:00
Martin Trigaux c189a7c37e [FIX] base: correct case in Swedish language
Was with a lowercase S while it should be uppercase

closes odoo/odoo#30814
2019-02-04 13:34:28 +00:00
Raphael Collet 266f99f545 [FIX] tools: use of savepoints in TestCursor
closes odoo/odoo#30768
2019-02-01 14:09:38 +00:00
Juhil Somaiya 5c13831dc5 [IMP] sale, base: partner form view improvement
Improved partner form consistency and clarity via following changes:
- Renamed string and tooltip from Shipping address to Delivery address
- Changed description of the customer address
- Re-organised contact partner form and added image of partner
- Changed default avatar to a simpler one that is not Stephane Bern
- Test case improvement

Task ID: 192044

closes odoo/odoo#29917
2019-02-08 06:37:35 +00:00
Raphael Collet d27e689056 [IMP] fields: dummy updates of one2many fields should not trigger recomputations 2019-02-07 13:13:15 +00:00
XavierDo b8f2edd94c [FIX] core: remove email escape logic from html_sanitize.
Related to #30326

Before #30326, when calling html_sanitize, some content may be escaped
when it shouldn't. A simple example was images with cid links containing @.
(a first fix for another use case was made in 8aff53733b)

We suspect that this escaping (added in 71a92f46e4)
was made to avoid loosing email with format '<email@domaine>' in html_sanitize
to escape them if html_sanitize is called on plain text.

Anyway, only html should be passed to html_sanitize, and therefore email of format
<email@domain> should already be escaped.

PR #30326 fixes the unwanted behaviour in 12.0 and this commit removes
this logic in master.

closes odoo/odoo#30815
2019-02-07 08:53:45 +00:00
shreya thakrar c875d02572 [IMP] base: avoid empty language confusion
In User preferences, the empty language was confusing, rename it to 'System
(English)' instead of blank.
Rename English language as English (US).

Task ID : 1921583

closes odoo/odoo#30096
2019-02-07 10:08:59 +00:00
Jaykishan SolankiandRavi Gohil 7c6b8baf03 [IMP] account, point_of_sale,...: Improve usability
- Improve warning message when user tries to create credit note
- Hide 'Active' column in Taxes/Currencies and added default 'Active' filter in Taxes
- Removed 'save this page...' under 'Account Follow-up Levels','Budget Management',
  'Asset Management','Deferred Revenues Management' section in Accounting Settings
- Fixed margin between Cash Rounding checkbox and it's link in Accounting Settings
- Renamed action menu 'Confirm Payments' to 'Post Payments' for payments to make it
  consistent with it's form view
- Hide payment acquirers config for non-adviser users and also restric editing access
  rights for non advisior and employee user (only data read access rights on payment acquirers)
- Renamed Journal type from 'Sale' to 'Sales' and journals 'POS Sale Journal, Stock Journal,
  Cash Basis Tax Journal to Point of Sale Journal, Inventory Valuation Journal and Cash Basis
  Taxes Journal respectively
- Renamed the stat button 'Entries' to 'Items' for account assets form view
- Improved description and name of account_voucher module
- Improved Menu typo, Purchase Receipts to Purchases Receipts
- account_check_printing, hr_expense_check: made field storing check numbers character
  instead of integer, integer field for check numbers shows check numbers as amount
  (i.e., with thousand separator) on UI, which is wrong, hence replaced it with character
  type field and a constraint to allow only numbers to be stored in it.

TaskID: 40157

Co-authored-by: Ravi Gohil <rgo@odoo.com>

closes odoo/odoo#21982
2019-02-06 11:57:29 +00:00
Odoo Translation Bot 69dbbea09a [I18N] Update translation terms from Transifex 2019-02-03 01:38:30 +01:00
Nicolas Lempereur 3076d7e464 [FIX] base: partner search no alnum->no VAT match
When we search a partner, there is a system that show partner who match
exactly the searched term with non-alphanumeric character removed.

But since a6e1eb9f0a there is an issue that wrong partner match if:

- they have an empty string as VAT in the database (odd but can happen)
- if the searched term only contains non-alphanumberic characters

eg. i search 'é' -> all partner with empty string vat are found since
    the empty search '' matches empty VAT ''

With this changeset, if there is no alphanumeric character we will check
depending on the operator `vat=NULL`, `vat like NULL`, `vat ilike NULL`
that all will not match any result (and in the query plan does not take
time).

opw-1929563
closes #30732
2019-02-01 08:06:16 +00:00
Odoo Translation Bot 8d9b196145 [I18N] Update translation terms from Transifex 2019-02-01 02:44:47 +01:00
Odoo Translation Bot 5d91a7e237 [I18N] Update translation terms from Transifex 2019-02-03 03:02:46 +01:00
Christophe Simonis 49cb3d8fad [MERGE] forward port branch saas-11.3 up to aeed32d4ff 2019-01-31 15:07:09 +01:00
Christophe Simonis aeed32d4ff [MERGE] forward port branch 11.0 up to 1dbe4ea0d7 2019-01-30 17:10:34 +01:00
Odoo Translation Bot 9f6c2ec11c [I18N] Update translation terms from Transifex 2019-02-03 06:03:42 +01:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
Olivier Dony 483b6024cd [FIX] base: restore auto report layout selection
As of 12.0 the superuser account (UID 1) is only meant to be used for
advanced debugging, and non-superuser admin accounts are used for
day-to-day administration.

Adapts the admin detection system to allow non-superuser admins to
select the report layout as well.
2019-01-30 22:31:51 +01:00
Denis Ledoux d11a2000c4 Revert "[FIX] base ir.actions.report order pdfs when attachment_use option selected"
This reverts commit 529069996c, reversing
changes made to 76e085cbb7.

PR #30690 is a cleaner solution to the problem
than PR #30402.

closes odoo/odoo#30696
2019-01-30 14:00:49 +00:00
qdp-odoo 0237654113 [REF] base, account: removed useless @api.depends on name_get() 2019-01-30 09:16:26 +00:00
wan 7e9009f93a [IMP] base: choice of state/country easier in banks and partners
OPW 1891131
closes #27497

When creating a new bank account/partner address, the view displays the 'state 'field before the 'country_id'  field, which naturally leads users to select the state before selecting the country.
But there was problem: in order to select a state, one had to first select a country, which was confusing.

Done:
  - allow the user to select the state before the country (without restriction on country)
  - remove the state from the form when the country changes, if the state (name) is not in the country
  - automatically set the country when the state is set
  - always display the country code in the name_get of res.country.state, to deal with the case where different countries have a state with the same name
2019-01-30 08:55:32 +00:00
Xavier Morel 51819dcf17 [IMP] access errors through related fields
When an access error bubbles through a related field (aka the user
doesn't have access to the delegate or the delegate's field), append
the "intermediate step" so that it's easier to understand e.g. that
the access error to a partner really comes from accessing a user or
somesuch.
2019-02-06 11:29:29 +00:00
Xavier Morel 0f167634be [IMP] access error messages on fields with groups 2019-02-06 11:29:29 +00:00
Xavier Morel 6461a0f58c [FIX] core, base: rules detail on access error
In debug mode, if an access fails due to access rules, try to provide
a clearer error message & include a list of the rules which fail for
the record-set.

Note: for read() operations it'll be a bit misleading as failed
records will get a list of all the rules failing for the recordset,
only some of which might apply to that specific record.
2019-02-06 11:29:29 +00:00
Xavier Morel 860c842313 [IMP] base: error message on ACL failure, test 2019-02-06 11:29:29 +00:00
XavierDo e2180e5a2e [FIX] fields: setting an integer field invalidates its inverse one2many
In particular, creating a `mail.message` automatically invalidates the
corresponding `record.message_ids`.

closes odoo/odoo#30737
2019-02-06 10:18:24 +00:00