Commit Graph
117975 Commits
Author SHA1 Message Date
Yannick Tivisse 2b8bd4d9c1 [MERGE] fleet: Improve views + introduce some new features
Purpose
=======

Move some internal development into the standard solution.

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

- Add a default value for 'acquisition_date'
- Make the license plate not required
- Display all the stages on the fleet.vehicle kanban view
- Remove the unicity constraint on the driver
- Order cars by plate, then by acquisition date
- Add an informative 'First Contract Date' field
- Add 'Next Activities' on vehicles
- Create a related contract when creating a new car
- Archive related contracts when archiving a vehicle
- Allow to search vehicles based on the driver name
- Set default values on model onchange
- Add subtype to track driver modifications
- Introduce fleet.vehicle.assignation.log model
- Add track_visibility='onchange' on some fields
- Rename purchaser_id from 'Contractor' to 'Driver'
- Modify slightly some fleet views

TASK ID: 1839868
2018-04-27 17:31:34 +02:00
Yannick Tivisse 8777236fd7 [IMP] fleet: Modify slightly some fleet views
1/ Remove 'odometer' from vehicle tree view
2/ Replace 'Activation Cost' by 'Driver' on contracts tree view
3/ Add fields to search on in contract search view
4/ Hide 'Renew Contract' button if in open state
5/ Move models menuitem from 'Configuration' to 'Vehicles'
2018-04-27 17:30:30 +02:00
Yannick Tivisse 66db893fa9 [IMP] fleet: Rename purchaser_id from 'Contractor' to 'Driver' 2018-04-27 17:30:30 +02:00
Yannick Tivisse 77171d482c [IMP] fleet: Add track_visibility='onchange' on some fields
1/ Use track_visibility instead of overriding write method on a fleet.vehicle

Instead of posting messages in the write method to notify that the record value
changes, use the attribute track_visibility='onchange' instead.

2/ Add track_visibility='onchange' on some fields

3/ Track visibility on 'recurring_cost_amount_depreciated'
2018-04-27 17:30:30 +02:00
Yannick Tivisse 02775e6cd2 [IMP] fleet: Introduce fleet.vehicle.assignation.log model
Purpose
=======

Currently it's impossible to know who was driving a given car at a given time.

We have some piece of information like the immatriculation date of a vehicle
or the date of the first contract. But it's not enough.

This is problematic to solve a rather common issue:
- Who is gonna pay the fine for having exceeded the speed limit?

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

Introduce a simple model fleet.vehicle.assignation.log, containing info about:
- The driver
- The vehicle
- The start Date
- The end Date

A simple button on the fleet vehicle should be sufficient to solve the issue.

We cannot generate data from the salary package as these dates can't be predicted
at the contract signature.
2018-04-27 17:30:30 +02:00
Yannick Tivisse ef8befeef4 [IMP] fleet: Add subtype to track driver modifications 2018-04-27 17:30:30 +02:00
Yannick Tivisse 52fdeacfe1 [IMP] l10n_be_hr_payroll_fleet: Set default values on model onchange 2018-04-27 17:30:30 +02:00
Yannick Tivisse 50dfff2462 [IMP] fleet: Allow to search vehicles based on the driver name 2018-04-27 17:30:30 +02:00
Yannick Tivisse 2958bcc383 [IMP] fleet: Archive related contracts when archiving a vehicle 2018-04-27 17:30:30 +02:00
Yannick Tivisse 879f2ba9c7 [IMP] l10n_be_hr_payroll_fleet: Create a related contract when creating a new vehicle
Create a new contract with a recurring cost amount depreciated equal to
the amount defined on the model.
2018-04-27 17:30:30 +02:00
Yannick Tivisse 7356c3b5b6 [IMP] fleet: Add 'Next Activities' on vehicles
This commit adds:
- The button on the chatter
- The button on the kanban card and a progress bar on top of the stage
2018-04-27 17:30:30 +02:00
Yannick Tivisse 3fc4c3b966 [IMP] fleet: Add an informative 'First Contract Date' field
The goal of this field is to be able to keep the value of the first contract
even if it has been closed/deteled.

It could be used to compute the depreciation of the car.
2018-04-27 17:30:30 +02:00
Yannick Tivisse 13bd8e7db6 [IMP] fleet: Order cars by plate, then by acquisition date
This commit allow users to see in the kanban/list view the oldest cars with no plates
2018-04-27 17:30:30 +02:00
Yannick Tivisse 47857a63ac [IMP] fleet: Remove the unicity constraint on the driver
It should be possible to assign 2 vehicles to the same person.

The constraint is too restrictive.
2018-04-27 17:30:29 +02:00
Yannick Tivisse 2bc85571a9 [IMP] fleet: Display all the stages on the fleet.vehicle kanban view
All the stage should be displayed to allow a user to move a car in another stage
even if no other cars are into it.
2018-04-27 17:30:29 +02:00
Yannick Tivisse b510e7f41b [IMP] fleet: Make the license plate not required
It's not mandatory for a car in the fleet to have a license plate.

It should be possible to create the car before the immatriculation date.
2018-04-27 17:30:29 +02:00
Yannick Tivisse 647292a963 [IMP] fleet: Add a default value for 'acquisition_date' 2018-04-27 17:30:29 +02:00
Florent de Labarre 99d287e43f [FIX] sale_stock: show complete name of product
In case of changing the quantity on hand of two variants of the same product,
the two message created will have the same name (the name of the
product.template).
Show the name of variant instead.
2018-04-27 17:16:10 +02:00
Cédric Snauwaert d3d2612061 [IMP] account: Speed up of some processes
* Reconciliation
    Change the way the reconciliation method was written to optimize performances.
    Remove the "skip_full_reconcile_check" stuff that is more confusing than helping.
* Object creation
    Remove the creation of tax_line from tax_ids in the account_move_line create method.
    Remove a bunch of context that were invalidating the cache way too often

Was PR #21498
Was task 37976
2018-04-27 17:16:03 +02:00
Martin Trigaux 6ef1269abe [FIX] account,sale,purchase: reflect the changes to pot
Commits like 622b70ee3e or 9d25cc3429 do break the translations
2018-04-27 17:05:28 +02:00
Nicolas Lempereur 416d07f0bb [FIX] account_check_printing: multi payment has amount in words
In the wizard for payment several invoices with one payment, there was a
error when making the previous fix: 29c6c06de7.

The patch still worked because of a particularity of readonly and
related on account.payment but the check_amount_in_words would possibly
not be set when it should have.

opw-1839720
closes #24476
2018-04-27 15:11:24 +02:00
Toufik Benjaa ceeba05d70 [FIX] website_quote: Do not raise exception when quotation viewed
- When a quotation if viewed by a customer, a note is posted in the quotation's chatter saying "Quotation viewed by customer".
  This is causes issues if the quotation is accessed without the access token and by a partner that do not have the rights to write on the model "sale.order".

  To address this issue we provide to the "_message_post_helper" function the sale order's access token to bypass the accesses checks.

  OPW-1839183
2018-04-27 14:15:46 +02:00
Hiral Bhavsar 42b7d7489a [IMP] account: some minor usability improvements
* when refunding an invoice/bill with the option 'modify', it now opens the draft document in form view (chatter reworked for more clarity)
* payments list views are now using filters instead of domain, so that user can easily find back any payments (also transfer that haven't their dedicated menuitem)
* when clicking on a ling to create a new payment from the dashboard, the form view is directly open instead of the list view

Was PR #23402. Was task 58392
2018-04-27 14:02:05 +02:00
Aaron Bohy 3628014abd [FIX] board: action executed with option keepSearchView
Rev. 69c9500e recently added option 'keepSearchView' to doAction in
the ActionManager. When set to true, the searchview of the current
action is re-used by the executed action.

This caused issues with the dashboard, as the wrong action id was
used to save the current action to the dashboard (it was the one
of the action for which the searchview was instantiated, not the
one of the current action, executed with option keepSearchView set
to true). For instance, go to Website (in enterprise), in the
new dashboard (view) expand the graph view, try to add the graph
action to the dashboard (board).

Task 1835670.
2018-04-27 13:40:35 +02:00
len-odoo 50f77ba091 [FIX] stock: allow inventory user to validate delivery orders when accouting entries have to be created
When validating a delivery order with automated inventory,
some accounting moves are created.
Since an inventory user might not have accounting rights,
the validation of delivery orders might fail.
We simply had a sudo when in the internal method creating the move.

Moreover if the inventory valuation is set in FIFO,
the product price might be updated.
It might fail for lack of additional rights.
We add a sudo for this price update.

opw 1836761
2018-04-27 13:09:30 +02:00
len-odoo 3acb4a5389 [FIX] stock: allow inventory user to validate delivery orders when moves have to be merged
When validating a delivery order, some stock moves might be merged by an
internal function, which thus might delete some stock moves.
Since an inventory user has no right to unlink stock moves,
the validation might fail.
We simply had a sudo when doing the unlink, since this is an external method.

opw 1836761
2018-04-27 13:08:05 +02:00
qsm-odoo ce6f8632cc [FIX] web_editor: update summernote copy-paste feature
The copy-paste feature of summernote was messy and led most of the time
to breaking the template you were trying to edit. While it is difficult
to solve as it mostly comes from the lib itself and that the lib is in
a complicated state as Odoo had to overridde part of its internal code
for its own purposes, this commit hopes to solve the problem by updating
only the copy-paste feature to the latest summernote version.

Of course, as summernote changed a lot meanwhile, it was not possible to
just take the up-to-date summernote file. This commit refactores the
up-to-date summernote clipboard code so that it fits the old summernote
version Odoo is using.

Note: the main problems occurred while using Windows/Mac and not Linux.

opw-1837818
2018-04-27 12:28:57 +02:00
Olivier Colson edc955d28d [FIX] base: currency: add missing dependance to compute function of 'rate' field 2018-04-27 10:47:52 +02:00
XavierDo d6a9a9bf4c [IMP] portal: clean portal task controller
Remove some code that was kept for retro-compatibility
while merging task 1827950 in 11.0 (stable)

Task #1838048
PR #24425
2018-04-27 10:11:06 +02:00
len-odoo 0050019390 [FIX] website_sale, website_quote: display payment acquirers per country
Commit 542201eed3 added the possibility to configure a set of countries for a
given payment acquirer.
Commit 194d52e8fd refactored the payment form, but forgot to take the country
into acount.

opw 1837819
2018-04-27 08:23:25 +02:00
Nicolas Martinelli 517fb99926 [FIX] mail: emoji substitution
- Create a message with 100k+ smileys
- Send it to a colleague you hate
- His (and your) web browser starts eating up all the memory
- Go cry to the technical guy because you can't use Odoo anymore.

On some browsers, like Chrome, the image rendering consumes a lot of
memory up to the point it makes it unusable.

opw-1831610
2018-04-27 08:08:36 +02:00
Nicolas Lempereur b6a1389b8c [FIX] web_editor: firefox remember CTRL+A selection
In firefox the range when doing CTRL+A is the first level content of the
contenteditable element, but this was not taken into account when
"remembering" the range after clicking on buttons or features of the
editor.

In chrome the selection begin with the first displayed element (so it
may not be a direct child of the editable and is taken into account in
the code).

opw-1824017
closes #24424
2018-04-26 17:06:05 +02:00
Nicolas Lempereur db86e1d9e4 [FIX] sql_db: log-level debug_sql log parameters
Since 1a58e108 (on 10.0 and over) parameters are no longer present when
logging sql queries.

This removes some of the usefulness of the feature, and this commit adds
them back.

Since mogrify returns a byte string in the database encoding, we decode
it using the corresponding python encoding.

opw-1839241
closes #24446
2018-04-26 16:54:32 +02:00
Thibault Delavallée 25c5c62623 [IMP] note: remove note counter in activities systray
Having a different behavior from other apps present in the systray about
activities is not understandable.

Done after feedback from saas-11.3 internal testing phase. This commit is
linked to task ID 1838917.
2018-04-26 16:44:36 +02:00
Thibault Delavallée e6d272244f [IMP] note: completely refactor the way people live, love, work and prosper
By using super column names. See task ID 1838917 if you don't understand
why those are so much wow.
2018-04-26 16:44:26 +02:00
Thibault Delavallée cf398b2095 [IMP] note: improve demo data as demo user now correctly have stages
Done after feedback from saas-11.3 internal testing phase. This commit is
linked to task ID 1838917.
2018-04-26 16:44:26 +02:00
Thibault Delavallée 1d7c12f9bf [FIX][IMP] note: create default note columns for existing users
Otherwise users that already exist when installing note module do not have
any default columns for note leading to an incoherent behavior, especially
with reminders.

Done after feedback from saas-11.3 internal testing phase. This commit is
linked to task ID 1838917.
2018-04-26 16:44:22 +02:00
Goffin Simon feba353c65 [FIX] purchase: Wrong Fiscal position in multicompany
Steps to reproduce:

 -Create company A
 -Create company B
 -Admin user with both companies but currently in company B
 -Create Demo user only with company B
 -Create fiscal position A to company A
 -Create fiscal position B to company B
 -Create vendor with fiscal position A with company A and the same vendor with fiscal position B in company B
 -Create product and add the vendor created before
 -Set like Create a draft purchase order
 -Logging with Demo user
 -Create sale order with one sale order line with route make to order
 -Validate sale order

Bug:

 The purchase order created by sale order had the fiscal position company A.

Backport of this commit: 5bb6517072
Closes #23561
opw:1825098
2018-04-26 16:29:34 +02:00
qsm-odoo b2ad88e38d [FIX] web: form buttons should always get a btn style class
Here is the story of the problem: back in 10.0, everything *seemed*
fine with button rendering except it was very messy duplicated codes.
The system was still not consistent:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-default btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-default btn-link
oe_link -> btn-default oe_link
btn-danger -> btn-default btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> no class
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> oe_link
btn-danger -> btn-danger
some_class -> some_class

So, outside the header, the system seemed to not process anything except
transforming the oe_highlight class. In the header, the btn-default was
always added, except if using the oe_highlight class. The style is fine
for those, except for .btn-default.btn-link and .btn-default.oe_link
where the link class has no effect (which is fine as header are not
supposed to contain links).

In 11.0, the new views were introduced alongside websitepocalypse. The
new system led to:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-default btn-primary
oe_highlight -> btn-default oe_highlight
btn-default -> btn-default
btn-link -> btn-default btn-link
oe_link -> btn-default oe_link
btn-danger -> btn-default btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> oe_highlight
btn-default -> btn-default
btn-link -> btn-link
oe_link -> oe_link
btn-danger -> btn-danger
some_class -> some_class

So, it worsened the header buttons by not processing the oe_highlight
class and adding the btn-default class in all cases. This is even
worse since in 11.0 .btn-default.btn-link do have a specific style and
thus not appear as .btn-default anymore. Those may be invisible "bugs"
though as .btn-link are not supposed to be in header and oe_highlight
is styled correctly in css. For buttons outside the header, a little
processing was added to add "btn-default" class for buttons which did
not specify a class (and oe_highlight is not processed anymore there
too).

In master, with the less2scss task, the system had to change again but
led this time to visible bugs:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

As you can see, the system is now the same for both header button and
normal buttons. The system is also better for all cases as it produce
only *one* *bootstrap* class for all cases. However, the problematic
case is the last one for header buttons: it did not receive the
btn-default class automatically. Even though this is the API for the
rest of odoo (dialogs, renderButton (old WidgetButton), ...), this is
a problem here as fixing this would require to add the 'btn-default'
class in every view which is using this case.

While waiting for a better solution, this commit is instead forcing
the btn-default class in that header case only (so only when a class
was mentioned but it did not contain any bootstrap btn type class).
So the new system gives:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

This commit also adds tests which will prevent the system to change
again without noticing it.

Closes https://github.com/odoo/odoo/pull/24443
2018-04-26 16:23:39 +02:00
qsm-odoo 9fb6d6eac3 [REF] web: make cleaner code for the renderButton helper
In particular, allow to create a button without a sizing class.
2018-04-26 16:23:16 +02:00
Yannick Tivisse 4fc9a5c186 [MERGE] various: Replace the reified user's groups view by computed fields
This commit has several purposes:
- Group public/portal/employees access rights into a single selection field
- Rename the 'Employee' access right into 'Internal User'
- Remove the groups reified view on the user form and replace it by real
  computed fields: Selection fields for the application groups, and
  Boolean fields for the isolated groups.

For more information about the specification please check the related commits

Task ID: 32258
2018-04-26 16:07:12 +02:00
Nicolas Martinelli bcd4c90a71 [FIX] web: get_file and CPU time exceeded
- Create a binary field which takes some time for computation. For
example:
```
ding_dong = fields.Binary(compute='_compute_ding_dong')

def _compute_ding_dong(self):
    if not self.env.context.get('bin_size'):
        while True:
            3*3
    for x in self:
        x.ding_dong = x.product_id.image_medium
```
- Run the server with a limited CPU time, for example:
  `--workers=2 --limit-time-cpu=10`
- Download the file

A JS traceback occurs, without any information about the real crash.

The error management is simply not working: `JSON.parse` is called on a
string which is not JSON-parseable.

opw-1838832
2018-04-26 15:14:47 +02:00
Goffin Simon 409970c188 [FIX] payment: Error to get the default country for a partner
When there was no company_id in the context and the company with id=1
didn't exist it generated an error.

opw:1838932
2018-04-26 15:14:26 +02:00
Yannick Tivisse 382fbd3520 [IMP] base: Remove unused module categories
The categories other extra rigths and hidden are not used now.
2018-04-26 15:13:38 +02:00
Yannick Tivisse bd49f9fd17 [IMP] base: Remove the reified view on 'groups_id' in res_users' form
Now all the group fields are defined on the res.users model. No need to
generate a reified view according to the groups definitions.
2018-04-26 15:13:38 +02:00
Yannick Tivisse 99f497b390 [IMP] *: Define groups on res.users models
The reified view on the res users will be dropped in the following commit.

The previous commit adds support to define each group as a computed field on the res users.

This commit defines:
- A boolean field for each 'isolated' res.group, i.e. a group in the hidden category.
- A selection field for each 'Application' res.group, i.e. a group in a application category.

Example:
- The group to manage pricelist in sales becomes a boolean field
- The groups project user/manager become a selection field
2018-04-26 15:13:38 +02:00
len-odoo ab179bb2d7 [IMP] base: Add compute/inverse methods to manage user groups
Purpose
=======

Allow to define users groups on a res.user with computed fields based on the 'groups_id' field.

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

Add compute/inverse methods to manage specific groups on a res.users.

These methods should be used on fields defined like one the following cases:

1. A boolean field with the compute/inverse method and an attribute group_xml_id.
Example:
    has_group_discount_per_so_line = fields.Boolean(
        "Discount on lines",
        compute='_compute_groups_id', inverse='_inverse_groups_id',
        group_xml_id='sale.group_discount_per_so_line')

2. A selection field with the compute/inverse method, the selection got from '_get_group_selection'
   and an attribute 'category_xml_id'
Example:
    group_sales_team_user = fields.Selection(
        selection=lambda self: self._get_group_selection('base.module_category_sales_management'),
        string="Sales", compute='_compute_groups_id', inverse='_inverse_groups_id',
        category_xml_id='base.module_category_sales_management')

The fields will be set according to the groups defined in the 'groups_id' field, and the 'groups_id'
field will be modified according to the modifications made on theses fields when saving the users's
form.
2018-04-26 15:13:38 +02:00
len-odoo e67b61811b [IMP] base: Rename "Employee" access right into "Internal User"
This doesn't mean that the user is an employee. It means that the user
can have access to internal resources on the company.
2018-04-26 15:13:38 +02:00
len-odoo 5478802843 [IMP] base: Regroup Public/Portal/Employee access rights under the same category
These groups should be exclusive. It makes no sense to have an employee who's also
a public user.
2018-04-26 15:13:38 +02:00
Nicolas Martinelli d88c3706df [FIX] product: name search not ilike
- Create a product named 'toto'
- Perform a call to `name_search`:
  `self.env['product.product'].name_search('pouet', [], 'not ilike')`

Product 'toto' doesn't show up in the result list.

The domain should take into account that `default_code` can be `False`.

Note: the bug also occurs if the product is called 'trululu'.

opw-1837957
2018-04-26 15:07:01 +02:00