Commit Graph
124839 Commits
Author SHA1 Message Date
Sébastien Theys c6bb103eac [IMP] website: avoid computing multi_website_ qcontext if not useful
Those values are only used on the website navbar when the user is in both groups
so the vast majority of the time they are done for no reason.

This reduces the number of queries by 2 on every page when the user is not admin
and/or multi website is not enabled.

Part of task-2061122

closes odoo/odoo#36483

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-05 14:53:16 +00:00
Nicolas Martinelli 3cadfebf0f [FIX] account: avoid traceback in auto-reconciliation
Commit 6b6d290a5b made sure that the list of candidates was not
empty to avoid a zero division. However, it might still happen that the
`total_residual` is zero.

We make sure to avoid the zero division in this case.

opw-2058784

closes odoo/odoo#36482

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-05 13:45:49 +00:00
Jorge Pinna Puissant 2581693b5d [FIX] mrp: warning message in production order report
— create a bom which uses 5.6 units of a product;
— make a production order;
— reserve the materials (all materials should be available);
— print the production order report.

Before this commit, a warning message in the report that says : 'All
components could not be reserved. Click on the "Check Availability
button" to try to reserve components'. This warning message is shown
despite the fact that all the components are reserved. This occurs
because of a rounding error.

Now, the warning message only when a component could not be reserved.

opw-2058921

closes odoo/odoo#36462

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-05 13:37:12 +00:00
Goffin Simon b4a1b87fb6 [FIX] mrp: domain on field final_lot_id in mrp.production.work.order.form
Steps to reproduce the bug:

Let's consider two storable products P1 and P2 where P1 is tracked by serial number
- Create a BOM B  for P1 where P2 is a component
- Create a serial numberv SN for P1 with no quantity
- Create a MO M1 for P1 and click on button "Produce"
- In the view MRP Product Produce, SN is selectable in the field lot_id
- Now change B and set a routing on it
- Create a new MO M2 for P1 and click on produce
- At least one WO has been created, click on the first one

Bug:

- SN is not selectable in the field final_lot_id

The domain set on the field final_lot_id:

"['|', '&', ('product_id', '=', product_id), ('product_id.tracking', '!=', 'serial'), ('use_next_on_work_order_id', '=', id)]"

didn't allow to chose SN.

With this fix, it's now possible to chose SN on the first WO created for M2

opw:2059745

closes odoo/odoo#36425

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-05 09:35:39 +00:00
Nicolas Martinelli a3f2c82789 [FIX] stock, mrp: merge SFP for 2 different MO
The condition needs to be fined-tuned, so revert for now.

This reverts commit 40487aca5c.

closes odoo/odoo#36470

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-05 12:29:43 +00:00
Nans Lefebvre 85b9f3abfd [FIX] product: pricelists with temporary discounts
Create a pricelist with a temporary discount on some product only for today.
Go to the shop. The discount is applied on the product.
Add the product to the cart.
Go to the cart page (review order): the price does not use the discount.

Because the query getting the pricelist item is some handwritten SQL,
it only works for dates, and not e.g. in the case of datetimes.
So the pricelist item encoding the discount is not retrieved, and thus not used.

It turns out e.g. in _website_product_id_change it gives a datetime in context,
explaining why sometimes the discount is applied, and sometimes not.

We use fields.Date.to_date as it should work on all date formats we shall pass.

Co-written with @sbbaro

opw 2054881

closes odoo/odoo#36453

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-05 08:58:07 +00:00
RomainLibert c7f11aae6e [FIX] hr_holidays: aggregate attendances using day_period and dayofweek
Before this commit, if you had defined multiple attendances for the
morning or for the afternoon, the system would only use the first
attendance defined for either morning or afternoon.

This lead to wrong computations of the real leave length.

This commit fixes this issue by getting the min(hour_from) and
max(hour_to) for the attendances using a read_group.

closes odoo/odoo#36413

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-04 11:36:04 +00:00
Joren Van Onder 3a2eee5c8f [FIX] website_blog: speed up loading blog posts when there are many
Doing filtered on all_post is problematic in case there are many
blog.post records (>5000 were observed). It will trigger prefetching
which will run the content fields through html_translate which can
take many seconds to complete.

Instead replace the filtered call with a more precise search domain.

opw-2060704, opw-2060706

closes odoo/odoo#36207

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-28 17:29:05 +00:00
Nicolas Martinelli 6d8e5efa84 [FIX] purchase: default user_id on bill
On top of leading to AccessError in multi-company (if the PO was created
by OdooBot), it might also assign a user without Accounting rights to a
vendor bill.

This reverts commit 392f6f2b2b.

opw-2056061

closes odoo/odoo#36173

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-28 10:01:06 +00:00
Nans Lefebvre 3df5c5dd56 [FIX] product: filter out archived pricelists from candidate pricelists
Have a pricelist Pl set as property_product_pricelist on some partner Pa.
Archive Pl, so that the public user Pu use another pricelist Pl'.
Go to the shop, create some order.
The prices are obtained from Pl'.
Log in as Pa; prices are updated using Pl.
However since Pl is archived, it is not visible on the pricelist views,
so the end user cannot explain why the prices changed.

When the pricelist is archived, nothing is done regarding the ir.property
storing the partner/pricelist mapping, so the pricelist is retrieved as default
nonetheless.

We filter out the active pricelists when getting the property.

opw 1946476

co-authored with JKE-be

closes odoo/odoo#36389

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-03 14:24:58 +00:00
Nans Lefebvre 19b17365d7 [FIX] stock_landed_costs: do not (incorrectly) use float_compare to mean float_is_zero
Take a landed cost with an amount_total of 2464788.5
in a currency with no decimals, so precision_digits is 0.
Now let the sum of the lines 2464788.499999999.
Additionally, we have that 2464788.5 is rounded up to
2464789 and 2464788.499999999 is rounded down to 2464788.
So float_compare returns a nonzero value.
However, it turns out that the docstring of float_compare contains:

Warning: ``float_is_zero(value1-value2)`` is not equivalent to
``float_compare(value1,value2) == 0``

So the intended use was to use float_is_zero.

opw-2048388

closes odoo/odoo#36208

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-04 06:46:12 +00:00
Christophe Simonis 638eac9bae [MERGE] forward port branch saas-11.3 up to a4fe211ee2 2019-09-04 18:56:27 +02:00
Christophe Simonis a4fe211ee2 [MERGE] forward port branch 11.0 up to cd1b56b41f 2019-09-04 16:31:43 +02:00
jev-odoo 2761393b06 [FIX] stock,sale_stock: Speed up sale_order confirmation
In case there is a lot of stock_moves and/or lot of
stock_quants, the function _get_qty_procurement
takes a lot of time because there is no index defined
on most accessed fields.

I.E. OPW-2027183

closes odoo/odoo#36113

Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
2019-09-04 12:03:22 +00:00
Goffin Simon cd1b56b41f [FIX] account: Wrong amount due when reconciling with refund
Steps to reproduce the bug:
- Let's consider the following currency rates: 1.00 for USD and 0.50 for EUR
- Create invoice I with the same currency of your company (USD) and amount due = 100$
- Validate I
- Create refund R with  a diffenrent currency of your company (EUR) and amount due = 1€
- Validate R
- Reconcile R with I

Bug:

The amount due of I was 196$ instead of 98$

PS: The root of this issue was coming from function assign_outstanding_credit that was called when
reconciling R with I. This function changes the currency_id and the amount_currency of the account move line.
So the function _amount_residual defined on model account.move.line was triggered as
the currency_id was changed. In _amount_residual, the residual_amount_currency was computed.

Forward-port up to saas-11.3

Closes #36252

opw:2062103

closes odoo/odoo#36412

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-04 11:04:26 +00:00
Goffin Simon dde5227546 [FIX] l10n_ae: Wrong translation
TVA in english is VAT

opw:2065413

closes odoo/odoo#36410

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-04 09:37:59 +00:00
Christophe Simonis 6143de52ad [MERGE] forward port branch 11.0 up to 923fb7aa05 2019-09-04 11:33:04 +02:00
Nans Lefebvre 116dda06a7 [FIX] account: do not sent user as vendor when sending bill by email
On purchase journals, there is the possibility to set up an alias to
automatically create vendor bills from incoming email.
Three types of emails can send the bill:
- the vendor, with email matching a partner in database
- an internal user, possibly forwarding the bill he received from the vendor
- an unknown address
In the third case, the address will be ignored.
In the first, we found the vendor, so he can be set as partner_id of the bill.
The tricky one is the second case, where we try to guess the vendor.

Before, the code would take only the first email found in the body;
if it found a matching partner, then it used that partner anyway,
even if that partner belonged to a user and was skipped before.

After the fix, we get the partners for all emails
and take arbitrarily the first vendor, then backup on the first non-user.

Note also that email_addresses would duplicate every address read in the body;
we make a set to avoid duplicate processing.

opw 1885070

closes odoo/odoo#36399

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-09-04 06:21:22 +00:00
Goffin Simon 450269b268 [FIX] account: Wrong amount due when reconciling with refund
Steps to reproduce the bug:
- Let's consider the following currency rates: 1.00 for USD and 0.50 for EUR
- Create invoice I with the same currency of your company (USD) and amount due = 100$
- Validate I
- Create refund R with  a diffenrent currency of your company (EUR) and amount due = 1€
- Validate R
- Reconcile R with I

Bug:

The amount due of I was 196$ instead of 98$

PS: The root of this issue was coming from function assign_outstanding_credit that was called when
reconciling R with I. This function changes the currency_id and the amount_currency of the account move line.
So the function _amount_residual defined on model account.move.line was triggered as
the currency_id was changed. In _amount_residual, the residual_amount_currency was computed.

opw:2062103

closes odoo/odoo#36379

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-04 07:34:08 +00:00
Aaron Bohy 0b146aa253 [FIX] web: form: race condition when editing in readonly
... and switching to 'edit' mode before the write RPC returns.

For instance, on a project task form view, in readonly, change the
state by clicking on the bullet, and directly switch to 'edit'
mode: when the RPC returns, the view is switched back in readonly.

Task 2065443

closes odoo/odoo#36400

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-04 07:15:18 +00:00
Lucas Perais (lpe) b7e3469931 [FIX] web: grouped list as grouped list as child
In grouped editable list, get rid of the groups
Edit one record in the editable list
In a M2O, click on search more

In search's list, group by a field
Expand a group in the search's list

Before this commit, it crashes because the event was propagated
onto the first main list

After this commit, it doesn't crash and the group is expanded

OPW 2064156

closes odoo/odoo#36383

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-03 14:24:58 +00:00
Alexandre Kühn 923fb7aa05 [FIX] im_livechat: no duplicated messages
Before this commit, when using website livechat with multiple tabs,
it may duplicate messages in the chat window.

This happens due to registering messages twice:

- once, from `/mail/chat_history`
- second, from receiving notification from master tab, via local
storage.

This commit fixes the issue by not registering messages that have
already been registered (i.e. unique ID).

opw-2052960

closes odoo/odoo#36370

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-03 10:55:32 +00:00
Christophe Simonis 79ff916b59 [MERGE] forward port branch 11.0 up to 61a85ccf8f 2019-09-02 19:37:06 +02:00
Christophe Simonis 61a85ccf8f [FIX] website_blog: avoid using map to please pylint 2019-09-02 18:46:34 +02:00
Christophe Simonis 1e1702d3c0 [MERGE] forward port branch saas-15 up to dc934d67dd 2019-09-02 18:24:59 +02:00
Christophe Simonis dc934d67dd [MERGE] forward port branch saas-14 up to ff1f3c557e 2019-09-02 18:09:41 +02:00
Christophe Simonis ff1f3c557e [MERGE] forward port branch 10.0 up to c7c68bab84 2019-09-02 17:54:34 +02:00
Odoo Translation Bot 432b50bd1b [I18N] Update translation terms from Transifex 2019-09-01 03:48:01 +02:00
Odoo Translation Bot c7c68bab84 [I18N] Update translation terms from Transifex 2019-09-01 03:24:12 +02:00
Alexandre Kühn 1d766c067d [FIX] mail: keep ratio of img in message with inline dimensions
Before this commit, when a message body contains a big image with
inline dimensions, the image was stretched.

For instance:

- `<img width="4096" height="2304">`
- on 1080p screen in the discuss app:
- max-width for image: 1542px
- image ratio: ~ 1,78
- expected height: 867.38px
- actual height: 2304px

This issue had been fixed[1], but was reintroduced[2].

Note that this fix only works when inline dimensions are set as attr
of the `<img>` tag. It won't work with dimensions attached as inline
styles (e.g. `<img style="height: 4096px; width: 2304px;>`), due to
high CSS specificity of inline styles.

[1] https://github.com/odoo/odoo/commit/e7bc4e9703954fa952f24b4f96e75dc4299bbb28
[2] https://github.com/odoo/odoo/pull/15542/commits/46699c5214229ea8aebcc04e08d0786fd2b67f35

Closes #36227

closes odoo/odoo#36243

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-08-29 14:50:49 +00:00
Christophe Simonis ede253f1b2 [MERGE] forward port branch 11.0 up to d61873ac4a 2019-08-29 15:22:51 +02:00
Christophe Simonis d61873ac4a [MERGE] forward port branch saas-15 up to 10d88083a0 2019-08-29 13:37:39 +02:00
Jairo Llopis 481ad586cc [FIX] website_blog: Saner crawler instructions
The fixes that this patch includes are:

- The tag URL for tags printed in short and expanded blog posts had no slug, thus producing a brand new URL. Now they have the slug.
- Any request landed without that slug is slugified with a 301 code, as with the rest of Odoo.
- The `<a>` elements in right column archives have now `rel="nofollow"`.
- The `<a>` elements in right column tag cloud, where more than 1 tag is used, have now `rel="nofollow"`.

closes odoo/odoo#30832

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-29 11:27:56 +00:00
Richard Mathot b294333e94 [FIX] doc: explanation for pg_path
opw-2060249

closes odoo/odoo#36223

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-08-29 10:44:17 +00:00
Christophe Simonis 10d88083a0 [MERGE] forward port branch saas-14 up to ca34ae4329 2019-08-29 12:16:44 +02:00
Christophe Simonis ca34ae4329 [MERGE] forward port branch 10.0 up to 7c99310b23 2019-08-29 12:14:47 +02:00
Christophe Simonis c40236eb16 [FIX] account: adapt test to new version
Oversight of previous forward-port.

closes odoo/odoo#36181

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-08-29 10:04:28 +00:00
Florimond Husquinet (fhu) 55d1c66c8e [FIX] mail: parse message with invalid html as content
Before this commit, when a message contains invalid HTML, it crashed
with error such as: "TypeError: Cannot read property 'childNodes' of
null".

This commit fixes the issue by wrapping the content of messages with
invalid HTML in a `<pre>` tag.

OPW-2048140

closes odoo/odoo#36196

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-08-29 08:19:57 +00:00
Olivier Dony 0159d71ec1 [FIX] website_blog: encode URL for social sharing
Like in other places where we have social sharing buttons, when we pass
a URL or title as a parameter it needs to be properly encoded.

closes odoo/odoo#36197

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-28 14:26:36 +00:00
Christophe Simonis 838b3f2d82 [MERGE] forward port branch 11.0 up to 1385b60004 2019-08-27 16:06:01 +02:00
Christophe Simonis 1385b60004 [MERGE] forward port branch saas-15 up to ea821b991a 2019-08-27 14:53:45 +02:00
Christophe Simonis ea821b991a [MERGE] forward port branch saas-14 up to e4428e0c9b 2019-08-27 12:44:24 +02:00
Christophe Simonis e4428e0c9b [MERGE] forward port branch 10.0 up to da474d0e87 2019-08-27 12:43:51 +02:00
Jorge Pinna Puissant 61ad8a9ea7 [FIX] website_event_sale: event discount
Fine-tuning 180866fe1e

- Go to Sales > Configuration > Settings
- Enable "Multiple Sales Prices per Product" and select option "Prices
computed from formulas (discounts, margins, roundings)"
- Go to Sales > Catalog / Pricelists
- Select "Public Pricelist" and set "Discount Policy: Show public price
& discount to the customer"
- Add a discount to an event (20 % to "Open Days in Los Angeles" for
example)
- Go to the eCommerce, buy a ticket to "Open Days in Los Angeles" which
as a 20 % discount

Since 180866fe1e the discount is applied
two times.

opw-2058709

closes odoo/odoo#36106

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-27 08:33:30 +00:00
Lucas Perais (lpe) a20b84d05a [FIX] account: reconcile invoice, refund in foreign; payment and writeoff in domestic
This reverts 0164c9dfcb

Have exchange rates:
Domestic - Domestic: 1.0
Domestic - Foreign : 1.113900

Make an invoice: 480 Foreign
Make a credit note: 140 Foreign
Make a payment: 287.20 Domestic

Reconcile all this with a writeoff: 18.04 Domestic

Before this commit, the first invoice was not fully paid
this was due to wrong summing of the partial lines that applies to it
account.partial.reconcile are made between only 2 move lines at a time
Whatever the amounts they hold, it has been computed at creation
and it makes no sense to aggregate their rounding error when computing
their impact on a move line (because, the information is already lost)

After this commit, the use case works, all invoices and payments are fully consumed and reconciled
Note that this is a simple use case, no dates or exchange rates involved

OPW 2057845

closes odoo/odoo#36087

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-26 13:41:21 +00:00
Romain Derie 0ff1933ba1 [FIX] website: restore sitemap lastmod and priority
Commit 54d30d5194 introduced `lastmod` and `priority` on sitemap locs.

This was broken with 4ecbacaf59 which introduced `website.page` model as it
removed the `PageConverter`.

Before website.page:
1. PageConverter returned records with `__lastmod`
2. `enumerate_pages` loop on converters would remove the prefixed `__`

After website.page:
1. code to remove `__` was still there but the pages would be found and looped
on after that code, making it useless.

With this commit:
1. The code to remove the `__` is moved after searching the pages.

Following #36090
Related to #35464

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-26 14:43:39 +00:00
Nans Lefebvre 75460e697a [FIX] mrp: block partial post inventory of MO with workorders and tracking
Enable work orders, routings, and track components by lot numbers or serial.
Create an MO for a certain X quantity of finished products and plan work orders.
Only complete a partial amount Y of the overall X amount.
Specify the lots for the consumed tracked materials equal to the Y amount.
Then, return to the MO and click "Post Inventory".
An error is raised because the lot is missing.
This is because when processing workorders temporary lines
are created without lot/serial for tracked component products.

This is a limitation that require a task to be removed;
in the meantime we remove the button, in true bugfix fashion.

opw 2049806

closes odoo/odoo#35731

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-08-26 07:24:28 +00:00
Harpritsinh SisodiyaandAaron Bohy fbbfa6ddca [FIX] web: datepicker: crash on invalid date
There is an open issue on the tempusdominus lib:
https://github.com/tempusdominus/bootstrap-4/issues/223

It occurs when there is a valid value in a date(time) field, and
the user unsets it by setting an invalid one.

This rev. fixes the issue in Odoo by preventing to reach the buggy
piece of code in the lib. In a few words, when the user sets an
invalid date, we reset the previous valid date (which is what the
lib tries to do anyway).

Task 2057009

closes odoo/odoo#36211

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>


Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-09-03 12:14:05 +00:00
Odoo's Mergebot 85c5d0a4be [MERGE][FIX] bus, mail, web: several cross-tab communication fixes
### [FIX] bus: background slave tabs should not loose notifications

Slave tabs missed some notifications in case the local storage
event's `newValue` did not match actual value in local storage. This
happens when master tab overwrites a value that slave tabs did not
take the time to read. Slave tabs should now always handle all local
storage events.

Task-ID 2044231

### [FIX] bus, mail: correctly synchronize document chat windows

Cross-tab synchronization of document chat windows resulted sometimes
with an infinite loop. This happens due to tabs relying on actual
value in the local storage and all document chat windows state being
set as a single local storage entry. Cross-tab communication of
document chat windows now is relying on event's `newValue`, and each
document chat window has its own local storage entry. Changes from
local storage no longer writes again in the local storage, so that
it no longer makes an echo (= infinite loop).

Task-Id 2034997

closes odoo/odoo#36177

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-03 13:06:23 +02:00
Goffin Simon 82c0e9b620 [FIX] payment: Publish Sips online payment
Steps to reproduce the bug:

- When trying to publish the sips payment acquirer not in debug mode

Bug:

It raised a access rights error because the fields: sips_test_url, sips_prod_url, sips_version
were not readable in function _check_required_if_provider and  a default value was set for all
these fields.

opw:2061123

closes odoo/odoo#36346

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-09-03 08:13:49 +00:00