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
closesodoo/odoo#36483
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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
closesodoo/odoo#36482
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
— 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
closesodoo/odoo#36462
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
closesodoo/odoo#36425
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
The condition needs to be fined-tuned, so revert for now.
This reverts commit 40487aca5c.
closesodoo/odoo#36470
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
closesodoo/odoo#36453
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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.
closesodoo/odoo#36413
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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
closesodoo/odoo#36207
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
closesodoo/odoo#36173
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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
closesodoo/odoo#36389
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
closesodoo/odoo#36208
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
closesodoo/odoo#36113
Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
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
closesodoo/odoo#36412
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
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
closesodoo/odoo#36399
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
closesodoo/odoo#36379
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
... 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
closesodoo/odoo#36400
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
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
closesodoo/odoo#36383
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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
closesodoo/odoo#36370
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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/46699c5214229ea8aebcc04e08d0786fd2b67f35Closes#36227closesodoo/odoo#36243
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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"`.
closesodoo/odoo#30832
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
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
closesodoo/odoo#36196
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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.
closesodoo/odoo#36197
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#36106
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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 2057845closesodoo/odoo#36087
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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>
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
closesodoo/odoo#35731
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
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
closesodoo/odoo#36211
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
### [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
closesodoo/odoo#36177
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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
closesodoo/odoo#36346
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>