Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0] update upstream a526ff3f70 #1886

Merged
merged 111 commits into from
Jun 13, 2019

Conversation

MiquelRForgeFlow
Copy link
Contributor

Merge remote-tracking branch 'odoo/12.0' into 12.0-update-upstream-a526ff3f70

Without conflicts

It was necessary to include odoo/odoo@87d2661.

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

ap-wtioit and others added 30 commits May 29, 2019 10:02
When opening the pdf at the end of an order Chrome tries to load
/favicon.ico which returns 404 before this patch. We provide the
favicon from the current website.

closes odoo/odoo#33746

Signed-off-by: Jérémy Kersten (jke) <[email protected]>
New account tags were added to use with the incoming of the northern border
zone of Mexico

These changes were announced in the new Annex 24 RFM 2019 [1] and define
the new accounts for the northern border zone. This change affects a
part of the CoA because these accounts are added in the middle instead
of at the end of the group.

[1] https://www.sat.gob.mx/cs/Satellite?blobcol=urldata&blobkey=id&blobtable=MungoBlobs&blobwhere=1461173688346&ssbinary=true

Closes #33631

closes odoo/odoo#33734

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
Add the country of origin of the various PDF invoice reports.

opw-2003463

closes odoo/odoo#33749

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
Before this commit, the payment memo was copied during the duplication
of a voucher. The issue is that the payment memo is not always shown in
the view, and it's mostly unique by voucher.

Now, the payment memo it's not copied anymore.

opw-1986544

closes odoo/odoo#33708

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
- Create an Analytic Distribution for:
Product A
Current user (e.g. Mitchell Admin)
- Sell the product in the POS, request an invoice

The analytic account defined is not used.

This is due to the invoice created as SUPERUSER.

We should first take into account the user on the invoice, then the
current user.

opw-2003935

closes odoo/odoo#33758

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
Make the contract type name translatable.

opw-2003957

closes odoo/odoo#33781

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
If the company is not set on the SO, the creation of a SO line crashes
because `currency` is empty.

opw-2005143

closes odoo/odoo#33783

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
- When validating a payment an "expected singleton" exception is
raised due to the fact that we are using a recordset with multiple
record instead of a recordset with a single record.

OPW-1981632

closes odoo/odoo#33767

Signed-off-by: Christophe Simonis <[email protected]>
- Create a MO for '[FURN_8855] Drawer'
- Consume 1 unit of '[FURN_2100] Drawer Black', but DO NOT consume
anything for '[FURN_5623] Drawer Case Black'.
- Complete the MO, then Unlock it
- Edit the '[FURN_5623] Drawer Case Black' line to add one unit
consumed, save

The new stock move line is created as canceled.

It is created canceled since the corresponding stock move is canceled.

We should not be able to add a stock move line on a canceled stock move.

opw-1986919

closes odoo/odoo#33794

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
When you open the image modal of the website editor the selected image
is the current image.

But if the image is not an attachment with an `url` field set (eg. it
has been uploaded and is not a file in a /static/ folder) the match
between image modal and current did not work and to close it we need to:

- actively select the current image then click "Save"
- use the X button to close the modal without saving

With this changeset, the match of current image with image list is done
on the attachment `url` and if unavailable with /web/image/ID/name.jpg
path which cover both possibilities.

opw-2004073
closes #33799

Signed-off-by: Nicolas Lempereur (nle) <[email protected]>
- Activate multi-company
- Create a company B
- Switch to company B
- Create an allocation request

An access error is raised.

Commit 7f775f0 added a `sudo` call in order to prevent an access
error. However, it implies that the fallback value `self.env.user`
refers to the SUPERUSER, not the current user anymore. If the current
user is not in the same company than the SUPERUSER, the multi-company
record rules will be triggered.

The fallback is changed to an empty recordset, and selecting the current
user is done out of the method called with `sudo`.

opw-2003137

closes odoo/odoo#33804

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
This commit adds a tour for the condition where the delivery charges,
even though that was not added to the total charges, it was shown in the
delivery charges aside (even if the payment was over the amount where free
delivery was available). This adds a test that it should be "0.0" instead.

This was tested before the fix and after the fix.
closes odoo/odoo#25646

Signed-off-by: Quentin De Paoli (qdp) <[email protected]>
Before this commit, when sending multiples invoices by email in batch,
if one of these invoices was for a customer without an email address,
these wasn't sent and the user didn't have any feedback about this.

Now, before the user send the emails a warning is shown with the list of
invoices that can't be sent by email.

opw-2002350

closes odoo/odoo#33753

Signed-off-by: Jorge Pinna Puissant (jpp) <[email protected]>
- 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) <[email protected]>
In a web editor, add some text, select the text, add a link and
immediately discard the link modal. Traceback.

The traceback is a execute `setEnd` on `Range`, that error is thrown
because editable DIV doesn't save old range

Odoo wrap code does some text node split in order to attach the link
just on the selected text. If it correctly re-set the underlying
structure, it does not update the $(editable) structure used to restore
ranges.

After this commit, editable div will use newly created range for the element

for ex:
-> content: test
-> selected content "test"

when click on link dialog:
ec: test , eo: 4, sc: test, so: 0
selected content  ->  start 0, end 4 -> "test" like this

after clicking on discard:
ec: null text element, eo: 4, sc: null text element, so: 0
selected content  ->  ec and sc both are null, so it will throw an error
while setting cursor position

after applying fix when click on discard:
ec: test, eo: 4, sc: test, so: 0
selected content -> start 0,  end 4 -> "test"

task - 1955863

closes odoo/odoo#33792

Signed-off-by: Nicolas Lempereur (nle) <[email protected]>
Because Odoo still supports Android Kitkat and Internet Explorer, ES5 is
the highest ECMAScript allowed version.

This commit adds a new test that parses each javascript file found in
addons. The test fails if unsupported js code is found.  As ES6 is
allowed during tests, the files under a path that contains 'static/test'
are just skipped.

This test uses the es-check tool
(https://www.npmjs.com/package/es-check).

If the es-check tool cannot be found, the test is simply skipped.

Also the test_pylint module is renamed to a more generic name test_lint,
that way, every linter test can find a shelter  here.

closes odoo/odoo#33724

Signed-off-by: Christophe Monniez (moc) <[email protected]>
…pute field

Before this commit:
- When you create a compute field, from the model view, dependence field
was not required when creating a compute field.
- When removing the compute code, the dependence field stays marked as
required.

fine-tuning : f01c195

opw-2003784

closes odoo/odoo#33760

Signed-off-by: Jorge Pinna Puissant (jpp) <[email protected]>
In a web editor, add some text, select the text, add a link and
immediately discard the link modal. Traceback.

The traceback is a execute `setEnd` on `Range`, that error is thrown
because editable DIV doesn't save old range

Odoo wrap code does some text node split in order to attach the link
just on the selected text. If it correctly re-set the underlying
structure, it does not update the $(editable) structure used to restore
ranges.

After this commit, editable div will use newly created range for the element

for ex:
-> content: test
-> selected content "test"

when click on link dialog:
ec: test , eo: 4, sc: test, so: 0
selected content  ->  start 0, end 4 -> "test" like this

after clicking on discard:
ec: null text element, eo: 4, sc: null text element, so: 0
selected content  ->  ec and sc both are null, so it will throw an error
while setting cursor position

after applying fix when click on discard:
ec: test, eo: 4, sc: test, so: 0
selected content -> start 0,  end 4 -> "test"

task - 1955863

closes odoo/odoo#33692

Signed-off-by: Nicolas Lempereur (nle) <[email protected]>
When the `purchase.order` is added as an embedded tree view on a model
without a `state` field, a crash occurs.

The existing condition doesn't make sense on a PO (while it would make
sense on a PO line), so we simply remove it. Since the condition implied
that the field `invoice_status` was always hidden, we keep it that way.

opw-2005768

closes odoo/odoo#33827

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
In the kanban views, cards have a fixed size (here it is overriden as 450px).
All internal elements use col-x Bootstrap classes, with have flex 0 0 x/12.
Note that 0 0 correspond to flex-grow and flex-shrink, so the sizes are fixed.
It follows that any long translation or number will overflow badly.
Hover this overflow is, in terms of usability, less worse hiding the overflow
or even  scrollbars.

So nothing is flexy, but too avoid this issue as much as possible,
we give more space to the right side, since the left side only shows a button.

opw 2001951

closes odoo/odoo#33818

Signed-off-by: Nans Lefebvre (len) <[email protected]>
…ents

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) <[email protected]>
- Create a MO for '[FURN_8855] Drawer'
- Consume 1 unit of '[FURN_2100] Drawer Black', but DO NOT consume
anything for '[FURN_5623] Drawer Case Black'.
- Complete the MO, then Unlock it
- Edit the '[FURN_5623] Drawer Case Black' line

It is not possible to add a line.

This is expected from 9e77ce2, but we still want to be able
to consume some quantity.

Instead of canceling the move lines without any quantity consumed, we
set it to done.

opw-1986919

closes odoo/odoo#33820

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
- 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) <[email protected]>
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) <[email protected]>
elmeriniemela and others added 26 commits June 12, 2019 10:24
Attribute called _sql_constrains is missing a 't'.

closes odoo/odoo#34033

Signed-off-by: Jérémy Kersten (jke) <[email protected]>
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) <[email protected]>
…y 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 e181f59)

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 <[email protected]>
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) <[email protected]>
…ully sent

When sending a message (e.g. in a CRM lead or SO),
a failure_type and failure_reason are displayed, even when the message
is successfully sent.

This is because these fields are not updated when the email_status
is changed to "sent". We reset these fields to '' when the message is sent.

OPW-2003290

closes odoo/odoo#34082

Signed-off-by: Nans Lefebvre (len) <[email protected]>
- Set the products tracked by lot
- Set 1 route with steps that allow to begin next one after a minimum
amount processed.
- Plan and begin the manufacturing process.
- Process partially step 1, but fully step 2
- Finish step 1

The error 'You can not change the finished work order.' is raised.

This is because we try to set the default final lot on a WO which is
done.

This is only used to suggest the right lot number, so we can safely skip
the step if the WO is done or canceled.

opw-2002044

closes odoo/odoo#34072

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
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) <[email protected]>
…te value

During a Google Calendar sync,
exclusive instance of a recurrent event to which you are not the owner and
without an update datetime shouldn't be considered.

See developers.google.com/calendar/v3/reference/events/update
where cancelled status event might have empty fields.

> A cancelled status represents two different states
> depending on the event type:
> Cancelled exceptions of an uncancelled recurring event indicate
> that this instance should no longer be presented to the user.
> Clients should store these events for the lifetime of the parent recurring event.
> Cancelled exceptions are only guaranteed to have values for the id,
> recurringEventId and originalStartTime fields populated. The other fields might be empty.

As you are not the owner, the event shouldn't be deleted from Odoo
as the actual event owner might still attend the meeting.
It should just remove the user who is syncing his calendar from the attendees,
but as the sync currently doesn't support syncing event without an update datetime
from Google, we just choose to ignore the sync of this event.
The attendee will be removed/marked as not attending when the owner of the event
will sync his calendar.

opw-1966309

closes odoo/odoo#34075

Signed-off-by: Denis Ledoux <[email protected]>
- 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) <[email protected]>
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 51e5105

opw-2005317

closes odoo/odoo#33992

Signed-off-by: Nicolas Martinelli (nim) <[email protected]>
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) <[email protected]>
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 <[email protected]>
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 <[email protected]>
Oversight of previous forward-port.
@MiquelRForgeFlow MiquelRForgeFlow added this to the 12.0 milestone Jun 13, 2019
@pedrobaeza pedrobaeza merged commit a76bfaa into OCA:12.0 Jun 13, 2019
@MiquelRForgeFlow MiquelRForgeFlow deleted the 12.0-update-upstream-a526ff3f70 branch June 14, 2019 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.