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

[FIX] website_sale_options: prevent other session crash after checkout #28209

Closed
wants to merge 2 commits into
base: 10.0
from

Conversation

Projects
None yet
3 participants
@rdeodoo
Contributor

rdeodoo commented Oct 26, 2018

Check commit ef48b81

[FIX] website_sale_options: prevent other session crash after checkout
Check commit ef48b81

This commit is doing the same for website_sale_option as the optional product
is calling another route to add the product to the cart.
That route needed to be fixed too.

Closes #28209, related to #27508

@rdeodoo rdeodoo force-pushed the odoo-dev:10.0-fix-sale-option-multiple-device-rde branch from 034297d to 170991d Oct 26, 2018

@rdeodoo rdeodoo requested a review from JKE-be Oct 26, 2018

@rdeodoo rdeodoo changed the title from [FIX] website_sale_options: prevent other sessions to crash after che… to [FIX] website_sale_options: prevent other session crash after checkout Oct 26, 2018

@rdeodoo

This comment has been minimized.

Contributor

rdeodoo commented Oct 26, 2018

Close #27508 once merged

[FIX] website_sale: reset cart if checkout was done in another session
This commit extend commit ef48b81
When you have a cart on multiple session and confirm the card in one of them,
you could still access your cart from other session (note that you could not do
anything with it as it would be reset when adding product or changing qty).

Closes #28210

@rdeodoo rdeodoo force-pushed the odoo-dev:10.0-fix-sale-option-multiple-device-rde branch from 931c0d0 to 93911ca Oct 26, 2018

@C3POdoo C3POdoo added the RD label Oct 29, 2018

@rdeodoo

This comment has been minimized.

Contributor

rdeodoo commented Nov 2, 2018

Landed in 10.0 at 3457d1a and 7d2bc7d

@rdeodoo rdeodoo closed this Nov 2, 2018

@rdeodoo rdeodoo deleted the odoo-dev:10.0-fix-sale-option-multiple-device-rde branch Nov 2, 2018

rdeodoo added a commit that referenced this pull request Nov 2, 2018

[FIX] website_sale_options: prevent other session crash after checkout
Check commit ef48b81

This commit is doing the same for website_sale_option as the optional product
is calling another route to add the product to the cart.
That route needed to be fixed too.

Closes #28209, related to #27508

ddufresne added a commit to Numigi/odoo that referenced this pull request Nov 12, 2018

Update 12.0 (#9)
* [FIX] web: JournalDashboardGraph widgets appear at kanban views updates

closes odoo/odoo#27892

* [FIX] account: Payments on invoices not in date order

Steps to reproduce the bug:

- Create a customer invoice I with an amount of 100$ and validate it
- Register three payments P1 at 11/10, P2 at 12/10 and P3 at 13/10
- Click on button "Print" and the report displays the payments in the right order
P3, P2, P1
- Click on button "Send by email" and click on the attachment with the report

Bug:

The report didn't display the payments in the same order, it displayed P1, P2, P3

opw:1888251

closes odoo/odoo#27895

* [FIX] project: wrong context key in task action

In JS, the groupBy attribute is a list of strings

The default_group_by key that is sometimes present in the XML views
gets converted to a list at somepoint.

Before this commit, the task action couldn't be used in the app Dashboard

After this commit, it can

OPW 1894751

closes odoo/odoo#27908

* [FIX] web: avoid object duplicated key

Oversight of previous forward-port

* [FIX] account: adapt test to new report behavior

See 3c4f8533653d49198a73ab650b5aff24106ebdb1

* [FIX] base: Typo in string of default code for server actions

"may be be void" -> "may be void"

closes odoo/odoo#27919

* [FIX] point_of_sale: new table duplicates

Add new tables in POS screen, close the screen and resume the session
again, the tables you created duplicate

closes odoo/odoo#27924

* [IMP] sale_mrp: increase test delta

The test was comparing a scheduled date was correctly computed.
The runbot build 363053 failed because runbot12 is a bit slower and computed
the delay in 2 seconds instead of the 1 previously tolerated.

Increase the delta to 10 seconds.

The delay is a matter of days. Having a difference of 1, 10 or even 100 seconds
should be equivalent functionnaly.

Having a 100 seconds delay could indicate a serious performance issue though...

* [FIX] sale: convert invoice values to the sale order currency

If the invoice is not in the same currency as the sale order, then there was an
inconsistency in the sales report, as it was considered to be the unit currency.
We keep the initial computation in case where the invoice currency is the same.

opw 1890381

closes odoo/odoo#27797

* [FIX] base: display correct ondelete value

The on_delete value on an ir.model.field did not reflect the value set on the
field loaded in the registry

Fixes odoo/odoo#24464

closes odoo/odoo#27906

* [FIX] mail: Emails are sent in reverse order

The CRON job that sends email sends them in a LIFO order instead
of a FIFO order which can lead to confusion when the order is
important.

Exemple, when updating multiple time an appointement, the last
update should be the newest mail clients receive in their mail box
which was not the case before this PR.

opw-1888601

closes odoo/odoo#27888

* [IMP] tests logging

* Make phantomjs logging clearer by logging within the test case's
  module, not odoo.tests.common.

  This way, a tour in e.g. point of sale is clearly logged as that,
  rather than be logged as odoo.tests.common.phantomjs and require
  hunting which module/test we happen to be in.

* Clarify tagging causes for exclusion of selection of tests.

* [REF] tests: replace phantomjs by Chrome headless

As the phantomjs project was suspended[1], there was a need to change the js test
engine. Moreover, the engine was rather old and leading to non
deterministic crashes.

Chrome headless was choosen for simplicity and the long term vision of
the devtools protocol [2].

The 'phantom_js' method still exists but will be deprecated in
favor of 'browser_js' with the same parameters.

In order to communicate with the browser, the python websocket-client package
is needed.

[1] https://github.com/ariya/phantomjs/issues/15344
[2] https://chromedevtools.github.io/devtools-protocol/

closes #25991

* [FIX] tests: avoid traceback when websocket-client is not installed

The account module needs to import Form from "tests.common" causing a
traceback when websocket-client module is not installed.

As this module is only required for the tests, there is no reason to add
it to the "requirements.txt" file.

With this commit, Odoo account can be installed even when
websocket-client is not installed, in that case, the HttpCase tests that
needs to run Chrome headless will be skipped with a warning.

Closes: #26404

* [FIX] tests: clean the browser even on failure

When a Chrome headless test fails the browser is not cleaned and could
lead to a mix with other tests when the same method is called.

Also, the multiline assertions gives an unreadable message when the
assertion fails.
Finally, it happens that a thread does not have an 'url' attribute and lead to a crash when the logger tries to show the thread url.

With this commit, the browser is cleaned, even on failure and the
assertions are now one line.

Closes:  #26432

* [FIX] tests: clean up code

Closes #26467

* [FIX] tests: increase browser_js ready code timeout

Before starting a JS test/tour the _wait_ready method evaluates if the
test is ready with a timeout of 10 sec. From times to times, it happens
that the page is not ready after this timeout but the problem is hidden.

In order to help fixing that kind of issue, the timeout is increased to
60 sec and a warning is logged to emphasis the fact that an
issue exists.

Also some unused imports are removed with this commit

* [FIX] core: use actual chrome/chromium executable on macOs.

* [FIX] tests: properly stop chrome when no tab found

In some situations, Chrome remote debugging is sending an empty list of
opened tabs. In that case, an orphan Chrome process stays alive.

With this commit, Chrome is stopped properly in those situations.

* [FIX] tests: close Chrome and shutdown on SIGXCPU

When Odoo receive a SIGXCPU (CPU time limit reached), it shuts down
immediately. If a headless Chrome is running, it stays alive after the
Odoo shutdown.

With this commit, the signal is intercepeted and the Chrome browser is
properly closed before shutting down the Odoo server.

* [FIX] tests, web_tour: improve js error display in build details
Since chrome headless has been merged, js error messages are
difficult to read: some information was missing or only displayed in
full all log.

All console.error() will now be displayed in build details, and will
appear just before the python assertion.

XMO's improvement will also be used on all log: Using module and
classname of the class calling phantomJS.

Also: some small improvements on error messages to make them easier to read

Note: this commit also shown that some error were not detected:
now we will fail in any case if js log an error.

* [FIX] tests: redirect chrome headless stdout and stderr to dev null

When executing a very long HttpCase browser_js test, it happens that one
of the chrome process PIPE is full (ie. clickEverywhere test).
In that case, the communication with Chrome is blocked.

With this commit the stdout and stderr of the Chrome process are
redirected to /dev/null.

* [FIX] tests: disable screencast when no logfile

When an HttpCase browser_js test is started, the screencast is started
and is discarded at the end of the test if no logfile was provided by
the config.

This behavior can impact the performances.

With this commit, the screencast does not start at all if not needed.

* [FIX] tests: detect coverage and adjust timeout

When computing coverage, the tests are slowed down and the timeout is
often exceeded.

With this commit, HttpCase headless Chrome tests timeout is increased if
coverage is detected.

* [FIX] tests: chromium executable is chromium-browser

When installing chromium using apt
e.g apt install chromium-browser
the executable is `chromium-browser`,
not just `chromium`

* [FIX] tests: web tests, chromium fallback

On Ubuntu, the chromium executable is `chromium-browser`,
On other distributions, such as debian, it's `chromium`.

We therefore add another fallback

* [FIX] base: renaming of x2many fields

* [FIX] stock: do not crash move_lines return a tuple with empty list

Typically if you use an onchange method to retrieve values on the server
and convert them to write it will also try to write empty values like
[(6, 0, [])] and this will crash as it has also the length of 3 but no
dictionary but a list

closes odoo/odoo#27937

* [FIX] add res_company.sequence to base.sql

Seems like something similar to odoo/odoo#17111 can happen on Python 2.
The same change as #17111 is a bit involved for -stable, but this looks
pretty harmless.

Probably fixes #23781.

* [FIX] mail: avoid concurrent update of notifications

When sending notifications by batch one notification email can be send
up to 50 people. For one mail_mail entry to handle 50 emails can be sent
as those are sent independently for each recipient.

In some cases a bounce may occur while the whole batch of recipients is
not completely mailed. In that case the mailgateway will update the
notification status to bounced. When the cron finishes to send the whole
batch of emails it tries to update the notifications of all recipients.
However as a notification has already been updated due to the bounce we
face a concurrent update, meaning the transaction is rollbacked.

Emails have been sent but notifications are not considered as sent as they
have not been updated accordingly. Next time the cron runs it will send the
same batch again, with probably the same bounce and rollback. We could
therefore face an email loop.

This commit add test for this use case.

This commit is linked to task ID 1893054.

* [FIX] stock: free reservation over reserve

Usecase to reproduce:
- 6 units in stock
- reserve 3 units on a move
- reserve 3 units on another move
- validate a third move with 1 unit

It raise the error could not reserve more than you have in stock.
It happens because when free reservation stole reservation from
an exisiting move with too much quantity available, it continues the
loop instead of stopping.

This commit stop the loop once we have enough quantity taken.

opw-1895578

closes odoo/odoo#27935

* [FIX] mail: blacklist form view creation date visibility

closes odoo/odoo#27947

* [FIX] web: correct attribute name

Oversight of previous forward-port.

* [FIX] web: re-introduce on_change="0" to prevent onchanges for customization

In 10.0, adding on_change="0" allowed to prevent
default onchanges to occur for the field on which was added this attribute.

In 11.0, the rev. eaa66d11568b415b8d6b4c7a17a058b5ec1df4a6
added a regression by removing this possibility.
It was an oversight, it was not an expected change
in the web client.

In 10.0, it's this line which bring this possibility:
https://github.com/odoo/odoo/commit/e8a00bc50da435d3859118ca127d20a2eb9a0cab#diff-ff0e90fb0eb4418a7f66e618e4b51323R444

opw-1883366

closes odoo/odoo#27952

* [FIX] web: kanban quick create properly disabled

when grouped on field types for which it isn't supported.

Rev. 42e1efd disabled the quick create feature when the view is
grouped by date(time) fields. However, it hasn't been correctly
forwardported to 11.0 (with the new views). Indeed, the check was
done only once, at the initilization of the view. So if the user
selected another field to group by afterwards, the quick create
feature wasn't enabled/disabled accordingly.

Moreover, we didn't check if it was available when the user clicked
on CREATE in the control panel. So even if it wasn't (and thus if
there were no '+' icon in the columns), when the user clicked on
CREATE, the quick create widget was inserted in the first column.

This rev. fixes both issues.

Task 1878254

closes odoo/odoo#27867

* [FIX] website: restore options active system for carousel

* [FIX] web_editor: review _setActive system for select-class

- Handle the case where one select-class is a subset of another
  select-class of the same group e.g.

  <... data-select-class="hello"/>
  <... data-select-class="hello world"/>

- Handle empty values <... data-select-class=""/>

Note: both cases worked but were not displaying the active checkbox
correctly in the editor UI.

* [FIX] web_editor: fix background reset system for carousel items

When the user previews a background color, the background image of the
snippet is removed and re-added if the user chooses not to pick the
color. The background-image was not correctly added for carousel items.

* [FIX] web: kanban quick create with correct default values

When a kanban view is grouped by a char or a boolean field, and the
quick create option is enabled, the correct default value for the
grouped field (i.e. the value of the column in which the record is
created) should be given (either in the context if that field isn't
in the quick create form view, or as a default value in that form
view otherwise).

Before this rev., it wasn't the case, as it was only working when
grouped by a many2one field.

Task 1878254

* [FIX] web: kanban quick create when grouped by selection

Rev. 42e1efded5 aimed to disable the quick create feature when
grouped by date(time) fields, by only enabling it for char, boolean
and many2one fields. However, the selection case is quite important
and must be handled as well. This is what this rev. does.

Task 1878254

* [CLA] signature for mhamra

closes odoo/odoo#27943

* [FIX] web_editor: disable strange resize handles on Firefox

See comments in the code for details...

Closes https://github.com/odoo/odoo/pull/27964

* [IMP] account: Trigger a validation error when trying to set the same currency on a journal as on its parent company.

Until v12, doing this is wrong. The currency_id field of account.journal should only be used if the journal is in a different currency. Otherwise, this field should stay empty.

//NOTE FOR FORWARD-PORT: this commit should not be ported to 12.0 and further.

* [FIX] website: Add onchange language_ids on website model

On res.config.settings for website, when removing a language from language_ids, if this language is defined as default_lang_id, the default language will be updated by an onchange to prevent any inconsistency.
The same should happen when doing this directly on the form view of a website record.

closes odoo/odoo#27727

* [FIX] test_mail: bump query count margin

Needed to make test pass with `mail_push` (enterprise module) installed.

* [FIX] purchase_requisition: traceback on validate

The subsequent code strongly suggests that pick_in can be None,
however, the raise_if_not_found has not been set properly.

closes odoo/odoo#27397

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [FIX] hr_holidays: fix crash when accrual update allocations for multiple employees

In case we create an allocation in byTag, byDepartment or byCompany, we
need to pass the accrual flag to the children of the first allocation
and only update the children allocations (namely the byEmployee
allocations only).
Otherwise the accrual allocation will fail

Closes: #27971
opw-1895302

closes odoo/odoo#28012

* [FIX] hr_expense: correct group xmlid

* [FIX] website_sale: set user_id of newly created partners to the website salesperson

When an unlogger user places an order, a new partner is created on the fly when
the unlogged user is asked to place his delivery address.
The values he enters on the form are processed before being used.
In particular the team_id is taken from the order (typically website_sale team).
We add to the new values the salesperson id.
This value is then used in onchange_partner_id to update the order's user_id.

opw 1889510

closes odoo/odoo#28030

* [FIX] web: trim tooltip text before comparison

The error is triggered at least on Chrome 69 on macOS.

* [FIX] base: change DOP currency symbol position

closes odoo/odoo#28040

* [FIX] base: set correct time format for es_DO

In Dominican Republic, only english speakers and the military use 24h time
format. Businesses handle their information using 12h time format with a.m.
and p.m.

closes odoo/odoo#28042

* [FIX] doc: building on Python 3.6.7, 3.7.1, possibly 2.7.???

https://bugs.python.org/issue33899

tokenize.generate_tokens was altered to match the C tokenizer,
previously it would end the tokenization with just an ENDMARKER, in the
titled releases it adds a NEWLINE before the ENDMARKER if none is
present, this broke the parsing of jsdoc type specifications as Python's
tokenizer is used under the cover.

closes odoo/odoo#28056

* [FIX] point_of_sale: Button spamming create duplicates

Spamming the save button when creating a new custommer in point-
of-sale create duplicate users. This PR disable the button once
clicked and re-enable it when all the processing is done.

opw-1895302

close #23919

* [FIX] calendar: all day event shouldn't store in UTC

With a user in a distant timezone, like UTC +/- 11

Create a all day event.

Before this commit, the event was displayed across the wrong days
This was because the dates were converted from the user's timezone
into UTC before being stored.

Which is:
- start date at december, 12
- if the user's tz is utc-11: the date becomes december, 11 (at 1:00pm)
- at rendering, it becomes december, 11 (at 7:00am)

After this commit, we store the datetime field "as if" it were a date field
that is, we don't convert it to any particular tz

It is worth noting that, if one removes the allday mapping in the xml view,
an event that has been created as allday will get its start and stop date converted
to the browser's timezone, and will NOT be displayed as from 8am to 8pm as one could expect
This is considered as a limitation of the code, that was present before this commit anyway.

In any case, please do not revert this commit :D

OPW 1891110

closes odoo/odoo#27949

* [FIX] web: rpc queries should always be shorted out when the widget is destroyed

* [FIX] doc: do not duplicate header

And use tabs instead of spaces
Otherwise it looks for the file named "__manifest__.py 2014-..."

* [FIX] website_sale: prevent other sessions to crash after checkout

Before this commit:
If an user has multiple session on a database (eg: he is connected both on his
smartphone and his laptop on the ecommerce), and there is a cart in these
session, confirming the cart on one of the session will make other sessions
unable to use the checkout anymore.

This is because other sessions will still contains the Sale Order that is now
'sent' and updating the cart will raise an error:
`It is forbidden to modify a sales order which is not in draft status.`

Now:
If the SO to be updated is not in `draft` anymore, we create a new one.

Step to reproduce:
  - Login on ecommerce from device A
  - Add product in cart, the SO will be added on session
  - Login on ecommerce from device B
  - Pay the cart (it will retrieve the SO from device A)
  - At that point, the cart is paid and the SO is removed from session on
    device B but other devices won't be able to use the checkout anymore
    as they still have the SO in session which is in `sent` state.
    Thus, any action on cart will raise the error

Note:
1. We can't implement that behavior in `sale_get_order()` as it is supposed to
   return SO in `sent` state after checkout.
2. We can't implement that behavior in `_cart_update()` as it is inherited in
   some module. Thus, implementing that behavior in `cart_update()` would change
   `self = order` but inherited methods would still have initial `self`.
3. Implementing the behavior in the controller it is already done (differently)
   in `cart_update_json()`.

Fixes #27508, closes #27794

* [FIX] calendar: recurring event around DST

Be in timezone Europe/Brussels, where, in 2018, the DST switch
happens on 2018-10-28.

Create a recurring event starting on 2018-10-27 until 2018-10-29
at say, 8am

For the days before the 28, the time of the event will be correct

Before this commit though, for the days after the 28,
the meeting time will be shifted by one hour
This is because the rrule took a TZ aware datetime, and generated recurring
event dates with that same TZ, i.e. the one in STD time

After, this commit, all the meetings are well scheduled at 8am,

OPW 1895315

closes odoo/odoo#27985

* [FIX] project: template render attachments sudo

Related issue odoo/odoo#27256
use case is in there

Retrieving the access token for an attachment should be done as sudo
Also, we adapt the code to the method, which appears to be "api.one" (lol)

OPW 1888873

closes odoo/odoo#28074

* [FIX] doc: correct reference to the line in the file

Introduced at 94e82753acc36

* [FIX] doc: backport of 9a07a4599ce to 10.0

To be compatible with sphinx >= 1.6

* [FIX] doc: backport of ac37ca39eaf to 10.0

To be compatible with sphinx >= 1.8

* [FIX] models: use expected parameter type

set_failed function expects an iterable object
Introduced at 32a58c0db3c0

Fixes odoo/odoo#27744

closes odoo/odoo#27911

* [FIX] migration: use correct migration prefix in docstring

Migration files must contain `-` in its name for being executed

* [FIX] mrp_bom_cost: bom cost / bom quantity

Use case to reproduce:
- create a BoM of 50 finished products:
- Add a routing with an operation time of 1h
- Set a 1$/h cost on workcenter
- Set unit price from BoM

It will be 1$ for one product. It should be 0.02$
since it will take 1h for 50 products, so the price
should be 1/50

It happens because the system add the operation time by unit instead
of adding it only once.

related to commit 17b625695521b9a1af75e0c10337d0d3076c8fce

opw-1890005

* [FIX] delivery: wrong currency conversion

In a multi-currency company, the delivery price of a quotation was
wrongly converted when the currency used by the pricelist was not
the same as the currency used by the company.

This PR correct that behavior by correcly compute the delivery
price according to the pricelist currency.

To reproduce:
1) Install the accounting, sales and delivery modules
2) Set the company as a multi-currency company in the accounting
   settings
3) Change the currency rate so the one used by the company is 1
   and the other one (the one that will be used on the pricelist)
   is anything else than 1
4) Create a pricelist with that other currency
5) Create a quotation using the new pricelist, select a deliver
6) Click "Set Price", the delivery price shown on the form isn't
   the same as the price on the quotation.

opw-1894422

* [FIX] mrp: remove useless upgrade boolean

The option enables a group, it does not install an enterprise module
Introduced at 85ed6a31a2

Fixes odoo/odoo#28080
Closes odoo/odoo#28081

* [FIX] account: don't enforce test journal currency

It was causing some tests failure due to 22f0da809e84618901b7ca4b78582abd64c03c55

* [FIX] base: don't ignore new uninstallable modules

When updating the module list (`ir.module.module.update_list()`), new
modules that are not installable were ignored.
This behavior was not consistent with the database initialization [1]
which creates all modules.

[1] https://github.com/odoo/odoo/blob/5d932e5db164fe80fd7c011ddd53f3494ef89ef5/odoo/modules/db.py#L51-L54

* [FIX] cli: fix broken link

The master file no longer exists

Closes odoo/odoo#26623

* [FIX] mail: set default _rec_name to avoid showing model with id

closes odoo/odoo#27186

* [CLA] signature for AnilKesariya

Closes odoo/odoo#27024

* [FIX] account,sale_timesheet: don't enforce test journal currency

It was causing some tests failure due to 22f0da809e84618901b7ca4b78582abd64c03c55

* [FIX] website_sale: make extra step work in cart checkout

In v11, when we add the extra step in website checkout and
then click 'proceed to checkout', user will be directed to address
(even when there is default address detected), and then extra step,
and in the end confirmation.
But in v12, when extra step is enabled, user  will be sent
directly to confirmation after clicking 'proceed to checkout'.
They can click 'extra info' to fill out the information,
but I imagine user would easily ignore that option.
It seems the express checkout implementation ignored extra_info route.

closes odoo/odoo#28122

* [CLA] signature for Ark74

Closes #28126

* [FIX] stock: add note field

Commit 37d20240a9e85c2a79fae62dc5b8d869fe40549d reintroduce lost note
field but not in a clean way.
This commit put the field in a proper tab.

Task : 1896143

closes odoo/odoo#28026

* [I18N] Update translation terms from Transifex

* [FIX] stock: run scheduler on partially available moves

1. Product A - on stock 5 pcs.
2. SO - 7 pcs. of A
3. Generated picking has reserved 5 pcs.
4. Increase stock to 7 pcs. (Update qty on Hand)
5. Run procurement scheduler
6. Picking still has reserved 5 pcs.

The scheduler should take into account the moves partially available.

Fixes #27874

opw-1895622

closes odoo/odoo#28136

* [FIX] doc: translator under Sphinx 1.5

In Sphinx 1.5 (fairly specifically), the warner thing takes a `type` kw,
and building the doc blows up if that parameter is not provided.

* [P3] payment_stripe: Exception.message removed

Apparently missed in 07ab8b6cd2b44aeb91dadc35adf5f4b19f1399b2

In Python 3, there is no Exception.message attribute anymore, this would
lead to cascading exceptions in the stripe_s2s_create handler.

closes odoo/odoo#28141

* [FIX] mail: do not prevent record update due to automated activities

Currently creating activities assigned to user not having to the document
raises an Error as people should not have activities they cannot handle
directly on a document they cannot access.

In some cases activities are created through business flow, like automatic
activities creation when creating leave requests. Assigning an activity
to someone that has no access to the document should not prevent from
creating the leave request.

This commit therefore does not check assigned user access on automated
activities to avoid having blocked business flows.

This commit is linked to task ID 1903484.

closes odoo/odoo#28139

* [FIX] point_of_sale: IoT https in pos

before this fix it was not possible to connect to the pos/iot-box using
https on the pos. By checking if the pos is http or https this is now
possible after accepting the certificate.
if https scanning for proxy is disabled, the user should always give a
    ip in the configuration

* [FIX] hr_attendance: allow multiple attendances

If the search returns more than one result, the rendering of the message would
crash (SingletonError when accessing check_in field value).

Use the same order and limit as both search before and after

Courtesy of David Tran

Closes odoo/odoo#28055

* [FIX] point_of_sale: alignment note textarea

before fix:
in firefox the textarea of note modal has a overflow
textarea can be expanded outside borders modal in all browsers

closes #25199
closes #25215

issue 1895298

* [FIX] mrp: unbuild of tracked products

- Create 2 Products A and B, tracked by serial number
- Create a BOM for A:
  1 Unit of B
- Create a MO for 2 Units of A
- Validate:
  Product with S/N A1 consumes B1
  Product with S/N A2 consumes B2
- Unbuild A2

If A1 was created before A2, B1 will used as a component of A2 at
unbuild.

When going through the stock move lines, we don't verify that the lot
produced matches the lot we unbuild.

opw-1889002

closes odoo/odoo#28154

* [REV] mrp: block updating live BoM

This reverts commit d78b6f5e25eb7bf36aef57d1ae1c5c6e51d1ec7b.

This constraint is considered too harsh. It was applied to circumvent
inconsistencies when a bom is modified while being used in a
manufacturing order and the user chose to update the quantity to
produce. The current code will look at the existing move if no
intermaddite post of inventory was done else look at the new bom.

A code to re-construct the original BoM from the stock moves isn't easy
to write to handle all cases, one particularly complicated is the
deletion of bom lines of the same product.

We also considered to block the update qty button if the bom is modified
after the create date of the MO, but if we have to read all the bom
lines of all the sub bom in a computed field it may be slow on large
databases.

We thus chose to remove the constraint and think of a better approach in
a future version.

task 1891407

closes odoo/odoo#28155

* [FIX] mrp: workorders of sub-BOMs

- Create the following BOM structure:
```
  Prod 1 (Manufacture)
  |
  --- Prod 2
      Prod 3 (Kit)
      |
      --- Prod 4
	  Prod 5
```
- The BOMs for Prod 1 & 3 must have a routing set, to generate
  workorders
- Create a MO for 1 unit of Prod 1, process to the end

2 units of Prod 1 are created instead of 1.

This is due to the WO for Prod 3 not having a `next_work_order_id`.
Therefore, `record_production` adds an extra quantity at:
```
production_move.quantity_done += self.qty_producing
```

To prevent this, we set as `next_work_order_id` of the BOM of Prod 3 the
WO of Prod 1.

Closes #19527
opw-1817398
opw-1883693

* [FIX] tests: avoid remaining requests

From times to times, warning are seen on the runbot during HttpCase
tests with the chrome headless browser.

Those warning are about Odoo trying to join remaining requests threads.
In the dumpstack, the thread seems blocked in the werkzeug
handle_one_request method, when trying to read the HTTP request line.

One explanation could be that Chrome opens a pre-connect socket for
a future use. When the HttpTest cleans the browser, the page stops
loading but (probably) keeps the socket open for a while.

That could explain the problem.

With this commit, a timeout is set on the request handler,
in the hope that it closes the pre-connect socket too.

* [FIX] purchase: fix anglosaxon valuation

Before that, when receiving, then invoicing with price diff, the value in interim account corresponded to the price on the invoice instead of the original valuation one.

Scenario to reproduce the issue:

* create PO with 1 product, FIFO valuation, price=10
* receive PO: the entry in stock interim account has debit=credit=10
* create invoice, with price=15 instead of 10
* the invoice entry should be: payable: C=15 ; price diff: D=5 ; interim account: D=10
  ==> Instead, we had payable: C=20 ; price diff: D=5 ; interim account: D=15 => this was wrong

Also added a test case for the same scenario, verifying the amounts written in the different accounts (and refactored a bit ValuationReconciliationTestCase for easiness)

Closes #27394

* [IMP] l10n_mx: Add advance accounts on the chart template definition

closes odoo/odoo#28165

* [FIX] web: typo in docstring

The parameter would not be correctly detected by doc extractors

closes odoo/odoo#28169

* [FIX] mail: mark as read only when accessing to chatter

Before this commit, the user could not receive any notification
from the chatter of a document when having Notification Management
set to "Handle with Odoo".

This problem occurs when the user opens (or has opened) the document.
Any messages received from the document are automatically marked
as read, so it removes the notification right after receiving it.

In order to no longer have this issue, the user had to reload all
pages that have opened this document.

This commit slightly changes the behaviour of the chatter, so that
it automatically marks it as read only when accessing the document,
but not when the document is open (or has been opened). Consequently,
if the user has opened the document and then receives a notification
from this document, it won't automatically mark it as read.

Task-ID 1895359

opw-1890556

closes odoo/odoo#28114

* [FIX] tests: remove chrome sandboxing

It appears that chrome headless with sandboxing is failing when running
containerized because it tries to use Linux namespaces.

With this commit, the no-sanbox optional arg is used to avoid this
issue.

Closes #26456
Closes #28053

* [FIX] mail: spam the send button create multiple messages

Spamming the "send" button on the chatter send multiple times the
same message. This PR simply disable the send button to fordib the
spam.

opw-1895511

closes #27233

closes odoo/odoo#28078

* [FIX] mail: display both tracking values and body of the messages in mail thread

Before that, the body of the message was never displayed if the message had tracking values. This was annoying for account_asset module, were we prompt the user for some justification when she modifies the depreciation data of an asset, and then call message_post with this text as body, and tracking values reflecting the change that was made.

* [FIX] web_editor: fix forward-port

Forward-port of https://github.com/odoo/odoo/commit/227fc6408ddc998529bb1c38222ddba50f40868b
made with https://github.com/odoo/odoo/commit/717f4583949219c346c87c390fbc336b4f31571c
introduced a JS error.

closes odoo/odoo#28187

* [CLA] signature for Brahoo

Backport to 11.0 of #28161

* [FIX] base_vat_autocomplete: add missing attrs

VAT number should be readonly when parent_id is set
This is already what is done in base.view_partner_form and
base.view_partner_short_form

* [FIX] account: mark configuration bar bank step done

When a new bank account was created manually, the step was not marked as done.

* [IMP] account: set default vendor_display_name for uploads

Previously a default name was set only for vendor bills created from
emails.

Task: 1893079

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* (FIX] account: Impossible to make a partial credit note

Steps to reproduce the bug:

- Create a credit note for an amount of 100$
- Validate it and register a payment
- Let's pay an amount of 90$ and mark this credit note as fully paid

Bug:

An error message was raised saying: Wrong credit or debit value in accounting entry !

The field residual_company_signed must be positive for out_invoice and in_refund and
negative for in_invoice and out_refund. In this way, the correct writeoff amount
can be computed in function _create_payment_entry.

PS: In function _compute_payment_amount, the field residual_signed and residual_company_signed
are already signed, that's why it was wrong to multiply a second time on it with MAP_INVOICE_TYPE_PAYMENT_SIGN

opw:1893570

closes odoo/odoo#28148

* [IMP] sale: add testcase for fix 7bee068a0

The bug has been fixed meanwhile, but this one adds a testcase, so
it's worth merging it.

Task #1871444

* [FIX] web: display of timezone mismatch select widget

On the user's preference, change the timezone to one that is different
from the browser.
Save the form.

Go back to the user's preferences.

Before this commit, every timezone was displayed inside the span that contain
the warning icon, and leaked everywhere on the form view.

This was because of the joint action effects of commits:
86897ca167338ca434e62827fa09f44ddbce324c
4dfabb8f7adde06a7936502af61534c9958ed4f7

Which provoked the field to be re-rendered in edit mode,
but with an $el on which a span was added. `<option/>` elements
were then added to both `<select>` and `<span>`
This did not happen before v12.0

After this commit, there is no display glitch

OPW 1895088

closes odoo/odoo#28108

* [CLA] signature for troizky

closes odoo/odoo#28201

* [FIX] account: invoice computed reference supports sequence suffix

Set a suffix on the sequence that will determines an invoice's move's name

Validate an invoice

Before this commit, there was a traceback because the regex that matches the invoice number
did not match anything due to the suffix

After this commit, it works as expected

OPW 1903326

closes odoo/odoo#28241

* [FIX] sale: Wrong expected delivery time for orders with services

When doing a sale order containing product and services, the
computed minimal expected delivery time was using the customer lead
time of the services (which is always 0) instead of the minimum
customer lead time of the products.

To reproduce:
1) Install Sales and Delivery Cost.
2) Go to the sales settings and enable the "Delivery Date" option.
3) Set a customer lead time on a product.
4) Create a quotation with that product, any service and a
   delivery method.
5) Validate the quotation and the delivery.
6) The "Expected Time" written in the "Other Information" tab of
   the sale order doesn't match the minimum delivery expected time.

opw-1902858

closes odoo/odoo#28208

* [MOV] web, base_import: mobile tests should be in mobile suite

This fix some inconsistent error on runbot.

In mobile, some views* depend on 'jquery.touchSwipe' library which
is lazy loaded. As a result, the views become asynchronous...
It's why this library is already loaded before running tests in the
mobile test suite. So we can continue to use synchronous views whether
in mobile tests or not.

But some mobile tests weren't in mobile suite...
In desktop, 'jquery.touchSwipe' is lazy loaded and the first test will
load it for others. It's why the first one has to be asynchronous:
https://github.com/odoo/odoo/commit/da7b59045d246c159f93bc75e3f19c6b1221d31c

The inconsistency comes from the fact that all tests are sequential but
we can't garantee the execution order. So, if the test mentionned is not
the first executed one, an error will occur because the view is not
asynchronous.

Now, all mobile tests are moved in mobile suite to be sure that
'jquery.touchSwipe' is loaded.

We also set the default value for size_class because we want a
coherent environment. It is very rare to find mobile devices with
more than 474px wide.

*: form_view, kanban_view, res_config_settings

closes odoo/odoo#28195

* [FIX] procurement_jit: do not unreserve picking

When a quantity is increased in SO, the related picking is unreserved
then re-assigned, we can just call assign, as we don't want to lose what
has already been done in the picking.

As the decreased quantity on SO is not propagated on move, not
unreserving won't cause trouble.

* [FIX] stock: remove level package when unreserve if necessary

* [FIX] sale: Duplicate field VAT in report_invoice_document

Removed vat field from inherited invoice template to avoid a duplication.

opw:1903782, 1903149

closes odoo/odoo#28249

* [FIX] website_links: do not require flash to copy text to clipboard

The "copy link" to clipboard button ancestrally used a flash (.swf) dependency
(ZeroClipboard) to work.
Since Odoo honours its history, it was still there.
However on Firefox you are asked to activate flash to make it work,
and on Chrome nothing happens.
We get rid of this shibboleth, using instead clipboard.js that is already used
elswhere for the same purpose.

closes #27958
opw 1896509

* [FIX] digest: check field existance

This commit fixes the following bug:
* On a new DB, install account
* Settings > Technical > Email > Digest emails
* Open Weekly Digest, set Next Send Date to current day
* Settings > Technical > Scheduled Actions > Digest Emails
* Run manually

AttributeError: 'res.company' object has no attribute
'resource_calendar_id'

The field resource_calendar_id is added in the module resource.
The module digest does not have resource in its dependency.
In stable version, have a silent fallback on UTC if the field is not present.
The right dependency should be added in master.

closes odoo/odoo#28244

* [FIX] base: subscribe new API onchange methods for module fields

Adapt the code to use the new API for onchange methods.  This fixes onchanges
for version 11.0, since support of old-API onchange is actually gone.

* [FIX] web: fix save search in search more modal

When searching for records in a modal (ex: m2o "Search More"),
clicking on "Save current search" had no effect.

Task 1894915.

closes odoo/odoo#27931

* [FIX] mail: mark as read only when accessing to chatter

Backport of 17bb0ca443f54bc231b03794e776bbc6992ffdfa

Before this commit, the user could not receive any notification
from the chatter of a document when having Notification Management
set to "Handle with Odoo".

This problem occurs when the user opens (or has opened) the document.
Any messages received from the document are automatically marked
as read, so it removes the notification right after receiving it.

In order to no longer have this issue, the user had to reload all
pages that have opened this document.

This commit slightly changes the behaviour of the chatter, so that
it automatically marks it as read only when accessing the document,
but not when the document is open (or has been opened). Consequently,
if the user has opened the document and then receives a notification
from this document, it won't automatically mark it as read.

Task-ID 1895359

opw-1890556

closes odoo/odoo#28113

* [FIX] web: creating a record in a grouped empty kanban view crash

When creating a record in a grouped kanban view, it tries to add
the record to the first column but if no column exist, it fails
to find the first one and raise an exception.

This PR correct that bevahior by checking it exists a column and
fallback to the view form when it does not.

opw-1902851

closes odoo/odoo#28262

* [FIX] mail: adapt forward-ported test

* [FIX] web: consider correct viewtype when loading data

Before this commit, when loading the data and calling the prostprocess,
the viewType was not correctly passed which could lead to broken
behaviour. For example, if one was to load a record from a list view
embedded in a form view, the viewtype passed was the list which
prevented to load the data from the form view.

OPW 1891295

closes odoo/odoo#28279

* [FIX] website_sale_delivery: allow hook at price update

A hook is necessary for a price update when TaxCloud is used.

opw-1894511

closes odoo/odoo#28281

* [FIX] account: avoid computing uom price if no product

Before this commit:

* Enable UOMs
* Create a new invoice and invoice line
* Set *only* the uom field of the invoice line
* Singleton expected error

This happens because the method _compute_price of `uom.uom` expects a
singleton, however since no product has been defined yet, it gets an
empty recordset which of course doesn't comply with self.ensure_one(),
raising a Singleton Error.

Functionally speaking, it makes sense to define a product before
choosing an uom, however a Singleton Error is an unexpected error, so
instead of doing that, we only calculate the price_unit if a product has
been chosen.

Fixes #28269

closes odoo/odoo#28278

* [IMP] iap: Update documentation with new functionalities

closes odoo/odoo#28282

* [FIX] website: fix ace editor interactions with other widgets

- The affix navbar went over the ace editor, preventing to save/close
- The ace editor went always under the new content menu

Now:
- The affix navbar is always under the ace editor
- The ace editor closes when the new content menu opens
- The new content menu closes when the ace editor opens

closes odoo/odoo#28251

* [IMP] hr_timesheet: make timesheet_encode_uom_id required in config

The related field `timesheet_encode_uom_id` is required
on the company, but not on the settings.
This commit makes it requried through the view to
avoid a confusing SQL error message for the end user.

Closes #27645

* [FIX] website_sale: priority for non default view

Set a higher priority to avoid a view to become a default one,
just because his ID is lower than the expected default one.

closes odoo/odoo#28287

* [FIX] website_sale: review shop cart summary

On the payment page, a cart summary appears on the right. This summary
is still not visually perfect and the design will be improved in master.
This commit however restores what can be considered as a bug with a
minimal diff:

- "I have a coupon" message was glued to the card border
- If a product name was long, the table was very small on Firefox as the
  name broke accordingly while it was very large on Chrome.

Also see https://github.com/odoo/odoo/pull/28245/files

closes odoo/odoo#28286

* [FIX] account: allow to write on multiple records

Ensure the write method in account.journal is working with multiple records.
The for loop indicates it was the intention to be used on several records but
self was still used instead of journal
Some methods like _update_mail_alias work with an ensure_one

closes odoo/odoo#28246

* [IMP] l10n_ch: also detect postal account type when using the shorten form with -

This shorten form is aa-bbb-x. The a characters are the first two digits of the number, x is the mod10r verification digit, and b characters consist of all the intermediate digits, without the leading 0s. The chain of b characters' length can range between 1 and 6 characters.

* [IMP] website: make website name required

The website_name field is a related towards a required field.
Saving a res.config without a value raise an error.

closes odoo/odoo#27907

* [FIX] website: fix parallax snippets' structure

Some of our new snippets for 12.0 uses parallax. Those were not using
the exact structure required by parallax which *may* lead to unexpected
results when playing with the related options.

closes odoo/odoo#28299

* [IMP] l10n_vn: fix syntax and allow reconcilation

for accounts 3341, 3348, 141, 1388, 3388

* [FIX] l10n_ro: fix xml syntax

* [FIX] account_budget: properly calculate percentage sum in read_group

The percentage field is computed in _compute_percentage as a value
between 0 and 1. This is good because that's what widget="percentage"
in views expects.

This makes read_group also return a value between 0 and 1, instead of
0 and 100. Otherwise list views will show e.g. 5000% when grouping
lines that sum to 50%.

Introduced in saas-11.4 at odoo/odoo@9148960174bdb0abbee6a5b7403a8f.

*Do not forward port, already ported to 12.0 via
 odoo/enterprise#2975 (odoo/enterprise@a1484e650cb013f35755d)*

opw-1904481

* [FIX] reqs: bump up recommended `requests` version

In light of CVE-2018-18074, using python-requests 2.20.0 is recommended,
or any distribution-specific version that was patched.

See also https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-18074

* [FIX] account: correct typo in warning message

closes odoo/odoo#28218

* [FIX] stock: Wrong production/scrap/adjustment location used in multicompany

- When using perpetual inventory valuation, the accounts used for scrap, manufacturing,
and inventory adjustment operations are set on the corresponding locations .
- In a multicompany environment, you will have a separate chart of accounts for each company.
- Account fields on locations are not property fields.
- Therefore, in order to separate the accounting of manufacturing, scrap, and inventory
adjustment operations, you must use a location for each operation for each company.
- Set up one location for each company for scrap, production, and adjustment
locations, setting the company field on each.

Bug:
- When attempting to create a MO, inventory adjustment, or scrap order while signed
in to the second company, you will receive a permissions error on stock.location.

Fix:
- Now the right location is taken according to the company of the user.

Backport of this commit: c7526407ab4cf4c3d338f50a0259ac803e89f91f

opw:1817339

* [FIX] mail : fix traceback while creating invalid blacklist email address

The objective of not creating the record if the email was invalid
was to avoid crash on import. But if the number of record created does not
match the number of record that would have been created (see in flush()
in models.py), this cannot work.

Also, it's necessary to tell the user that his import file has an error
and where. This is why a UserError must be returned.

Task ID 1902139
Closes PR #28011

* [FIX] website_sale: BS4, restore collapsible categories design

Closes https://github.com/odoo/odoo/issues/27970

closes odoo/odoo#28317

* [FIX] web: reload many2one data if the context has changed

When a view is loaded, it checks which fields it has to load.
In the case of a many2one, it could be the case that a context key is present in
one view and not in the other; if it happens, we should reload the data, as a
name_get result could vary.

opw 1891295

closes odoo/odoo#28298

* [FIX] web: remove debug in timezone_mismatch test

Before this commit, a blank page was shown when tests
were running in /web/tests.

closes odoo/odoo#28319

* [FIX] hr_attendance : kiosk mode multi scanning

- Scan a barcode for employee 1 in kiosk mode
- At greetings message, scan a barcode for employee 2

2 attendance entries are created for employee 2 instead of 1.

When scanning the barcode for employee 2, the event listener
`_onBarcodeScanned` is still active on `KioskMode`. Therefore, the RPC
call to `attendance_scan` is performed twice.

We deactivate the event listener after scanning, and reactivate on
`KioskMode` only if there is an issue. This is sufficient since the call
to `do_action` in `GreetingMessage` will create another instance of the
client action. In `GreetingMessage`, we add back the redirection to
`KioskMode`.

Co-authored-by: Nicolas Martinelli <nim@odoo.com>

Linked to Task ID 1878251
opw-1878632
opw-1888402

closes odoo/odoo#28150

* Revert "(FIX] account: Impossible to make a partial credit note"

This reverts commit bb939ffac0c8222a4b34523b739b64173f2258f8.

closes odoo/odoo#28321

* [FIX] hw_blackbox_be: grep mac address

In the previous debian version, the output of ifconfig was:
ifconfig eth0   Link encap:Ethernet HWaddr b8:27:eb:d6:03:8d

now is
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b8:27:eb:d6:03:8d  txqueuelen 1000  (Ethernet)

closes odoo/odoo#28320

* [FIX] web_editor: fix automatic editor context for RPCs

With https://github.com/odoo/odoo/commit/55131b8f5becdd3d4776f4c3e7e4288a0b185706,
we automatically add the known editor context (containing lang,
website_id, etc) when using the `this._rpc` method. Some RPCs needed
however to explicitely not send a value from this automatic context...
but this was not correctly implemented. This can now be achieved by
using the `noContextKeys` key in the `this._rpc`'s *options* parameter.

closes odoo/odoo#28322

* [FIX] partner_autocomplete : Do not crash other tests when partner_autocomplete server fails

Add a check to see if we're in test mode that returns an InsufficientCreditError to avoid failing other tests if partner_autocomplete server fails

closes odoo/odoo#28324

* [FIX] bus: never GC during requests

Running the bus garbage collector synchronously during the handling of a
request can stall the request for a very long time.

Instead, we add this step to the existing auto-vacuum scheduled job that
handles this kind of housecleaning. It brings another interesting bonus:
it can be scheduled outside of peak hours, which will avoid blocking other
bus-related transactions (the GC deletes a lot of rows and takes a lot
of exclusive locks in the database)

closes odoo/odoo#28326

* [I18N] Update translation terms from Transifex

* [FIX] account_check_printing: allow users to configure check layout

52a8ed3c0c made related fields readonly by default. 3f4f77fd9d
attempted to identify all fields that needed readonly=False but missed
this one.

closes odoo/odoo#28343

* [FIX] mail: access error when reading a channel

When a record inaccessible by the user is linked
to a message in a channel accessible to the user,
Avoid to raise an access error due to this linked record.

Also need an aditional query in test query_count.

closes odoo/odoo#28312

* [IMP] crm: search lead on name

closes odoo/odoo#28350

* [I18N] clean es_MX old translations

Only keep the useful ones

closes odoo/odoo#28351

* [FIX] website_sale_options: prevent other session crash after checkout

Check commit https://github.com/odoo/odoo/commit/ef48b81ab127dd717a4a9d106edd5c51121bc8f7

This commit is doing the same for website_sale_option as the optional product
is calling another route to add the product to the cart.
That route needed to be fixed too.

Closes #28209, related to #27508

* [FIX] website_sale: reset cart if checkout was done in another session

This commit extend commit https://github.com/odoo/odoo/commit/ef48b81ab127dd717a4a9d106edd5c51121bc8f7
When you have a cart on multiple session and confirm the card in one of them,
you could still access your cart from other session (note that you could not do
anything with it as it would be reset when adding product or changing qty).

Closes #28210

* [FIX] web_unsplash: wrong doc links

Doc links were created before the doc, then the doc was merged under a
different URL.

This commit corrects the links to the Unsplash documentation.

closes odoo/odoo#28355

* [FIX] hr_attendance: multiple scans

- Open the Attendance kiosk mode
- Scan an incorrect barcode

It's not possible to scan any barcode anymore.

If the barcode is incorrect, we need to add back the event listener.
Moreover, the RPC introduced with bbc7e9586d440c4bd is not necessary if
we retrieve the barcode thanks to the existing RPC call.

opw-1878632
opw-1888402

closes odoo/odoo#28354

* [FIX] server: always consume wakeup bytes from signals

Due to the implementation of PEP-475[1] in Python 3.5, revision
e98e8e9b1bdf8c3a3bcf74b7648b0829c21d356a used the recommended technique
of wakeup file descriptors in order to detect interruption of sleep() and
select() by signals, when running in multi-process mode (workers > 0).

The technique works well, however the initial patch never bothered to
read the byte that is written to the wakeup pipe when a signal is
processed. This does not matter when the signal is meant to shut down
the server, but it matters when the signal is SIGQUIT: it simply prints
thread dumps, and continues operating normally.
As a consequence, that byte remains in the wakeup pipe forever, causing
all the subsequent select/sleep calls to return immediately because
the wakeup fd *is* already ready. The symptom was that worker
processes would start cycling their main run loop very fast after
receiving a SIGQUIT signal, eating 100% CPU.

This patch ensures we always empty the wakeup pipe after an interruptible
call, to avoid this effect. It also refactors another occurrence of the
"empty pipe" pattern, in the PreforkServer, and incidentally uses readable
aliases for the file descriptors bound to the ends of the wakeup pipe
(wakeup_fd_r / wakeup_fd_w).

[1] https://www.python.org/dev/peps/pep-0475

closes odoo/odoo#28356

* [FIX] mail: add index on `message_main_attachment_id`

- When deleting attachments, the foreign key constraints on
  `message_main_attachment_id` are triggered which could take
  a lot of time to be computed.

closes odoo/odoo#28358

* [FIX] product: respect received args value instead of overriding it (#26594)

When doing a name_search, if a current search is already specified through args,
do not replace it

Closes #26594

* [FIX] sale_timesheet: UOM

Revert commits da2140b72678b, e65c8826ef9969 and 06cd145a79f023c. They
introduce an incorrect UOM.

The original issue was an `AccessError` due to the fact that the
employee chosen was not in the same company than the user. Therefore,
instead of changing the logic of the UOM selection, we make sure to
select the employee in the appropriate company first, then fall back on
any company then.

opw-1888299

* [FIX] gamification: correct mail template on small challenges

A challenge with less than 3 participants was failing with a key error
The challenge line has only one 'goal' result per participant

As the template is set in a noupdate, even a module update does not fix the bug
Generate fake goals that will be displayed in the top 3, e.g.:
1 Bob	 $100 42%
2 Alice	 $50  21%
3 	 0    0%

closes odoo/odoo#28363

* [FIX] lunch: correct default filter

Renaming a filter in search view require to
rename it also in context of actions

closes odoo/odoo#28366

* [FIX] account: apply correct currency rate for taxes at account move creation

Before that, taxes were only applied with the most recent currency rate, which caused problems in multi currencies, when reconciling statement lines made in the past with invoices, causing the amount currencies in the payment account.move to be wrong.

//Scenario to reproduce the issue (from customer ticket 1903497):

(for a company with USD as base currency)

1. Create a new bank journal for EUR payments

2. Create a new customer invoice for 90€

3. Create a new tax for the reconciliation model, price-included and amounting to 15%

4. Create a new reconciliation model using this tax

5. Use the currency rates from the demo data, add one that is closer to current date than the most recent one.

6. Create a new bank statement for the created EUR bank journal. Make sure that the transaction is less than the actual amount due on the invoice so that we can apply the reconciliation model. Also make sure to set a date on the transaction that lies in the past at some point when the currency rate was (significantly) different.

7. Hit the reconcile button, select the amount due from the invoice and apply the discount reconciliation model(take note of the amount on the created tax move line). Now reconcile.

What is the current behavior that you observe?

Now go back to the bank statement and check the created journal entries. You will see a difference in the amount currency values of the payment and the tax account move line. This difference should not exist.

* [FIX] website: review action start on page loading

This commit fixes a bug introduced with https://github.com/odoo/odoo/pull/28251:
When opening the ace editor on page load thanks to the #ace-view-editor
URL hash, a JS error occurred preventing the editor to open.

This was due to the way actions were executed on page loading:
- Menu elements are initialized and can handle actions
- On initialization, the ace menu tried to launch the editor
- First, it asked that all widgets are closed (see mentioned PR)
- The website handled that action demand by asking everyone to close
  their widget
- The 'new content' menu tried... and failed as referenced a variable
  which would only have been created in the start method.

Conclusion: before handling actions, all action-capable widgets should
be started. This is what this commit does: when receiving an action
demand, we first wait for the action handler to be fully started. This
implied another change: before, many menus were waiting for the result
of an action to notify that their start method is finished... this
would cause a deadlock in the new system so those were removed, this did
not make much sense anyway (if the result of that starting action has to
be known, a dedicated event/method should handle that).

closes odoo/odoo#28364

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [FIX] stock: Cannot add company to push/pull rules

When creating a rule, the company of the route must be taken when
the route has a company.

opw:1903996

closes odoo/odoo#28387

* Revert "[IMP] account: Trigger a validation error when trying to set the same currency on a journal as on its parent company."

This commit shouldn't have been forward-ported to this branch.

This reverts commit 22f0da809e84618901b7ca4b78582abd64c03c55.

* [FIX] mrp: subproduct price + rounding

On the BoM structure report the price on line with a
child BoM is inchoerent. Also the sum of all lines in
the report is not always equals to the total of the parent
line.

For the first issue, it happens due to commit 17b625695521b9a1af75e0c10337d0d3076c8fce
that use the number of operation cycle as quantity.
The second issue happens because sometimes the rounding is not done
at the smallest level and thus the rounding of the sum is different than
the sum of the rouding.

* [FIX] snailmail_account: Pass pricing to stamps

Up until now, we'd charge the user in actual curency but we changed the
pricing to 1 creidt=1 letter. in forder to help the user we will change
the name credits to stamps. As 1 letter = 1 stamp.

* [IMP] snailmail: add new error message to help the user

* [FIX] snailmail: avoid spam on user mailbox

the fix merged in cb8bd299fcd8ff48969f4c64279e1cfb49560fdb
was only tackling half the problem. When you assign a user to an
activity, the said user will be notified by email. This also occur if
you change the assignee to the next activity even if you change it to
the same user.

This commit ensures that we only write on the user_id field when we
create the next activity and not during the update.

* [FIX] account: no account in manual move creation

- Activate multi-currency
- Create an Journal Entry manually
- Create a line
  Do not fill Account
  Fill in Amount Currency
  Fill in Currency

A traceback occurs because `line.company_currency_id`.

An extra condition `and line.company_currency_id` is not sufficient to
have the onchange working properly. Indeed, the related field
`company_currency_id` goes through another related field (`company_id`),
leading to an empty value in some cases.

opw-1904854

closes odoo/odoo#28389

* [FIX] sale: use name_search on product search

Before 762adedece1 the search was done on the related field product_id
This was equivalent to make a search on the records order_line.product_id
and to use the name_search of product to find it.

With the filter order_line.product_id.name, it was explicitly searching on the
name of the template

Fixes odoo/odoo#28344

closes odoo/odoo#28390

* [FIX] account: reconcile each account only once when reversing an entry

Before that, when reversing an account.move, if two lines of the move shared the same account, we tried reconciling them once for each line: it worked the first time but triggered an error message the second, since the lines had already been reconciled.

* [FIX] purchase_requision: fix syntax error

payment_term.id, creates a tuple wich works if payment_term.id is set
in case payment_term.id is False this creates the tuple (False,) which
is then converted by the Odoo ORM to a account.payment.term(False, )
record set, which in term may cause weird behaviour as this value does
not eval to false in cases like `if self.payment_term_id:`

Closes odoo/odoo#28397

* [FIX] l10n_fr_hr_payroll: update data

Since commit https://github.com/odoo/odoo/commit/bd5b2c9466eabe56bbb1e91d29a7e422e957550f we removed
the field limit, replacing it by allocation_type.

closes odoo/odoo#28398

* [FIX] web: re-evaluate column_invisible after onchange

Let's assume a form view with field A and B (a one2many list), with
a column with attrs column_invisible depending on A.

If the user sets A manually, everything works fine (the column is
hidden/shown directly). However, if A is updated by an onchange
(e.g. depending on the number of rows in B), it doesn't. This
rev. fixes that issue.

Related to Issue: 1851451

Co-authored-by: Priyanka Kaakdiya <pka@odoo.com>

* [FIX] sale_purchase: disable PO stat button on SO

Creating a service and stockable that create a PO on SO confirmation
(with different suppliers) will indeed work, but the status button
will only display 1 PO. The problem is that stock is not linking
the SO line with the PO line.
Thus, we prefer desactivated the button displaying the wrong value, as
it brings confusion to the user.
A proper bugfix should be done in master, to correctly link SO line with
PO line making the PO count correct.

opw-1905189

closes odoo/odoo#28410

* [FIX] stock: Hide Reserved column in done stage.
Before this commit:
    Reserved column appeared with 0 qty when Delivery Order goes to done Stage
After this commit:
     Hide Reserved column when Delivery Order goes to done stage.

This task is related to #1888361
Closes: #27223

cl…

ddufresne added a commit to Numigi/odoo that referenced this pull request Nov 13, 2018

Update odoo 12.0 (#10)
* [FIX] web: JournalDashboardGraph widgets appear at kanban views updates

closes odoo/odoo#27892

* [FIX] account: Payments on invoices not in date order

Steps to reproduce the bug:

- Create a customer invoice I with an amount of 100$ and validate it
- Register three payments P1 at 11/10, P2 at 12/10 and P3 at 13/10
- Click on button "Print" and the report displays the payments in the right order
P3, P2, P1
- Click on button "Send by email" and click on the attachment with the report

Bug:

The report didn't display the payments in the same order, it displayed P1, P2, P3

opw:1888251

closes odoo/odoo#27895

* [FIX] stock: quantity done not saved on pager

On delivery order, it happens that when it contains more than 40
products and multiple pager. The quantity done are only saved on
the first pager and on the other everythings is reset to 0.
This issue is not deterministic.

The reason is because on the picking view, both stock.move and
stock.move.line are present. When the user write the quantity done
on a stock.move it exists a function inverse that write qty_done on
stock.move.line. However during an onchange, inverse function are not
trigger and every field present in the view is returned to the client.
It means that data after the onchange are inconsistent since the
quantity done write on the move is different than the quantity on the
move line. When the user save the form view, the write could be trigger
in different order. If the write on stock.move is trigger first, it will
write the qty_done with the inverse function but it will be erase by the
write on stock.move.line that is trigger after.

In order to fix it, we set the stock.move.line as readonly when they are
not needed, so they are not send to the server.

closes odoo/odoo#27903

* [FIX] project: wrong context key in task action

In JS, the groupBy attribute is a list of strings

The default_group_by key that is sometimes present in the XML views
gets converted to a list at somepoint.

Before this commit, the task action couldn't be used in the app Dashboard

After this commit, it can

OPW 1894751

closes odoo/odoo#27908

* [FIX] web: avoid object duplicated key

Oversight of previous forward-port

* [FIX] account: adapt test to new report behavior

See 3c4f8533653d49198a73ab650b5aff24106ebdb1

* [FIX] base: Typo in string of default code for server actions

"may be be void" -> "may be void"

closes odoo/odoo#27919

* [FIX] point_of_sale: new table duplicates

Add new tables in POS screen, close the screen and resume the session
again, the tables you created duplicate

closes odoo/odoo#27924

* [IMP] sale_mrp: increase test delta

The test was comparing a scheduled date was correctly computed.
The runbot build 363053 failed because runbot12 is a bit slower and computed
the delay in 2 seconds instead of the 1 previously tolerated.

Increase the delta to 10 seconds.

The delay is a matter of days. Having a difference of 1, 10 or even 100 seconds
should be equivalent functionnaly.

Having a 100 seconds delay could indicate a serious performance issue though...

* [FIX] sale: convert invoice values to the sale order currency

If the invoice is not in the same currency as the sale order, then there was an
inconsistency in the sales report, as it was considered to be the unit currency.
We keep the initial computation in case where the invoice currency is the same.

opw 1890381

closes odoo/odoo#27797

* [FIX] base: display correct ondelete value

The on_delete value on an ir.model.field did not reflect the value set on the
field loaded in the registry

Fixes odoo/odoo#24464

closes odoo/odoo#27906

* [FIX] mail: Emails are sent in reverse order

The CRON job that sends email sends them in a LIFO order instead
of a FIFO order which can lead to confusion when the order is
important.

Exemple, when updating multiple time an appointement, the last
update should be the newest mail clients receive in their mail box
which was not the case before this PR.

opw-1888601

closes odoo/odoo#27888

* [IMP] tests logging

* Make phantomjs logging clearer by logging within the test case's
  module, not odoo.tests.common.

  This way, a tour in e.g. point of sale is clearly logged as that,
  rather than be logged as odoo.tests.common.phantomjs and require
  hunting which module/test we happen to be in.

* Clarify tagging causes for exclusion of selection of tests.

* [REF] tests: replace phantomjs by Chrome headless

As the phantomjs project was suspended[1], there was a need to change the js test
engine. Moreover, the engine was rather old and leading to non
deterministic crashes.

Chrome headless was choosen for simplicity and the long term vision of
the devtools protocol [2].

The 'phantom_js' method still exists but will be deprecated in
favor of 'browser_js' with the same parameters.

In order to communicate with the browser, the python websocket-client package
is needed.

[1] https://github.com/ariya/phantomjs/issues/15344
[2] https://chromedevtools.github.io/devtools-protocol/

closes #25991

* [FIX] tests: avoid traceback when websocket-client is not installed

The account module needs to import Form from "tests.common" causing a
traceback when websocket-client module is not installed.

As this module is only required for the tests, there is no reason to add
it to the "requirements.txt" file.

With this commit, Odoo account can be installed even when
websocket-client is not installed, in that case, the HttpCase tests that
needs to run Chrome headless will be skipped with a warning.

Closes: #26404

* [FIX] tests: clean the browser even on failure

When a Chrome headless test fails the browser is not cleaned and could
lead to a mix with other tests when the same method is called.

Also, the multiline assertions gives an unreadable message when the
assertion fails.
Finally, it happens that a thread does not have an 'url' attribute and lead to a crash when the logger tries to show the thread url.

With this commit, the browser is cleaned, even on failure and the
assertions are now one line.

Closes:  #26432

* [FIX] tests: clean up code

Closes #26467

* [FIX] tests: increase browser_js ready code timeout

Before starting a JS test/tour the _wait_ready method evaluates if the
test is ready with a timeout of 10 sec. From times to times, it happens
that the page is not ready after this timeout but the problem is hidden.

In order to help fixing that kind of issue, the timeout is increased to
60 sec and a warning is logged to emphasis the fact that an
issue exists.

Also some unused imports are removed with this commit

* [FIX] core: use actual chrome/chromium executable on macOs.

* [FIX] tests: properly stop chrome when no tab found

In some situations, Chrome remote debugging is sending an empty list of
opened tabs. In that case, an orphan Chrome process stays alive.

With this commit, Chrome is stopped properly in those situations.

* [FIX] tests: close Chrome and shutdown on SIGXCPU

When Odoo receive a SIGXCPU (CPU time limit reached), it shuts down
immediately. If a headless Chrome is running, it stays alive after the
Odoo shutdown.

With this commit, the signal is intercepeted and the Chrome browser is
properly closed before shutting down the Odoo server.

* [FIX] tests, web_tour: improve js error display in build details
Since chrome headless has been merged, js error messages are
difficult to read: some information was missing or only displayed in
full all log.

All console.error() will now be displayed in build details, and will
appear just before the python assertion.

XMO's improvement will also be used on all log: Using module and
classname of the class calling phantomJS.

Also: some small improvements on error messages to make them easier to read

Note: this commit also shown that some error were not detected:
now we will fail in any case if js log an error.

* [FIX] tests: redirect chrome headless stdout and stderr to dev null

When executing a very long HttpCase browser_js test, it happens that one
of the chrome process PIPE is full (ie. clickEverywhere test).
In that case, the communication with Chrome is blocked.

With this commit the stdout and stderr of the Chrome process are
redirected to /dev/null.

* [FIX] tests: disable screencast when no logfile

When an HttpCase browser_js test is started, the screencast is started
and is discarded at the end of the test if no logfile was provided by
the config.

This behavior can impact the performances.

With this commit, the screencast does not start at all if not needed.

* [FIX] tests: detect coverage and adjust timeout

When computing coverage, the tests are slowed down and the timeout is
often exceeded.

With this commit, HttpCase headless Chrome tests timeout is increased if
coverage is detected.

* [FIX] tests: chromium executable is chromium-browser

When installing chromium using apt
e.g apt install chromium-browser
the executable is `chromium-browser`,
not just `chromium`

* [FIX] tests: web tests, chromium fallback

On Ubuntu, the chromium executable is `chromium-browser`,
On other distributions, such as debian, it's `chromium`.

We therefore add another fallback

* [FIX] base: renaming of x2many fields

* [FIX] stock: do not crash move_lines return a tuple with empty list

Typically if you use an onchange method to retrieve values on the server
and convert them to write it will also try to write empty values like
[(6, 0, [])] and this will crash as it has also the length of 3 but no
dictionary but a list

closes odoo/odoo#27937

* [FIX] add res_company.sequence to base.sql

Seems like something similar to odoo/odoo#17111 can happen on Python 2.
The same change as #17111 is a bit involved for -stable, but this looks
pretty harmless.

Probably fixes #23781.

* [FIX] mail: avoid concurrent update of notifications

When sending notifications by batch one notification email can be send
up to 50 people. For one mail_mail entry to handle 50 emails can be sent
as those are sent independently for each recipient.

In some cases a bounce may occur while the whole batch of recipients is
not completely mailed. In that case the mailgateway will update the
notification status to bounced. When the cron finishes to send the whole
batch of emails it tries to update the notifications of all recipients.
However as a notification has already been updated due to the bounce we
face a concurrent update, meaning the transaction is rollbacked.

Emails have been sent but notifications are not considered as sent as they
have not been updated accordingly. Next time the cron runs it will send the
same batch again, with probably the same bounce and rollback. We could
therefore face an email loop.

This commit add test for this use case.

This commit is linked to task ID 1893054.

* [FIX] stock: free reservation over reserve

Usecase to reproduce:
- 6 units in stock
- reserve 3 units on a move
- reserve 3 units on another move
- validate a third move with 1 unit

It raise the error could not reserve more than you have in stock.
It happens because when free reservation stole reservation from
an exisiting move with too much quantity available, it continues the
loop instead of stopping.

This commit stop the loop once we have enough quantity taken.

opw-1895578

closes odoo/odoo#27935

* [FIX] web: correct attribute name

Oversight of previous forward-port.

* [FIX] web: re-introduce on_change="0" to prevent onchanges for customization

In 10.0, adding on_change="0" allowed to prevent
default onchanges to occur for the field on which was added this attribute.

In 11.0, the rev. eaa66d11568b415b8d6b4c7a17a058b5ec1df4a6
added a regression by removing this possibility.
It was an oversight, it was not an expected change
in the web client.

In 10.0, it's this line which bring this possibility:
https://github.com/odoo/odoo/commit/e8a00bc50da435d3859118ca127d20a2eb9a0cab#diff-ff0e90fb0eb4418a7f66e618e4b51323R444

opw-1883366

closes odoo/odoo#27952

* [FIX] web: kanban quick create properly disabled

when grouped on field types for which it isn't supported.

Rev. 42e1efd disabled the quick create feature when the view is
grouped by date(time) fields. However, it hasn't been correctly
forwardported to 11.0 (with the new views). Indeed, the check was
done only once, at the initilization of the view. So if the user
selected another field to group by afterwards, the quick create
feature wasn't enabled/disabled accordingly.

Moreover, we didn't check if it was available when the user clicked
on CREATE in the control panel. So even if it wasn't (and thus if
there were no '+' icon in the columns), when the user clicked on
CREATE, the quick create widget was inserted in the first column.

This rev. fixes both issues.

Task 1878254

closes odoo/odoo#27867

* [FIX] website: restore options active system for carousel

* [FIX] web_editor: review _setActive system for select-class

- Handle the case where one select-class is a subset of another
  select-class of the same group e.g.

  <... data-select-class="hello"/>
  <... data-select-class="hello world"/>

- Handle empty values <... data-select-class=""/>

Note: both cases worked but were not displaying the active checkbox
correctly in the editor UI.

* [FIX] web_editor: fix background reset system for carousel items

When the user previews a background color, the background image of the
snippet is removed and re-added if the user chooses not to pick the
color. The background-image was not correctly added for carousel items.

* [FIX] web: kanban quick create with correct default values

When a kanban view is grouped by a char or a boolean field, and the
quick create option is enabled, the correct default value for the
grouped field (i.e. the value of the column in which the record is
created) should be given (either in the context if that field isn't
in the quick create form view, or as a default value in that form
view otherwise).

Before this rev., it wasn't the case, as it was only working when
grouped by a many2one field.

Task 1878254

* [FIX] web: kanban quick create when grouped by selection

Rev. 42e1efded5 aimed to disable the quick create feature when
grouped by date(time) fields, by only enabling it for char, boolean
and many2one fields. However, the selection case is quite important
and must be handled as well. This is what this rev. does.

Task 1878254

* [CLA] signature for mhamra

closes odoo/odoo#27943

* [FIX] web_editor: disable strange resize handles on Firefox

See comments in the code for details...

Closes https://github.com/odoo/odoo/pull/27964

* [IMP] account: Trigger a validation error when trying to set the same currency on a journal as on its parent company.

Until v12, doing this is wrong. The currency_id field of account.journal should only be used if the journal is in a different currency. Otherwise, this field should stay empty.

//NOTE FOR FORWARD-PORT: this commit should not be ported to 12.0 and further.

* [FIX] website: Add onchange language_ids on website model

On res.config.settings for website, when removing a language from language_ids, if this language is defined as default_lang_id, the default language will be updated by an onchange to prevent any inconsistency.
The same should happen when doing this directly on the form view of a website record.

closes odoo/odoo#27727

* [FIX] test_mail: bump query count margin

Needed to make test pass with `mail_push` (enterprise module) installed.

* [FIX] purchase_requisition: traceback on validate

The subsequent code strongly suggests that pick_in can be None,
however, the raise_if_not_found has not been set properly.

closes odoo/odoo#27397

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [FIX] hr_expense: correct group xmlid

* [FIX] website_sale: set user_id of newly created partners to the website salesperson

When an unlogger user places an order, a new partner is created on the fly when
the unlogged user is asked to place his delivery address.
The values he enters on the form are processed before being used.
In particular the team_id is taken from the order (typically website_sale team).
We add to the new values the salesperson id.
This value is then used in onchange_partner_id to update the order's user_id.

opw 1889510

closes odoo/odoo#28030

* [FIX] mail: faster blacklist search

For the special case of is_blacklisted, and due to
the size of the tablers to handle, it's faster to
filter some records rather than searching the whole
res.partner table

closes odoo/odoo#28028

* [FIX] web: trim tooltip text before comparison

The error is triggered at least on Chrome 69 on macOS.

* [FIX] base: change DOP currency symbol position

closes odoo/odoo#28040

* [FIX] base: set correct time format for es_DO

In Dominican Republic, only english speakers and the military use 24h time
format. Businesses handle their information using 12h time format with a.m.
and p.m.

closes odoo/odoo#28042

* [FIX] doc: building on Python 3.6.7, 3.7.1, possibly 2.7.???

https://bugs.python.org/issue33899

tokenize.generate_tokens was altered to match the C tokenizer,
previously it would end the tokenization with just an ENDMARKER, in the
titled releases it adds a NEWLINE before the ENDMARKER if none is
present, this broke the parsing of jsdoc type specifications as Python's
tokenizer is used under the cover.

closes odoo/odoo#28056

* [FIX] point_of_sale: Button spamming create duplicates

Spamming the save button when creating a new custommer in point-
of-sale create duplicate users. This PR disable the button once
clicked and re-enable it when all the processing is done.

opw-1895302

close #23919

* [FIX] calendar: all day event shouldn't store in UTC

With a user in a distant timezone, like UTC +/- 11

Create a all day event.

Before this commit, the event was displayed across the wrong days
This was because the dates were converted from the user's timezone
into UTC before being stored.

Which is:
- start date at december, 12
- if the user's tz is utc-11: the date becomes december, 11 (at 1:00pm)
- at rendering, it becomes december, 11 (at 7:00am)

After this commit, we store the datetime field "as if" it were a date field
that is, we don't convert it to any particular tz

It is worth noting that, if one removes the allday mapping in the xml view,
an event that has been created as allday will get its start and stop date converted
to the browser's timezone, and will NOT be displayed as from 8am to 8pm as one could expect
This is considered as a limitation of the code, that was present before this commit anyway.

In any case, please do not revert this commit :D

OPW 1891110

closes odoo/odoo#27949

* [FIX] web: rpc queries should always be shorted out when the widget is destroyed

* [FIX] doc: do not duplicate header

And use tabs instead of spaces
Otherwise it looks for the file named "__manifest__.py 2014-..."

* [FIX] website_sale: prevent other sessions to crash after checkout

Before this commit:
If an user has multiple session on a database (eg: he is connected both on his
smartphone and his laptop on the ecommerce), and there is a cart in these
session, confirming the cart on one of the session will make other sessions
unable to use the checkout anymore.

This is because other sessions will still contains the Sale Order that is now
'sent' and updating the cart will raise an error:
`It is forbidden to modify a sales order which is not in draft status.`

Now:
If the SO to be updated is not in `draft` anymore, we create a new one.

Step to reproduce:
  - Login on ecommerce from device A
  - Add product in cart, the SO will be added on session
  - Login on ecommerce from device B
  - Pay the cart (it will retrieve the SO from device A)
  - At that point, the cart is paid and the SO is removed from session on
    device B but other devices won't be able to use the checkout anymore
    as they still have the SO in session which is in `sent` state.
    Thus, any action on cart will raise the error

Note:
1. We can't implement that behavior in `sale_get_order()` as it is supposed to
   return SO in `sent` state after checkout.
2. We can't implement that behavior in `_cart_update()` as it is inherited in
   some module. Thus, implementing that behavior in `cart_update()` would change
   `self = order` but inherited methods would still have initial `self`.
3. Implementing the behavior in the controller it is already done (differently)
   in `cart_update_json()`.

Fixes #27508, closes #27794

* [FIX] calendar: recurring event around DST

Be in timezone Europe/Brussels, where, in 2018, the DST switch
happens on 2018-10-28.

Create a recurring event starting on 2018-10-27 until 2018-10-29
at say, 8am

For the days before the 28, the time of the event will be correct

Before this commit though, for the days after the 28,
the meeting time will be shifted by one hour
This is because the rrule took a TZ aware datetime, and generated recurring
event dates with that same TZ, i.e. the one in STD time

After, this commit, all the meetings are well scheduled at 8am,

OPW 1895315

closes odoo/odoo#27985

* [FIX] project: template render attachments sudo

Related issue odoo/odoo#27256
use case is in there

Retrieving the access token for an attachment should be done as sudo
Also, we adapt the code to the method, which appears to be "api.one" (lol)

OPW 1888873

closes odoo/odoo#28074

* [FIX] doc: correct reference to the line in the file

Introduced at 94e82753acc36

* [FIX] doc: backport of 9a07a4599ce to 10.0

To be compatible with sphinx >= 1.6

* [FIX] doc: backport of ac37ca39eaf to 10.0

To be compatible with sphinx >= 1.8

* [FIX] models: use expected parameter type

set_failed function expects an iterable object
Introduced at 32a58c0db3c0

Fixes odoo/odoo#27744

closes odoo/odoo#27911

* [FIX] migration: use correct migration prefix in docstring

Migration files must contain `-` in its name for being executed

* [FIX] mrp_bom_cost: bom cost / bom quantity

Use case to reproduce:
- create a BoM of 50 finished products:
- Add a routing with an operation time of 1h
- Set a 1$/h cost on workcenter
- Set unit price from BoM

It will be 1$ for one product. It should be 0.02$
since it will take 1h for 50 products, so the price
should be 1/50

It happens because the system add the operation time by unit instead
of adding it only once.

related to commit 17b625695521b9a1af75e0c10337d0d3076c8fce

opw-1890005

* [FIX] delivery: wrong currency conversion

In a multi-currency company, the delivery price of a quotation was
wrongly converted when the currency used by the pricelist was not
the same as the currency used by the company.

This PR correct that behavior by correcly compute the delivery
price according to the pricelist currency.

To reproduce:
1) Install the accounting, sales and delivery modules
2) Set the company as a multi-currency company in the accounting
   settings
3) Change the currency rate so the one used by the company is 1
   and the other one (the one that will be used on the pricelist)
   is anything else than 1
4) Create a pricelist with that other currency
5) Create a quotation using the new pricelist, select a deliver
6) Click "Set Price", the delivery price shown on the form isn't
   the same as the price on the quotation.

opw-1894422

* [FIX] mrp: remove useless upgrade boolean

The option enables a group, it does not install an enterprise module
Introduced at 85ed6a31a2

Fixes odoo/odoo#28080
Closes odoo/odoo#28081

* [FIX] account: don't enforce test journal currency

It was causing some tests failure due to 22f0da809e84618901b7ca4b78582abd64c03c55

* [FIX] base: don't ignore new uninstallable modules

When updating the module list (`ir.module.module.update_list()`), new
modules that are not installable were ignored.
This behavior was not consistent with the database initialization [1]
which creates all modules.

[1] https://github.com/odoo/odoo/blob/5d932e5db164fe80fd7c011ddd53f3494ef89ef5/odoo/modules/db.py#L51-L54

* [FIX] cli: fix broken link

The master file no longer exists

Closes odoo/odoo#26623

* [FIX] mail: set default _rec_name to avoid showing model with id

closes odoo/odoo#27186

* [CLA] signature for AnilKesariya

Closes odoo/odoo#27024

* [FIX] account,sale_timesheet: don't enforce test journal currency

It was causing some tests failure due to 22f0da809e84618901b7ca4b78582abd64c03c55

* [CLA] signature for Ark74

Closes #28126

* [FIX] stock: add note field

Commit 37d20240a9e85c2a79fae62dc5b8d869fe40549d reintroduce lost note
field but not in a clean way.
This commit put the field in a proper tab.

Task : 1896143

closes odoo/odoo#28026

* [I18N] Update translation terms from Transifex

* [FIX] stock: run scheduler on partially available moves

1. Product A - on stock 5 pcs.
2. SO - 7 pcs. of A
3. Generated picking has reserved 5 pcs.
4. Increase stock to 7 pcs. (Update qty on Hand)
5. Run procurement scheduler
6. Picking still has reserved 5 pcs.

The scheduler should take into account the moves partially available.

Fixes #27874

opw-1895622

closes odoo/odoo#28136

* [FIX] doc: translator under Sphinx 1.5

In Sphinx 1.5 (fairly specifically), the warner thing takes a `type` kw,
and building the doc blows up if that parameter is not provided.

* [P3] payment_stripe: Exception.message removed

Apparently missed in 07ab8b6cd2b44aeb91dadc35adf5f4b19f1399b2

In Python 3, there is no Exception.message attribute anymore, this would
lead to cascading exceptions in the stripe_s2s_create handler.

closes odoo/odoo#28141

* [FIX] point_of_sale: IoT https in pos

before this fix it was not possible to connect to the pos/iot-box using
https on the pos. By checking if the pos is http or https this is now
possible after accepting the certificate.
if https scanning for proxy is disabled, the user should always give a
    ip in the configuration

* [FIX] hr_attendance: allow multiple attendances

If the search returns more than one result, the rendering of the message would
crash (SingletonError when accessing check_in field value).

Use the same order and limit as both search before and after

Courtesy of David Tran

Closes odoo/odoo#28055

* [FIX] point_of_sale: alignment note textarea

before fix:
in firefox the textarea of note modal has a overflow
textarea can be expanded outside borders modal in all browsers

closes #25199
closes #25215

issue 1895298

* [FIX] mrp: unbuild of tracked products

- Create 2 Products A and B, tracked by serial number
- Create a BOM for A:
  1 Unit of B
- Create a MO for 2 Units of A
- Validate:
  Product with S/N A1 consumes B1
  Product with S/N A2 consumes B2
- Unbuild A2

If A1 was created before A2, B1 will used as a component of A2 at
unbuild.

When going through the stock move lines, we don't verify that the lot
produced matches the lot we unbuild.

opw-1889002

closes odoo/odoo#28154

* [FIX] mrp: workorders of sub-BOMs

- Create the following BOM structure:
```
  Prod 1 (Manufacture)
  |
  --- Prod 2
      Prod 3 (Kit)
      |
      --- Prod 4
	  Prod 5
```
- The BOMs for Prod 1 & 3 must have a routing set, to generate
  workorders
- Create a MO for 1 unit of Prod 1, process to the end

2 units of Prod 1 are created instead of 1.

This is due to the WO for Prod 3 not having a `next_work_order_id`.
Therefore, `record_production` adds an extra quantity at:
```
production_move.quantity_done += self.qty_producing
```

To prevent this, we set as `next_work_order_id` of the BOM of Prod 3 the
WO of Prod 1.

Closes #19527
opw-1817398
opw-1883693

* [FIX] tests: avoid remaining requests

From times to times, warning are seen on the runbot during HttpCase
tests with the chrome headless browser.

Those warning are about Odoo trying to join remaining requests threads.
In the dumpstack, the thread seems blocked in the werkzeug
handle_one_request method, when trying to read the HTTP request line.

One explanation could be that Chrome opens a pre-connect socket for
a future use. When the HttpTest cleans the browser, the page stops
loading but (probably) keeps the socket open for a while.

That could explain the problem.

With this commit, a timeout is set on the request handler,
in the hope that it closes the pre-connect socket too.

* [FIX] purchase: fix anglosaxon valuation

Before that, when receiving, then invoicing with price diff, the value in interim account corresponded to the price on the invoice instead of the original valuation one.

Scenario to reproduce the issue:

* create PO with 1 product, FIFO valuation, price=10
* receive PO: the entry in stock interim account has debit=credit=10
* create invoice, with price=15 instead of 10
* the invoice entry should be: payable: C=15 ; price diff: D=5 ; interim account: D=10
  ==> Instead, we had payable: C=20 ; price diff: D=5 ; interim account: D=15 => this was wrong

Also added a test case for the same scenario, verifying the amounts written in the different accounts (and refactored a bit ValuationReconciliationTestCase for easiness)

Closes #27394

* [FIX] web: typo in docstring

The parameter would not be correctly detected by doc extractors

closes odoo/odoo#28169

* [FIX] tests: remove chrome sandboxing

It appears that chrome headless with sandboxing is failing when running
containerized because it tries to use Linux namespaces.

With this commit, the no-sanbox optional arg is used to avoid this
issue.

Closes #26456
Closes #28053

* [FIX] mail: spam the send button create multiple messages

Spamming the "send" button on the chatter send multiple times the
same message. This PR simply disable the send button to fordib the
spam.

opw-1895511

closes #27233

closes odoo/odoo#28078

* [FIX] mail: display both tracking values and body of the messages in mail thread

Before that, the body of the message was never displayed if the message had tracking values. This was annoying for account_asset module, were we prompt the user for some justification when she modifies the depreciation data of an asset, and then call message_post with this text as body, and tracking values reflecting the change that was made.

* [FIX] web_editor: fix forward-port

Forward-port of https://github.com/odoo/odoo/commit/227fc6408ddc998529bb1c38222ddba50f40868b
made with https://github.com/odoo/odoo/commit/717f4583949219c346c87c390fbc336b4f31571c
introduced a JS error.

closes odoo/odoo#28187

* [CLA] signature for Brahoo

Backport to 11.0 of #28161

* [FIX] base_vat_autocomplete: add missing attrs

VAT number should be readonly when parent_id is set
This is already what is done in base.view_partner_form and
base.view_partner_short_form

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* (FIX] account: Impossible to make a partial credit note

Steps to reproduce the bug:

- Create a credit note for an amount of 100$
- Validate it and register a payment
- Let's pay an amount of 90$ and mark this credit note as fully paid

Bug:

An error message was raised saying: Wrong credit or debit value in accounting entry !

The field residual_company_signed must be positive for out_invoice and in_refund and
negative for in_invoice and out_refund. In this way, the correct writeoff amount
can be computed in function _create_payment_entry.

PS: In function _compute_payment_amount, the field residual_signed and residual_company_signed
are already signed, that's why it was wrong to multiply a second time on it with MAP_INVOICE_TYPE_PAYMENT_SIGN

opw:1893570

closes odoo/odoo#28148

* [IMP] sale: add testcase for fix 7bee068a0

The bug has been fixed meanwhile, but this one adds a testcase, so
it's worth merging it.

Task #1871444

* [FIX] website_links: do not require flash to copy text to clipboard

The "copy link" to clipboard button ancestrally used a flash (.swf) dependency
(ZeroClipboard) to work.
Since Odoo honours its history, it was still there.
However on Firefox you are asked to activate flash to make it work,
and on Chrome nothing happens.
We get rid of this shibboleth, using instead clipboard.js that is already used
elswhere for the same purpose.

closes #27958
opw 1896509

* [FIX] base: subscribe new API onchange methods for module fields

Adapt the code to use the new API for onchange methods.  This fixes onchanges
for version 11.0, since support of old-API onchange is actually gone.

* [FIX] mail: mark as read only when accessing to chatter

Backport of 17bb0ca443f54bc231b03794e776bbc6992ffdfa

Before this commit, the user could not receive any notification
from the chatter of a document when having Notification Management
set to "Handle with Odoo".

This problem occurs when the user opens (or has opened) the document.
Any messages received from the document are automatically marked
as read, so it removes the notification right after receiving it.

In order to no longer have this issue, the user had to reload all
pages that have opened this document.

This commit slightly changes the behaviour of the chatter, so that
it automatically marks it as read only when accessing the document,
but not when the document is open (or has been opened). Consequently,
if the user has opened the document and then receives a notification
from this document, it won't automatically mark it as read.

Task-ID 1895359

opw-1890556

closes odoo/odoo#28113

* [FIX] web: creating a record in a grouped empty kanban view crash

When creating a record in a grouped kanban view, it tries to add
the record to the first column but if no column exist, it fails
to find the first one and raise an exception.

This PR correct that bevahior by checking it exists a column and
fallback to the view form when it does not.

opw-1902851

closes odoo/odoo#28262

* [FIX] mail: adapt forward-ported test

* [FIX] web: consider correct viewtype when loading data

Before this commit, when loading the data and calling the prostprocess,
the viewType was not correctly passed which could lead to broken
behaviour. For example, if one was to load a record from a list view
embedded in a form view, the viewtype passed was the list which
prevented to load the data from the form view.

OPW 1891295

closes odoo/odoo#28279

* [FIX] website_sale_delivery: allow hook at price update

A hook is necessary for a price update when TaxCloud is used.

opw-1894511

closes odoo/odoo#28281

* [IMP] iap: Update documentation with new functionalities

closes odoo/odoo#28282

* [FIX] website_sale: priority for non default view

Set a higher priority to avoid a view to become a default one,
just because his ID is lower than the expected default one.

closes odoo/odoo#28287

* [IMP] l10n_ch: also detect postal account type when using the shorten form with -

This shorten form is aa-bbb-x. The a characters are the first two digits of the number, x is the mod10r verification digit, and b characters consist of all the intermediate digits, without the leading 0s. The chain of b characters' length can range between 1 and 6 characters.

* [IMP] l10n_vn: fix syntax and allow reconcilation

for accounts 3341, 3348, 141, 1388, 3388

* [FIX] l10n_ro: fix xml syntax

* [FIX] account_budget: properly calculate percentage sum in read_group

The percentage field is computed in _compute_percentage as a value
between 0 and 1. This is good because that's what widget="percentage"
in views expects.

This makes read_group also return a value between 0 and 1, instead of
0 and 100. Otherwise list views will show e.g. 5000% when grouping
lines that sum to 50%.

Introduced in saas-11.4 at odoo/odoo@9148960174bdb0abbee6a5b7403a8f.

*Do not forward port, already ported to 12.0 via
 odoo/enterprise#2975 (odoo/enterprise@a1484e650cb013f35755d)*

opw-1904481

* [FIX] reqs: bump up recommended `requests` version

In light of CVE-2018-18074, using python-requests 2.20.0 is recommended,
or any distribution-specific version that was patched.

See also https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-18074

* [FIX] stock: Wrong production/scrap/adjustment location used in multicompany

- When using perpetual inventory valuation, the accounts used for scrap, manufacturing,
and inventory adjustment operations are set on the corresponding locations .
- In a multicompany environment, you will have a separate chart of accounts for each company.
- Account fields on locations are not property fields.
- Therefore, in order to separate the accounting of manufacturing, scrap, and inventory
adjustment operations, you must use a location for each operation for each company.
- Set up one location for each company for scrap, production, and adjustment
locations, setting the company field on each.

Bug:
- When attempting to create a MO, inventory adjustment, or scrap order while signed
in to the second company, you will receive a permissions error on stock.location.

Fix:
- Now the right location is taken according to the company of the user.

Backport of this commit: c7526407ab4cf4c3d338f50a0259ac803e89f91f

opw:1817339

* [FIX] web: reload many2one data if the context has changed

When a view is loaded, it checks which fields it has to load.
In the case of a many2one, it could be the case that a context key is present in
one view and not in the other; if it happens, we should reload the data, as a
name_get result could vary.

opw 1891295

closes odoo/odoo#28298

* [FIX] web: remove debug in timezone_mismatch test

Before this commit, a blank page was shown when tests
were running in /web/tests.

closes odoo/odoo#28319

* [FIX] hr_attendance : kiosk mode multi scanning

- Scan a barcode for employee 1 in kiosk mode
- At greetings message, scan a barcode for employee 2

2 attendance entries are created for employee 2 instead of 1.

When scanning the barcode for employee 2, the event listener
`_onBarcodeScanned` is still active on `KioskMode`. Therefore, the RPC
call to `attendance_scan` is performed twice.

We deactivate the event listener after scanning, and reactivate on
`KioskMode` only if there is an issue. This is sufficient since the call
to `do_action` in `GreetingMessage` will create another instance of the
client action. In `GreetingMessage`, we add back the redirection to
`KioskMode`.

Co-authored-by: Nicolas Martinelli <nim@odoo.com>

Linked to Task ID 1878251
opw-1878632
opw-1888402

closes odoo/odoo#28150

* Revert "(FIX] account: Impossible to make a partial credit note"

This reverts commit bb939ffac0c8222a4b34523b739b64173f2258f8.

closes odoo/odoo#28321

* [FIX] hw_blackbox_be: grep mac address

In the previous debian version, the output of ifconfig was:
ifconfig eth0   Link encap:Ethernet HWaddr b8:27:eb:d6:03:8d

now is
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b8:27:eb:d6:03:8d  txqueuelen 1000  (Ethernet)

closes odoo/odoo#28320

* [FIX] partner_autocomplete : Do not crash other tests when partner_autocomplete server fails

Add a check to see if we're in test mode that returns an InsufficientCreditError to avoid failing other tests if partner_autocomplete server fails

closes odoo/odoo#28324

* [FIX] bus: never GC during requests

Running the bus garbage collector synchronously during the handling of a
request can stall the request for a very long time.

Instead, we add this step to the existing auto-vacuum scheduled job that
handles this kind of housecleaning. It brings another interesting bonus:
it can be scheduled outside of peak hours, which will avoid blocking other
bus-related transactions (the GC deletes a lot of rows and takes a lot
of exclusive locks in the database)

closes odoo/odoo#28326

* [I18N] Update translation terms from Transifex

* [FIX] account_check_printing: allow users to configure check layout

52a8ed3c0c made related fields readonly by default. 3f4f77fd9d
attempted to identify all fields that needed readonly=False but missed
this one.

closes odoo/odoo#28343

* [FIX] mail: access error when reading a channel

When a record inaccessible by the user is linked
to a message in a channel accessible to the user,
Avoid to raise an access error due to this linked record.

Also need an aditional query in test query_count.

closes odoo/odoo#28312

* [IMP] crm: search lead on name

closes odoo/odoo#28350

* [I18N] clean es_MX old translations

Only keep the useful ones

closes odoo/odoo#28351

* [FIX] website_sale_options: prevent other session crash after checkout

Check commit https://github.com/odoo/odoo/commit/ef48b81ab127dd717a4a9d106edd5c51121bc8f7

This commit is doing the same for website_sale_option as the optional product
is calling another route to add the product to the cart.
That route needed to be fixed too.

Closes #28209, related to #27508

* [FIX] website_sale: reset cart if checkout was done in another session

This commit extend commit https://github.com/odoo/odoo/commit/ef48b81ab127dd717a4a9d106edd5c51121bc8f7
When you have a cart on multiple session and confirm the card in one of them,
you could still access your cart from other session (note that you could not do
anything with it as it would be reset when adding product or changing qty).

Closes #28210

* [FIX] web_unsplash: wrong doc links

Doc links were created before the doc, then the doc was merged under a
different URL.

This commit corrects the links to the Unsplash documentation.

closes odoo/odoo#28355

* [FIX] hr_attendance: multiple scans

- Open the Attendance kiosk mode
- Scan an incorrect barcode

It's not possible to scan any barcode anymore.

If the barcode is incorrect, we need to add back the event listener.
Moreover, the RPC introduced with bbc7e9586d440c4bd is not necessary if
we retrieve the barcode thanks to the existing RPC call.

opw-1878632
opw-1888402

closes odoo/odoo#28354

* [FIX] server: always consume wakeup bytes from signals

Due to the implementation of PEP-475[1] in Python 3.5, revision
e98e8e9b1bdf8c3a3bcf74b7648b0829c21d356a used the recommended technique
of wakeup file descriptors in order to detect interruption of sleep() and
select() by signals, when running in multi-process mode (workers > 0).

The technique works well, however the initial patch never bothered to
read the byte that is written to the wakeup pipe when a signal is
processed. This does not matter when the signal is meant to shut down
the server, but it matters when the signal is SIGQUIT: it simply prints
thread dumps, and continues operating normally.
As a consequence, that byte remains in the wakeup pipe forever, causing
all the subsequent select/sleep calls to return immediately because
the wakeup fd *is* already ready. The symptom was that worker
processes would start cycling their main run loop very fast after
receiving a SIGQUIT signal, eating 100% CPU.

This patch ensures we always empty the wakeup pipe after an interruptible
call, to avoid this effect. It also refactors another occurrence of the
"empty pipe" pattern, in the PreforkServer, and incidentally uses readable
aliases for the file descriptors bound to the ends of the wakeup pipe
(wakeup_fd_r / wakeup_fd_w).

[1] https://www.python.org/dev/peps/pep-0475

closes odoo/odoo#28356

* [FIX] mail: add index on `message_main_attachment_id`

- When deleting attachments, the foreign key constraints on
  `message_main_attachment_id` are triggered which could take
  a lot of time to be computed.

closes odoo/odoo#28358

* [FIX] product: respect received args value instead of overriding it (#26594)

When doing a name_search, if a current search is already specified through args,
do not replace it

Closes #26594

* [FIX] sale_timesheet: UOM

Revert commits da2140b72678b, e65c8826ef9969 and 06cd145a79f023c. They
introduce an incorrect UOM.

The original issue was an `AccessError` due to the fact that the
employee chosen was not in the same company than the user. Therefore,
instead of changing the logic of the UOM selection, we make sure to
select the employee in the appropriate company first, then fall back on
any company then.

opw-1888299

* [FIX] gamification: correct mail template on small challenges

A challenge with less than 3 participants was failing with a key error
The challenge line has only one 'goal' result per participant

As the template is set in a noupdate, even a module update does not fix the bug
Generate fake goals that will be displayed in the top 3, e.g.:
1 Bob	 $100 42%
2 Alice	 $50  21%
3 	 0    0%

closes odoo/odoo#28363

* [FIX] lunch: correct default filter

Renaming a filter in search view require to
rename it also in context of actions

closes odoo/odoo#28366

* [FIX] account: apply correct currency rate for taxes at account move creation

Before that, taxes were only applied with the most recent currency rate, which caused problems in multi currencies, when reconciling statement lines made in the past with invoices, causing the amount currencies in the payment account.move to be wrong.

//Scenario to reproduce the issue (from customer ticket 1903497):

(for a company with USD as base currency)

1. Create a new bank journal for EUR payments

2. Create a new customer invoice for 90€

3. Create a new tax for the reconciliation model, price-included and amounting to 15%

4. Create a new reconciliation model using this tax

5. Use the currency rates from the demo data, add one that is closer to current date than the most recent one.

6. Create a new bank statement for the created EUR bank journal. Make sure that the transaction is less than the actual amount due on the invoice so that we can apply the reconciliation model. Also make sure to set a date on the transaction that lies in the past at some point when the currency rate was (significantly) different.

7. Hit the reconcile button, select the amount due from the invoice and apply the discount reconciliation model(take note of the amount on the created tax move line). Now reconcile.

What is the current behavior that you observe?

Now go back to the bank statement and check the created journal entries. You will see a difference in the amount currency values of the payment and the tax account move line. This difference should not exist.

* [FIX] website: review action start on page loading

This commit fixes a bug introduced with https://github.com/odoo/odoo/pull/28251:
When opening the ace editor on page load thanks to the #ace-view-editor
URL hash, a JS error occurred preventing the editor to open.

This was due to the way actions were executed on page loading:
- Menu elements are initialized and can handle actions
- On initialization, the ace menu tried to launch the editor
- First, it asked that all widgets are closed (see mentioned PR)
- The website handled that action demand by asking everyone to close
  their widget
- The 'new content' menu tried... and failed as referenced a variable
  which would only have been created in the start method.

Conclusion: before handling actions, all action-capable widgets should
be started. This is what this commit does: when receiving an action
demand, we first wait for the action handler to be fully started. This
implied another change: before, many menus were waiting for the result
of an action to notify that their start method is finished... this
would cause a deadlock in the new system so those were removed, this did
not make much sense anyway (if the result of that starting action has to
be known, a dedicated event/method should handle that).

closes odoo/odoo#28364

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [I18N] Update translation terms from Transifex

* [FIX] stock: Cannot add company to push/pull rules

When creating a rule, the company of the route must be taken when
the route has a company.

opw:1903996

closes odoo/odoo#28387

* Revert "[IMP] account: Trigger a validation error when trying to set the same currency on a journal as on its parent company."

This commit shouldn't have been forward-ported to this branch.

This reverts commit 22f0da809e84618901b7ca4b78582abd64c03c55.

* [FIX] mrp: subproduct price + rounding

On the BoM structure report the price on line with a
child BoM is inchoerent. Also the sum of all lines in
the report is not always equals to the total of the parent
line.

For the first issue, it happens due to commit 17b625695521b9a1af75e0c10337d0d3076c8fce
that use the number of operation cycle as quantity.
The second issue happens because sometimes the rounding is not done
at the smallest level and thus the rounding of the sum is different than
the sum of the rouding.

* [FIX] snailmail_account: Pass pricing to stamps

Up until now, we'd charge the user in actual curency but we changed the
pricing to 1 creidt=1 letter. in forder to help the user we will change
the name credits to stamps. As 1 letter = 1 stamp.

* [IMP] snailmail: add new error message to help the user

* [FIX] snailmail: avoid spam on user mailbox

the fix merged in cb8bd299fcd8ff48969f4c64279e1cfb49560fdb
was only tackling half the problem. When you assign a user to an
activity, the said user will be notified by email. This also occur if
you change the assignee to the next activity even if you change it to
the same user.

This commit ensures that we only write on the user_id field when we
create the next activity and not during the update.

* [FIX] account: no account in manual move creation

- Activate multi-currency
- Create an Journal Entry manually
- Create a line
  Do not fill Account
  Fill in Amount Currency
  Fill in Currency

A traceback occurs because `line.company_currency_id`.

An extra condition `and line.company_currency_id` is not sufficient to
have the onchange working properly. Indeed, the related field
`company_currency_id` goes through another related field (`company_id`),
leading to an empty value in some cases.

opw-1904854

closes odoo/odoo#28389

* [FIX] sale: use name_search on product search

Before 762adedece1 the search was done on the related field product_id
This was equivalent to make a search on the records order_line.product_id
and to use the name_search of product to find it.

With the filter order_line.product_id.name, it was explicitly searching on the
name of the template

Fixes odoo/odoo#28344

closes odoo/odoo#28390

* [FIX] account: reconcile each account only once when reversing an entry

Before that, when reversing an account.move, if two lines of the move shared the same account, we tried reconciling them once for each line: it worked the first time but triggered an error message the second, since the lines had already been reconciled.

* [FIX] purchase_requision: fix syntax error

payment_term.id, creates a tuple wich works if payment_term.id is set
in case payment_term.id is False this creates the tuple (False,) which
is then converted by the Odoo ORM to a account.payment.term(False, )
record set, which in term may cause weird behaviour as this value does
not eval to false in cases like `if self.payment_term_id:`

Closes odoo/odoo#28397

* [FIX] l10n_fr_hr_payroll: update data

Since commit https://github.com/odoo/odoo/commit/bd5b2c9466eabe56bbb1e91d29a7e422e957550f we removed
the field limit, replacing it by allocation_type.

closes odoo/odoo#28398

* [FIX] web: re-evaluate column_invisible after onchange

Let's assume a form view with field A and B (a one2many list), with
a column with attrs column_invisible depending on A.

If the user sets A manually, everything works fine (the column is
hidden/shown directly). However, if A is updated by an onchange
(e.g. depending on the number of rows in B), it doesn't. This
rev. fixes that issue.

Related to Issue: 1851451

Co-authored-by: Priyanka Kaakdiya <pka@odoo.com>

* [FIX] sale_purchase: disable PO stat button on SO

Creating a service and stockable that create a PO on SO confirmation
(with different suppliers) will indeed work, but the status button
will only display 1 PO. The problem is that stock is not linking
the SO line with the PO line.
Thus, we prefer desactivated the button displaying the wrong value, as
it brings confusion to the user.
A proper bugfix should be done in master, to correctly link SO line with
PO line making the PO count correct.

opw-1905189

closes odoo/odoo#28410

* [FIX] stock: Hide Reserved column in done stage.
Before this commit:
    Reserved column appeared with 0 qty when Delivery Order goes to done Stage
After this commit:
     Hide Reserved column when Delivery Order goes to done stage.

This task is related to #1888361
Closes: #27223

closes odoo/odoo#28409

* [FIX] sale: 'My Quotations' default filter

The filter should not filter on the state.

opw-1906405

closes odoo/odoo#28406

* [FIX] mass_mailing : restore import mass_mailing.contact into mass_mailing.list

Since the opt out per mailing list, the intermediate model was used
to list all the recipient of a mailing list. The side effect was that
importing new contacts into mailing list was not possible anymore.
Also, creation of a new contact into a mailing list was made indirectly
by creating a new many2many record between contaxct and list, which was
not really user friendly.

This commit restores the mailing contact model as the view of the mailing
list recipients. In other terms, the contact import is restored.
An opt-out computed field as been added to be able to filter on opted out
contact inside the mailing list recipients view.
This opt_out field SHOULD NOT be used in a form view as it need the active
mailing list id in the context in order to be computable and searchable.
This field has no sense without this active mailing list id context.

Task ID 1891228
Linked with blacklist and opt out per mailing task (ID 33224)
Closes PR #27632

* [FIX] mail: remove `mail_followers` widget support claim

This widget claims to support one2many fields but it doesn't work in most cases.
This was triggering warnings when this widget was set on another field or in another
view (i.e. in Studio).

opw-1905803

closes odoo/odoo#28413

* [CLA] sign CLA for Okia SPRL

closes odoo/odoo#28415

* [FIX] event: wrong email footer

In a multiple company account, when creating an event without
company, the emails sent contain "Send by False" as footer, this
PR correct that by disabling the footer in case there is no company

opw-1894825

* [FIX] web_unsplash: do not fetch app_id if no Unsplash images

As empty arrays are considered truthy, the call to `/web_unsplash/get_app_id`
would always be performed even if no Unsplash images.

closes odoo/odoo#28421

* [FIX] web: accept field name as a groupby descriptor

In some cases, and for historical reasons, the groupby property can be
expressed as a string (for example, 'stage_id') instead of a list of
strings (for example, ['stage_id']).

However, the support was not complete. A crash could happen in some
cases. For example, if there is a group_by: 'stage_id' property in the
context of an action, it works in list view, but adding that view to the
dashboard would result in a crash, without this commit.

* [FIX] sale: Changement of behavior from 11.0

Introduced by: 3d46887d38e970f4932cef1bd4a887f6629151fe

Before this commit, creating an invoice from a SO always chose
the payment_method=all when the number of invoice linked to the SO >0
OR all the lines of the SO were with invoice_policy = 'order'

After this commit, creating an invoice from a SO just choose the payment_method=all
when the number of not canceled invoice linked to the SO > 0 AND when there are at
least one downpayment in the SO

SO:

Steps to reproduce the changement of behavior:

- Create a SO for 10 units (invoicing policy based on ordered quantities)

- Create the invoice for 10 units (from SO) and validate it

- Change ordered quantities to 5 units

- Click on create invoice on the SO

The payment method chosen was delivery instead of all. So choosing the default option
lead to a user error saying: there are no invoicable line instead of creating a credit note.

opw:1904258

closes odoo/odoo#28426

* [FIX] board: use correct context in sub board views

Before commit 60f143c8e7b7ea2387031c968dfa0f31a288afb2, the dashboard
parameters did not use the parameters from the action, so some important
information could be lost.

However, in this same commit, the action context overrides the context
from the user defined views, which means that some information is lost.
For example, customized group bys are ignored.

This commit fixes the issue with some careful context manipulation.
Some special care was done to remove the groupby from the action context
if it is not empty, because that same logic is used in views.

* [FIX] models: update write_date when writing on inherited fields

When changing the field `image` on `res.users`, the `write_date` of the user is
not updated because the field is inherited from `res.partner`.

Related to Issue : 1839603

* [FIX] hw_scale: added field 'disable' to namedtuple 'ScaleProtocol'

Introduced at bb015818eaf
Getting error
TypeError: __new__() got an unexpected keyword argument 'disable'

closes odoo/odoo#28202

* [FIX] base: handle models without associated xids at uninstall

If all the planets are correctly aligned, it is possible for a model to
not have any xids associated with it, if this happens then the computed
field that calculates the records to be deleted during an uninstall
may mistakingly add records of this xid-less model to the list of
records to be deleted, even if the actual uninstallation won't remove
these records.

opw-1904139

closes odoo/odoo#28388

* [FIX] website: rtl on frontend when logged out

Before this commit, RTL on frontend was only enabled for connected user.

To have RTL, we add the direction on the element, and the RTL version of
the stylesheet for the applicable languages are generated thanks to rtlcss.

opw-1892757
closes #28434

* [FIX] mail: content override toolbar in mobile landscape

On mobile (specifically in landscape orientation as the height of the
viewport is narrower), the content appear over the bottom toolbar
instead of going below.
Solution is in 2 parts:
* raise the toolbar way above the content
* make the toolbar opaque

closes odoo/odoo#28429

* [FIX] snailmail_account: do not send by default

Since most of clients don't have any credit, deactivate this by default.

opw-1906566

closes odoo/odoo#28438

* [FIX] account: invoice paid at reconciliation

Move the option to `account_accountant`, since there is no way to do it
in `account`, leaving unpaid invoices.

opw-1906544

closes odoo/odoo#28440

* [FIX] snailmail_account: fix error when sending invoice

A compute function was removed in c2b55f3e0ccd621a77000dbe467176771404586f
thus breaking the modal. A test will follow.

closes odoo/odoo#28439

* [FIX] mail: no company printed in footer

In a multiple company account, when a parter is doesn't have a
company, the mails he revieved have "Send by using odoo" as footer.

This PR correct that by setting the footer to "Send using odoo" when
there is no company.

opw-1894825

* [FIX] web: guess resize placeholder

Before this commit, if you ask for a small image, you was waiting a picture of
64x64 but in case this image was not found, a placeholder with an other size
was returned.

Now, we try to guess the asked size, and return a resized placeholder.

This bug appear since we change the default placeholder picture with a big one

This will fix several issue and avoid to hard code size everywhere in the code

Eg: commit 92f837c and commit https://github.com/odoo/odoo/commit/154fc7d9dd550d35b7266af024e54c20e18938fc#diff-9af1af2039d16d6b544d481b4ee1ed7cR144

closes odoo/odoo#27695

* [FIX] hr_holidays: set leave types as noupdate

They should not be updated using current year.

* [FIX] sale_stock: Impossible to ship a kit with different uoms

Steps to reproduce the bug:

- Let's consider three products P1(in Unit), P2(in kg), P3(in Unit)
- Create a BOM kit for P1 whit 1kg of P2 and 1 Unit of P3 as components
- Create a SO with P1 and validate it
- Go to the shipment and validate

Bug:

An error was raised saying:

The unit of measure kg defined on the order line doesn't belong to the same
category than the unit of measure Unit defined on the product. Please
correct the unit of measure defined on the order line or on the product,
they should belong to the same category.

PS: The quantity delivered on a SO line must only be computed for the product
defined on the SO line. Otherwise with a BOM kit, the sum of all its components
was done instead.

opw:1905223

closes odoo/odoo#28460

* [FIX] account: reconcile payments against min date_maturity journal item

1. Create a payment term with:
   - 50% due now
   - balance due in 14 days
2. Validate an invoice with this payment term and partner Agrolait
3. Create a payment from Agrolait with the 50% due
4. Add this outstanding credit to the invoice

It is reconciled with the balance due in 14 days instead of what is
due now. Because of this e.g. the Aged Receivable report will show the
customer being overdue with a payment.

This issue was first fixed in 9.0 at
adad192cc0018ce6838feb2a954044ee0b623841. It was then reintroduced in
saas-11.4 at d3d26120614139fd7d7e888bd66d21de5158a034. This commit
adds a test to avoid regressions like this.

To fix the issue this sorts journal items by their Due Date if there
is one. Otherwise we use the date from the journal entry as before.

Note that before this commit journal items were not sorted at all by
the two 'sorted' statements. sorted returns a sorted recordset, it
doesn't modify the recordset it's called on.

opw-1906665

* [IMP] l10n_uk: rename menu item `England` to `United Kingdom`

"British Statements" was wrongly renamed to "England" in a436645ae8016d54c32eadd7d3ec0acb2ae78d9f.

closes odoo/odoo#28458

* [FIX] account: Impossible to make a partial credit note

Steps to reproduce the bug:

- Create a credit note for an amount of 100$
- Validate it and register a payment
- Let's pay an amount of 90$ and mark this credit note as fully paid

Bug:

An error message was raised saying: Wrong credit or debit value in accounting entry !

DO NOT FORWARD-PORT

opw:1893570

closes odoo/odoo#28433

* [FIX] translate.py: fallback on base lang if noterm

When there is a language and its base language translation files in a
module, in 12.0 an empty translation in the language translation file
will not fallback on the base language.

eg.

 fr.po : {'one': 'un', 'seventy': 'soixante-dix'}
 fr_BE.po: {'one': '', 'seventy': 'septante'}

 => the translation in fr_BE will be {'one': '', 'seventy': 'septante'}

 but before 7288b477 it would have been {'one': 'un', 'seventy': 'septante'}

With this commit, an empty translation is no longer created so does not
override base language.

Also the intention of d84b795b0a6 that was also lost is restored by
upserting only noupdate==false translation, and inserting the other
ones.

opw-1904638
closes #28297

* [FIX] account: fix "post at bank reconciliation" option of bank journals

Before that, with "post at bank reconciliation option" activated on bank journal, the following scenarii did not work as expected:

1. When creating an invoice, making two payments for it, and then matching only one of them with a bank statement
=> the invoice was marked as 'paid' while it should have staid 'in payment' until the second payment gets a bank statement.

2. When directly reconciling a bank statement with an invoice for its full amount
=> the invoice staid in "in payment" state, while it should have been "paid"

[IMP] account: add tests for the aforementioned cases

closes odoo/odoo#28428

* [FIX] website: recompute carousel item heights on image loading

Some code is in charge of setting the same min-height for …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment