Commit Graph
124227 Commits
Author SHA1 Message Date
qsm-odoo 62b89ea467 [FIX] website: allow different compatibility grays
Commit https://github.com/odoo/odoo/commit/4f9a0cb4fcdfa9fee66c042593f4d411dd0e192f
introduced a way for users to enable a compatibility template to provide
support for some old BS3 classes.

Some of these classes are the bg-gray-* classes. The problem is that
enabling the compatibility file forces them to the new BS4 gray values
while the user may have done a custo to generate them automatically
from other gray values. This commit allows to keep the compatibility
file enabled, without overriding compatibility grays the user may have
provided on its own.

closes odoo/odoo#34134

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-06-14 09:51:05 +00:00
Christophe Monniez 989590e9b1 [FIX] packaging: add missing odoo-mailgate.py
This script is missing in the different Odoo packages.

opw-2008670

closes odoo/odoo#34130

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-06-14 09:32:38 +00:00
Nicolas Martinelli b044a6be8d [FIX] sale: no company
- Activate multi-company
- In a SO, remove the company (the field is not mandatory)

The currency rate computation crashes.

The computation expects a company in order to compute the rate.

If there is no company set, we set the rate to 1.0. It is worth
stressing that if both multi-company and multi-currency are activated, a
company is necessary for reporting consistency.

Fixes #34066
opw-2009044

closes odoo/odoo#34120

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-14 08:33:04 +00:00
Nicolas Martinelli 4870251f0b [FIX] payment: save credit card
- Set a payment provider with:
'Save Cards': 'Always'
'Payment Flow': 'Redirection to the acquirer website'
- Process an order on the eCommerce

The payment token is not saved.

The `save_token` value is based on the checkbox which is only added in
'ask' mode:

https://github.com/odoo/odoo/blob/4b8f72eb2315e675ca6d5a0d0961272fc024c475/addons/payment/static/src/js/payment_form.js#L162

We hide and pre-check the checkbox in this case.

opw-2008441
opw-2008275

closes odoo/odoo#34106

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-13 13:52:03 +00:00
Nicolas Martinelli 5af6928107 [FIX] google_spreadsheet: boolean
It seems that Google Spreadsheet only recognizes `true` and `false` as
valid boolean values.

opw-2000623

closes odoo/odoo#34100

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-13 12:10:20 +00:00
Christophe Simonis a526ff3f70 [FIX] mail: use correct variable
Oversight of previous forward-port.
2019-06-13 18:20:47 +02:00
Christophe Simonis a0a11fd5e2 [MERGE] forward port branch saas-11.3 up to 8a19a6a2a3 2019-06-13 18:18:17 +02:00
Christophe Simonis 8a19a6a2a3 [MERGE] forward port branch 11.0 up to ec8c66991d 2019-06-13 16:52:40 +02:00
Christophe Simonis ec8c66991d [MERGE] forward port branch saas-15 up to 641ca4f7f4 2019-06-13 16:22:23 +02:00
Christophe Simonis 641ca4f7f4 [MERGE] forward port branch saas-14 up to 6a247212f8 2019-06-13 15:32:55 +02:00
Christophe Simonis 6a247212f8 [MERGE] forward port branch 10.0 up to 818d34630d 2019-06-13 15:25:43 +02:00
Julien Castiaux dad9265d69 [FIX] project: correct filename on portal attachment
Create a project visible to a portal customer, create a task and attach
an attachment. As a portal user, go to the task and download the
attachment, the downloaded filename is the numeric identifier of the
document instead of the document filename.

The `?download=true` force the download of the attachment and correctly
set the filename.

opw-2008517

closes odoo/odoo#34098

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2019-06-13 13:22:22 +00:00
Nans Lefebvre ea064c81c9 [FIX] website: fix access error at settings save
Let a database with company C1, C2,
and a website W belonging to C1, used for both companies.
Settings in C2 cannot be saved without setting a website.
At settings load W is removed from C2 because it belongs to C1.
So reset C2's website to W.
This triggers a (useless) write of company_id (C1.id) on W.
Then we have w.user_id.company_id.id != self.env.user.company_id.id, (C1 != C2).
So if contacts are not shared, then accessing w.user_id.company_id would cause
an access error because of record rules, preventing the save.
As a result, settings are unusable for company C2.

opw 2008887

closes odoo/odoo#34102

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-06-13 12:41:15 +00:00
Nicolas Vannieuwerburgh 818d34630d [IMP] stock: noupdate on stock location
Stock.locations should be in no-update:
Limit the impact of recompute fields during the upgrade of stock module. (especially method _compute_product_availability)
Limit the impact on migration

Method _compute_product_availability is triggered during an upgrade of module and during migrations.
This may take a lot of time of big databases

closes odoo/odoo#34074

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-13 07:09:42 +00:00
Christophe Simonis efc64edf70 [MERGE] forward port branch 11.0 up to 242e485b4a 2019-06-12 19:18:42 +02:00
Julien Castiaux 306abd0131 [FIX] mail: send same attachment multiple times
In the Discuss app, using Chrome or IE11, try to send the same
attachment to different channels. The first attachment is correctly
detected but not the next ones.

The problem is due to a browser inconsistency, on firefox selecting the
same file in an `<input type=file>` triggers the `change` event. This is
not the case on Chrome/IE, selecting the same file doesn't triggers an
`onchange`.

opw-2006647

closes odoo/odoo#34076

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-06-12 14:36:03 +00:00
Denis Ledoux 242e485b4a [FIX] http: Unreachable server when db_maxconn reached during registry loading
On `WebRequest` `__exit__`, when an exception occured,
(in `self.registry.signal_changes` or `self.registry.reset_changes`)
cursor were left unclosed as `self._cr.close` was not called
in such cases.

Having exceptions in the above mentioned method do not happen
often, but when it does it left unclosed and unusable cursors
in the connection pool, and in the extreme case explained below,
it left the connection pool with only unclosed and unusable cursors.
The entire server was then unusable as it no longer had working cursors.

Case:
- Start a multi-thread server with db_maxconn set to 5
- Ensure you do not send any request to the server,
not even with a left open tab on `http://localhost:8069` in your browser
- Send 6 parallel HTTP requests to `/web/login`
thanks to an external thread python script
(See below, at the end of this long commit message)

According to your registry state (if you have a lot of modules installed or not),
and the native Python Garbage Collecting state,
you might end with
- either warnings telling some unclosed cursor were garbage collected,
and therefore closed (by a kind of luck thanks to the Python garbage collecting),
- either, a server completely blocked not accepting any other request
(you can try for instance `curl http://localhost:8069`
and you end up with a `500 Internal Server Error`

This observed issue looks to appear only in 11.0. Not 10.0 or 12.0.
This is because only 11.0 clear the cache during registry loading:
`https://github.com/odoo/odoo/blob/f1706c848d41c47646dabca771996e9b9f788241/odoo/modules/loading.py#L236`
This cache clearing doesn't happen in 10.0 nor 12.0
(in 12.0, thanks to e181f592f3)

When sending the 6 parallel requests,
it uses instantly all the 5 available cursors of the connection pool to handle these requests,
and when each request exits, in `__exit__`, it calls `self.registry.signal_changes()`
which tries to open a new cursor because of
- `self.cache_invalidated` which is True, for all the 6 requests, thanks to the call to `clear_caches`
explained above during the registry loading and the fact all requests have been treated in parallel,
- `with closing(self.cursor()) as cr:`, `self.cursor()` attempting to use a new cursor
(the `closing(...)` does not have any incidence on this issue, despite it could look like guilty)

The attempt to use a new cursor fails, as there is no more available (`db_maxconn` is reached),
raising a `PoolError('The Connection Pool Is Full')` exception.

In the request `__exit__` method, because of this exception raised when calling `signal_changes`,
`self._cr.close` is never reached, and the parallel request therefore left only unclosed
cursors in the connection pool,
therefore leaving the server in a state where it only has unusable cursors
and therefore can't do anything more.

This might look like really bad luck to land in such a state,
but we observed multiple actual case on Odoo.sh,
the one referenced in this commit (opw-2008340) was because of an Outlook client
which launched 18 parallel requests to fetch the email images,
and the server wasn't spawned, therefore neither was the registry.
The server registry was therefore just loaded when it received the 18 parallel requests,
and it therefore triggered this extreme use case.
The server was left unusable for several minutes, until a forced restart.

For reference, here is the script that has been used to trigger the 6 parallel requests:
```
import requests
import threading

threads = []
for i in range(6):
threads.append(threading.Thread(target=lambda: requests.get('http://localhost:8069/web/login')))
for thread in threads:
thread.start()

```

opw-2008340

closes odoo/odoo#34071

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-06-12 13:10:45 +00:00
Christophe Simonis 92ef6daa19 [MERGE] forward port branch saas-15 up to e14fd457b9 2019-06-12 15:46:40 +02:00
Christophe Simonis e14fd457b9 [MERGE] forward port branch saas-14 up to 348f3d8bbc 2019-06-12 14:35:44 +02:00
Christophe Simonis 348f3d8bbc [MERGE] forward port branch 10.0 up to 271f1ec688 2019-06-12 14:35:04 +02:00
Nicolas Martinelli b5dddce5b9 [FIX] stock: incorrect field
The field is now `quantity`. This wasn't spotted before because the
method is not used anywhere.

opw-2008491

closes odoo/odoo#34067

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-12 11:50:44 +00:00
Pierre Rousseau 4c7f236fb5 [FIX] snailmail: re-render report when using snailmail
If the option 'Reload from attachment' is checked for a report, it will be generated from the existing attachments.
However, for snailmail, we have to force the re-rendering to apply specific css rules to match the layout of a A4 letter.

Task-ID: 2008896

closes odoo/odoo#34053

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2019-06-12 11:31:26 +00:00
Sébastien Theys bb9c3910bb [FIX] website_sale: fix modal price when Select Quantity is disabled
To reproduce:

- Go on the website page of a product with optional products.
- Disable the Select Quantity customize show.
- Click add to cart.

This will open the optional product modal, where the quantity will be displayed.

However changing that quantity will have no effect, especially the price will
not update accordingly.

The real issue is that the quantity should not be displayed there if Select
Quantity is disabled, but this has never worked before, so this is outside the
scope of this fix.

Anyway, since the quantity is present there, we would at least expect it to
correctly recompute the price, which worked fine when the modal was introduced,
but has been broken since 51e51055bf

opw-2005317

closes odoo/odoo#33992

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-13 11:35:58 +00:00
Nicolas Martinelli 4b8f72eb23 [FIX] hr_payroll_account: analytic account
- Set an analytic account on an employee contract
- Set credit and debit accounts on the salary rules
- Create a payslip, confirm

The journal items created do not use the analytic account set on the
contract.

If no analytic account is set on the salary rule, we fall back on the
contract account.

opw-2006090

closes odoo/odoo#34095

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-13 11:14:39 +00:00
Xavier-Do 271f1ec688 [FIX] test_new_api: move demo_data.xml in demo category
Installing test_new_api without demo will fail since demo_user
does not exists. This is a problem if we want to test migration
with all modules installed. This simple fix solve the problem.

closes odoo/odoo#34065

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-06-12 10:51:32 +00:00
Nans Lefebvre f1706c848d [FIX] stock: put stored related field product_code in compute_sudo
Have a multi-company setup, with shared products.
Write the default code of a product; an access error is raised on inventory.line

On inventory.line, the field product_code is defined as related to
'product_id.default_code', and stored.
So when writing on the default_code of a product, we get the inventory lines of
other companies. For obvious reasons their access is protected by the record
rule "Inventory Line multi-company", therefore the access error is raised.

To avoid that situation stored related fields should be in compute_sudo.

Note that similarly this is necessary for product_name.
There is one more subtlety: directly writing on the product.product does trigger
the access error, but writing it on the product.template does not.

opw 2007167

closes odoo/odoo#34019

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-06-12 07:58:15 +00:00
Christophe Simonis 6dd58871e1 Revert "[FIX] sale: recompute delivered qty"
This commit shouldn't have been land in saas~11.3
See https://git.io/fjg2o

This reverts commit a25f6e1b96.
2019-06-11 13:43:32 +02:00
Christophe Simonis 7bd3f9379d [MERGE] forward port branch 11.0 up to a25f6e1b96 2019-06-11 10:51:40 +02:00
Nicolas Martinelli a25f6e1b96 [FIX] sale: recompute delivered qty
- Create a product A of type "Service", Invoice based on "Milestones",
Service Tracking "Create a task in a new project".
- Create a new SO with A, confirm.
- Go the to task associated to the SO, go to "Timesheets" tab, add an
entry
- In the SO, edit the delivered quantity
- Create invoice, validate

Back to the SO, delivered quantity is reset to 0.

We make sure to filter out SO lines which have a delivered quantity set
manually.

Introduced by d6ad22227c.

opw-1982020

closes odoo/odoo#33991

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-07 14:20:35 +00:00
Odoo Translation Bot 34ae29e68b [I18N] Update translation terms from Transifex 2019-06-09 03:07:58 +02:00
Christophe Simonis a2582c4252 [MERGE] forward port branch 11.0 up to bdc62d8031 2019-06-07 13:00:07 +02:00
Christophe Simonis bdc62d8031 [FIX] test_lint: move custom pylint checkers to new module
Oversight of previous forward-port.
2019-06-07 12:08:29 +02:00
Christophe Simonis 9bf4766f3d [MERGE] forward port branch saas-15 up to 6c6e652673 2019-06-07 11:38:48 +02:00
Christophe Simonis 6c6e652673 [MERGE] forward port branch saas-14 up to 757846c591 2019-06-07 11:09:29 +02:00
Christophe Simonis 757846c591 [MERGE] forward port branch 10.0 up to 7746621b92 2019-06-07 11:08:13 +02:00
Rishabh Jadia 7746621b92 [FIX] base: prevent renaming the column for non stored field
Before this task, when creating the related field from the studio, it is by
default stored. When we change the field name in 'ir.model.fields' using ORM's
write method, it also renames the column in the table associated with the
field's model.

This is the expected behavior. But when someone tries to change the 'name' of a
non stored field, the column is not available in the associated model, and so
trying to rename the column results into traceback. This issue was probably
there for a while but came into light with the task 1985710. More info can
be found on the chatter of the task.

This commit fixes the issue by adding an extra check before renaming the table
column. The query will be executed only when the field is stored and thus
exists in the table.

closes odoo/odoo#33944

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-06-06 11:47:19 +00:00
Nicolas Martinelli f7b870ca1b [IMP] account: constraint error message
Make SQL constraints errors more accurate.

closes odoo/odoo#33934

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-06 08:34:00 +00:00
Barad Mahendra ef7ae9ae14 [FIX] base: avoid traceback on params field of client action
The content of these fields can't be updated, there's no reason to
even show them. Just remove them from the default / auto-generated
view for client actions.

Task 1772242

closes odoo/odoo#29179

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-06 10:10:12 +00:00
Nathan de Pryck f435c65517 [FIX]account_asset: Increase performance to generate asset entries
For each asset depreciation lines we verify that there are not linked
to a move. This verification was done for each line separately.
Moreover, during the creation of the journal entries, we were writing
on the 'line_ids'. In this case, accessing the move of a line
was invalidating the cache. This fix ensure that this operation is
done out of the loop and the cache is then not invalidated at each
step.

See opw-2000305

closes odoo/odoo#33908

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-05 12:47:02 +00:00
Michele Zaccheddu 6a6471d727 [CLA] signature for MicheleZak
closes odoo/odoo#33880

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-06-05 06:45:00 +00:00
Christophe Monniez 7cc13e91b6 [FIX] test_lint, test_pylint: reintroduce an empty test_pylint module
Since test_pylint was moved into the test_lint module in commit
b27077bb, this could break Odoo instances where a module has test_pylint in its dependency.

With this commit, the test_pylint module is coming back as an empty
module.

closes odoo/odoo#33871

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-06-04 12:24:29 +00:00
luisiniguezh e88edfc5c5 [CLA] signature for luisiniguezh
closes odoo/odoo#33851

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-06-04 13:13:03 +00:00
Julien Mougenot d7d7d92e92 [FIX] web: binary fields correctly resets
When uploading a file to a binary file, then clicking on the
"clear" button, then reuploading the same file...

Before this commit:

The actual input of the field was only changed on user input.
This means that the "clear" action didn't reset the actual value
of the input, and the browser's default behaviour when getting
the same path twice is not to change anything. In the use case,
you couldn't upload the same file until you uploaded another one.

After this commit:

The "clear" action now also clears the value, allowing reuploading
the same file over again.

closes odoo/odoo#33843

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-03 15:01:57 +00:00
Atul Patel 6028d91a26 [FIX] stock: clean m2m records for warehouses on routes.
when we select places warehouses where route can be applied, then unselect that warehouses, warehouses values on m2m tag are not deleted.
because of wrong value empty list on onchange. so remove all records of warehouses if warehouse option was not selected.

closes odoo/odoo#33883

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-04 16:55:13 +00:00
Romain Derie 9efc11c8da [FIX] website: redirect user
Before this commit, user would be redirect to / instead of /my after signup.
That error was detected with task-1829827 which has a tour ensuring user is
correctly redirected to /my after signup on the checkout summary after payment.

Since 0229ef4c4a, the `web_login()` super call order has been changed when
called from the `/web/signup` route.
See the commit for more details but basically, before the fix, it went only
through:
1. web.web_login
2. portal._login_redirect

Where now, it goes through:
1. website.web_login
2. auth_signup.web_login
3. web.web_login
4.portal._login_redirect

Thus, portal._login_redirect is not returning `/my` as redirect anymore.
Indeed, website.web_login will ignore its super() and force redirect to `/`

With this commit, website's user are redirected to /my as expected.
Side effect: website's user will also be redirected to /my on login instead of
`/`, which is also prefered.

closes odoo/odoo#33865

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-04 09:38:44 +00:00
Nicolas Lempereur 7c900568c5 [FIX] web_editor: modal open>save document keep it
When we add a document with the "Select a Media" modal, if we reopen the
modal then click on "Save" without modfiying anything, the element is
broken since we do not have the data saying it is a document and the
code try to display it as image.

With this changeset, we keep the information that the attachment is a
document and when saving it works as expected.

opw-2004064
closes #33844

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-06-03 13:54:45 +00:00
Nans Lefebvre ff4f3922a9 [FIX] purchase: fix reference update at onchange
Add two PO with references 'XY' and 'Z' to a vendor bill.
The reference is computed as 'XY, Z' (with ', ' as separator).
Add a PO with reference 'X', the reference becomes 'X' instead of 'XY, Z, X'.

There are two variables that may not be defined (vendor_ref and self.reference),
and specifically the case where a reference is the prefix of another one is not
correctly dealt with.

opw 2005825

closes odoo/odoo#33841

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-06-03 13:30:42 +00:00
Nicolas Martinelli 25155aa472 [FIX] payment_adyen: empty field
- Activate Adyen
- In the eCommerce, purchase an item
- Change the delivery address
- Pay with Adyen

A internal error is raised.

It is caused by `val.replace(...)` where `val` is `False` ( due to
`shopperEmail`).

We make the code more robust by fallbacking on the billing email, then
on an empty string.

opw-2002974

[1] https://docs.adyen.com/classic-integration/hosted-payment-pages/hpp-payment-response/payment-response-merchantsig-sha-256/

closes odoo/odoo#33840

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-03 13:23:15 +00:00
Rim BEN DHAOU 58d414ec1c [FIX] calendar: fix required conditions for subfields of recurrent events
For recurrent events, many fields are set to define the recurrency;
these fields are invisible unless (recurrency', '=', True).
However there are fields that depend on fields to define the recurrency,
which are required in some cases.
However in case where recurrency is later set to False, no onchange cleans up
the intermediary values (this is taken care of in the create),
but the 'required' on the non-relevant fields might prevent from saving.

We fix these cases by adding the recurrency in the list of requirements.

opw 2002181

closes odoo/odoo#32698

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-06-03 11:15:08 +00:00
Nicolas Martinelli dea93a683b [FIX] purchase: orderpoint on existing PO
- Create product A:
Reordering rule of 5 units
Set a vendor V
- Create a SO with 1 unit of A
- Create a PO with 1 unit of A for vendor V
- Run the scheduler => the PO contains 6 units
- Run the scheduler => the PO contains 12 units

The PO should not be updated the second time the scheduler is run.

It occurs because the `orderpoint_id` is not set on the PO line, while
the `_quantity_in_progress` method searches for PO lines with the
orderpoint set.

opw-2000962

closes odoo/odoo#33798

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-05-31 13:19:15 +00:00