Commit Graph
138909 Commits
Author SHA1 Message Date
svs-odoo e9f304fc1f [IMP] stock: hide picking type field
Hides the `picking_type_id` field when creating a new transfer if it is
set by default.
As this field is automatically set when coming from a list of a specific
transfer type or when asking to create directly a specific transfer type
this field is superfluous in these cases.

task-2328830

X-original-commit: c26ec70c61f51e6dc30c460c1b60f0d9ff3286a8
2020-10-07 11:22:56 +00:00
svs-odoo 2b6ce56289 [IMP] mrp: default prod. tmpl. ids in the context
Add a `default_product_tmpl_ids` in the context on the BOM operations
field. The purpose is to have the product set by default when creating a
new operation's step.

Used by 91e53397812e707611d2f430c7d534e215f8fd4f (enterprise)

task-2328830

X-original-commit: 7fe3ce4a1b2c43188b907fdec0553cf995e57bab
2020-10-07 11:22:55 +00:00
svs-odoo af81f0201a [FIX] mrp: editable WO time tracking tree
The time tracking list view in the work order form view should be
editable but wasn't.

X-original-commit: b843880b9995831947170c372639caffe1fdadfd
2020-10-07 11:22:55 +00:00
svs-odoo 6c087f2043 [FIX] mrp: MO's byproduct moves
Before this commit, there was some bugs with MO by-product moves:

  - When creating a new MO, if user deletes the byproduct move(s) then
    save, the byproduct moves will be come back.

  - With a newly created MO, in edit mode, increase the qty. to produce:
    -> Creates a new byproduct move with updated quantity to produce
       instead of update the existing one.

These issues was due to the fact when computing the byproduct moves on a
virtual record, the original move in `move_finished_ids` and its
counterpart computed in `move_byproduct_ids` have different virtual id
and so aren't considered as the same move.

X-original-commit: c1768d00e8eb76af32ead10f75ce3d09a5aefac9
2020-10-07 11:22:54 +00:00
Kamesh Patel 1d0ecb31fa [FIX]*: clear breadcrumb when redirecting to activities from systray
* mail,calendar,note

Before this commit:

When accessing activities from the systray, any existing breadcrumb-item should
be clearer.

After this commit:

Clear breadcrumb-item when access activities from the systray.

Task-2342246

closes odoo/odoo#59396

X-original-commit: 6dd181c789d22f99073fcd0a9b0fa2edccdfe0fc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-07 11:17:38 +00:00
IEL f1da6f61e1 [FIX] account: call tearDownClass explicitly
It's needed only on using skipTest in SavepointCase.setUpClass.

From docs https://docs.python.org/3/library/unittest.html#unittest-skipping:

> Skipped classes will not have setUpClass() or tearDownClass() run.

This may lead to running out of available sql connections. It mostly happens in
odoo.sh, which has max connections set to 16, while default value is 64

Fixes #56636
opw-2345762

closes odoo/odoo#59388

X-original-commit: b7f922050217634cdf85d15cae62b78fa3ce1834
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-07 10:50:56 +00:00
Anh Thao Pham (pta) 2a3e69c72a [FIX] delivery: hide Print Return Label for non-incoming picking
"Print Return Label" button on a Transfer is showed when `is_return_picking` field is True.
But `is_return_picking` is True for any picking that is a return of another picking, making
the button visible for the return of a return, when it should not as it is an outgoing picking.

opw-2312425

closes odoo/odoo#59387

X-original-commit: f54f485cc6b0eb6c25a2753ca2c764a32eb18f66
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-10-07 10:49:48 +00:00
yhu-odoo 9547813e8e [FIX] purchase_stock: compare only date in on-time delivery
Previously, when compute on-time delivery, we compare the date_planned
on PO line with the date on stock.move. Since they are both datetime,
the product that delivered on the scheduled date may be considered delay
because of the 'time' part is late, which is normally not what we want.
In this commit, we only compare the date part of them to decide whether
it's late or not.

Task 2346121
PR #58653

closes odoo/odoo#59386

X-original-commit: 86af7c647fe56f776c6cebc22dd5856577878980
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-10-07 10:35:37 +00:00
yhu-odoo f928606a12 [IMP] purchase_stock: show better when no on-time delivery data
Previously, when no on-time delivery data, we should 100%. Now we show
"No data" to make it more clear.

Task 2346121
PR #58653

X-original-commit: 8179dd974f23d8bb8c15e0ab72072fffb0866b38
2020-10-07 10:35:36 +00:00
std-odoo 0586097ab1 [FIX] website_jitsi: do not update participant count when leaving
Purpose
=======
There's one special case for the participant count update.

When we leave a room, if we are the last participant, we directly
update the participant count without waiting for the cool down (because
the participant might change the page and so the JS might not be loaded
anymore).

But, Jitsi made a change and now, when we hanging up the room, when
the event "videoConferenceLeft" is called, we are the only participant
in the list even if they're still other people in the room. So every
time someone hanging up the room, he will send the "zero participant"
update.

As we can not properly fix it (and be sure it will be "future proof"),
we dropped this update.

So now, some empty rooms might be marked as having one participant,
but no room will be marked as having zero participant if they are not
empty (and we prefer this behavior than the opposite).

Task-2350117

closes odoo/odoo#59378

X-original-commit: 84575078b80a7bf865ed52d1682548af3346ec14
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-07 10:21:51 +00:00
Nicolas Galler 91bd2b8c38 [FIX] account: avoid multiplying rounding error on unit price.
Do not round the unit price when calculating the company currency price
used to calculate the tax.  This avoids rounding errors when the company
currency amount has been calculated based on a converted (and rounded) unit
price.

Corrects a regression bug introduced in 13.0.  The behavior has been
corrected in 14.0 by a more extensive rework of the accounting module
(commit id 419d4bbee0 among others).
This fix seeks to correct the bug with minimal impact.

In version 12.0, the tax amount was calculated strictly based on the
total amount, which avoided compounding the rounding issue but had some
other problems (see https://github.com/odoo/odoo/issues/35358).

In version 14.0, the problem does not exist.  This commit only includes
the unit test.

Current behavior before PR:

For example: 20000 @ 2.82 with a rate of 1.1726 gives a
tax amount in foreign currency of 11844, which is 10100 in company
currency.  But if the company currency amount is calculated
based on a unit price of 2.4 (rounded converted amount of 2.82), the
calculated tax amount will only be 10080 in company currency.

Desired behavior after PR is merged:

Tax amount is calculated based on the total amount in the foreign
currency, not the amount based on the rounded unit price.

opw-2340933

closes odoo/odoo#59365

X-original-commit: 14c86a020429dfc6b545b65b89cbc7e3828dc557
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-07 09:41:50 +00:00
Swapnesh Shah 73be30d3a3 [FIX] mrp: hide Unit Cost on BoM Structure report
Before this commit, Label *Unit Cost* was displayed in the footer for *BoM Structure* report which is not displaying any cost Information.

With this commit we hide *Unit Cost* on  *BoM Structure* report.

closes odoo/odoo#59356

X-original-commit: 9ec465e7d3937450bad795cdb69eae52b540b994
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-10-07 09:22:10 +00:00
xO-Tx 47806eb87f [FIX] web_editor: fix empty media dialog save issue
when media dialog launched for the first time (with no selected
media attachment), "FileWidget.selectedAttachments" contains a default
object {url:... , alt:...} (default attachment already on the target),
and the click on "Add" button will cause a backtrace since the code on
"_save" method tries to access "image_src" attribute on all selectedAttachments
elements including default one.

The simplest solution would be to check if the object already has
an "image_src" attribute.

task-2312878

closes odoo/odoo#59351

X-original-commit: ecffbe4060eea98d3444f308bcd28bfb9287e1c3
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-10-07 08:52:41 +00:00
Jérémy Hennecart 02b08cbdf8 [IMP] website_event: fill attendee info if available when registering
To ease the process of the registration to an event, we prefill the first row
which holds the info of the attendee (name, email, phone), if they are available.
In most cases, the attendee:
- Take a ticket for himself
- Take a ticket for someone he's responsible of
- Take a ticket for someone else who doesn't want to be troubled by that
(ex: an assistant of a CEO)

task-2346145

closes odoo/odoo#58829

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-07 09:04:47 +00:00
Xavier Dubuc 265b1f92d3 [IMP] mail: test new message separator in some edge cases
task-2348620

closes odoo/odoo#59286

X-original-commit: 53ed641a60e6d572a12d96406b64af5b55fe177e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-06 13:33:11 +00:00
Anh Thao Pham (pta) 68cf175e07 [FIX] sale: fix untaxed_amount_to_invoice field computation
- Go to Invoicing > Configuration > Taxes
- Create a Tax and enable "Included in Price" in Advanced Options tab
- Go to Sales and create a Quotation:
  * Add an Order Line with the created Tax
- Save & Confirm
- Edit the Quotation to set a delivery quantity, then save
- Go to Sales > Reporting > Sales:
  * Display row by "Order #"
  * In Measures, add "Untaxed Amount to Invoice"
- Check the values for the create SO
The amount for "Untaxed Amount to Invoice" is the amount with taxes included.

It is due to the fact that untaxed_amount_to_invoice field of sale.order.line is computed
from price_reduce field.
As price_reduce is computed from price_unit, if there is a tax that is included in the price,
price_reduce will also contain the tax in its value.

opw-2347571

closes odoo/odoo#59334

X-original-commit: 8c54ed42eef16817f198f10697820eddcc7d0c74
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-10-07 06:40:47 +00:00
Swapnesh Shah 84f8651135 [FIX] purchase_account: consider archived valuation layers
Before this this commit there would be `ZeroDivisionError` if product is archived.

Steps to Reproduce Issue:
   Create product with AVCO and Automated Valuation
   Create PO and Received all Quantities
   Archive Product
   Create Bill and Post

   There will be Traceback
   ```
File "/data/build/odoo/addons/purchase_stock/models/account_invoice.py", line 84, in _stock_account_prepare_anglo_saxon_in_lines_vals
    valuation_price_unit = valuation_price_unit_total / valuation_total_qty
ZeroDivisionError: division by zero
   ```

Now we consider Archived `stock_valuation_layer_ids` as well.

closes odoo/odoo#59317

X-original-commit: bedbc577d13148527fa9bab104eaf67b3ffba34f
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-10-06 16:34:15 +00:00
Thibault Delavallée c5a7b1f8a6 [IMP] crm: improve handle_salesmen_assignment performances
Handle salesmen allows to assign responsible to leads using a round robin like
algorithm. Currently a write on each lead is done to update its team and
responsible, even if number of leads is far greater than number of available
users to assign.

Current implementation can be simplified by doing one write per sales person
to assign on its batch of leads, or a single write if no salesmen has to be
assigned.

Performance counter on a mass convert wizard on 50 leads show that we gain
about 9% of queries (125 on 1471) with this simple optimization.

Task ID-2351604
PR #59084

closes odoo/odoo#59324

X-original-commit: 973a2998666813ca4fbe90f1b486c1b18091c4e7
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-06 17:38:01 +00:00
Thibault Delavallée 9a22e636f9 [IMP] crm: move and add some test for lead user assign
Purpose of this commit is to

  * move tests about mass management of leads (mass assignment + mass convert
    wizards) in its own file to ease writing of tests;
  * add some performance tests :

   * performance for assignment;
   * performance for convert wizard in mass mode;

Task ID-2351604
PR #59084

X-original-commit: 950dd491bc4b680e0bcfab83815313e909a3c282
2020-10-06 17:38:00 +00:00
Julien Mougenot 07a0a0f5bc [FIX] web: Disables pager on enter
Before this commit, the pager component would only quit the edit mode if
its value changed when hitting Enter.

Now, when pressing Enter while the pager value did not change, it will
leave the edit mode and trigger a "pager-changed" event regardless.

Task 2318738

closes odoo/odoo#59285

X-original-commit: a3197283d52bfda399ce45b7d5a52406885336d0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06 13:29:28 +00:00
Priyanka Kakadiya 5d7165d4f2 [FIX] web: send utc date to server from daterange widget
When manually updating the time on a daterange widget, the value sent to the
server is not converted to UTC and is sent as it appears on the input.

currently daterange widget send datetime value as it is, written in input field
if manually entered, so if user set 10:00:00 so while sending data it will be
send as it is 10:00:00 so when next time record reloaded after save, it will
display 15:30:00 if timezone UTC+5:30.

Instead, change the string date to moment object with current user timezone.
so that datetime send to server is UTC time and when next time it is loaded
it adds user timezone difference, so if timezone is UTC+5:30 and user enters
10:00:00 then while sending data to server it sends 04:30:00 and when displayed
again after reload it adds +5:30 timezone difference.

LINKS

PR #50132
Task 2240378

closes odoo/odoo#59263

X-original-commit: a029fca2d0def06ea3f67270f0e1d654d49a0c57
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06 12:27:26 +00:00
817ce7ae5a [FIX] web: hide action button when no action
Before this commit: the action menu registry items were rendered
regardless of their inner state. The problem is that these item
components can choose not to render themselves, leading to a blank
dropdown menu if no other item was present.

To fix this, the "getProps" function of the registry has been altered to
act as validation: the item will not be rendered if the return value is
falsy. The function has also been made asynchronous to allow RPC calls.

This solution is still flawed and hides a bad design choice which is to
register components and not items or item getters; this API is too
complex for its use case(s) and adds pointless depth to the DOM. The
shape of the registry should be simplified in an improvement in master.

closes odoo/odoo#59259

Task: 2325587
X-original-commit: 45c7d881a5d130f6b3222749c8c87b6c6b45e910
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-10-06 11:38:27 +00:00
Swapnesh Shah 6715804764 [FIX] hr_expense: fixed typo
closes odoo/odoo#59328

X-original-commit: a72e448a035067465c733ece3d0c9219d1cda360
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-06 19:00:16 +00:00
Harpritsinh Sisodiyaandjpr-odoo 7c3cb51e52 [FIX] web_editor: fix oe_structure view that are not in extention mode
Issue occurs due to the way we compute the default value in base ir ui view.
The method _compute_defaults don't set extention mode under some condition
even if we provide an inherit_id view.

This commit double fix it, we use now self.env['ir.ui.view'] to create the
new view and so always compute the mode based on 'if inherit id or not'.
Second fixes is to explicitely set mode manually as 'extention'.

before commit:
when you drop snippet to blog sidebar and click save button.
The changes of user is not visible in sidebar because view created in mode
'normal' and not 'extention'

task-2311520
closes odoo/odoo#55908

closes odoo/odoo#59318

X-original-commit: a944ce9beaaf984a7b1282785d03d4bfc8220f18
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Co-authored-by: jpr-odoo <jpr@openerp.com>
2020-10-06 16:35:59 +00:00
fw-bot 7076449752 [FIX] portal: share a record without partner_id field
The method _notify_get_groups is called to determine how a user should be
notified based on the groups he belongs to.
If a record is shared via portal but the model does not have a field named
`partner_id`, the method was failing.

With this patch, the presence of the field is checked first. No additional
access_token is computed if the field is not present.

Forward port of #59123

closes odoo/odoo#59310

X-original-commit: 6612c7ae766e996c57bda5c4c23132797f162f1e
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-06 15:53:14 +00:00
stefanorigano (SRI) a9f20dcbb9 [FIX] website: increase footer home-icon readability
Ideally we should let background/text-color adapt to the current
color-preset. Since icons bg are forced to `$gray-100` though, this
commit will just increase readability allowing user's customization

task-2327741

closes odoo/odoo#59303

X-original-commit: 15ac3a2f08ed400ec5f64b40b7a8f5be04c46513
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-10-06 15:23:39 +00:00
Christophe Monniez 46936dc28c [FIX] coupon: add basic access rules
Although `coupon` is not a single app, when a user tries to install this
module alone, warnings are triggered because no access rules are defined.

Those warnings are pointing the fact that models without access rules
are a bad practice.

closes odoo/odoo#59293

X-original-commit: 801dbd09e217d316d9c048da3a7c4d6597cbc68b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2020-10-06 14:30:00 +00:00
SilvioGregorini 5e7a471e70 [CLA] openforce signs Odoo CCLA
closes odoo/odoo#59276

X-original-commit: 3f184a2529ca5828fb18e463bea7386b70a802b1
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-06 13:02:15 +00:00
nie e174a2cd64 [FIX] account: editable export, traceback on "Tax Cash Basis Entry of"
Steps to reproduce the bug:
- Select an invoice in the list
- Click Action -> Export
- Select "I want to update data (import-compatible export)"
- Click the field "Tax Cash Basis Entry of"

Bug:
Traceback

Cause:
Crashes because of a KeyError here: https://github.com/odoo/odoo/blob/2d860cdddf29b9fbd1a5401082c9f743028d2fb5/addons/web/controllers/main.py#L1743
The KeyError occurs because AccountPartialReconcile hasn't got a `name` field; `rec_name` is therefore `None`. Setting it to any field fixes the issue and `id` is the safest.

opw:2349511

closes odoo/odoo#59273

X-original-commit: 6327c86d0ea30bc056c6db320d0a1413d5807b10
Signed-off-by: backspac <backspac@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-06 12:47:33 +00:00
Benjamin Frantzen (bfr) cc255de85b [FIX]account: added country_code related field in account.bank.statement
closes odoo/odoo#59266

Related: odoo/enterprise#13844
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-06 12:13:10 +00:00
qsm-odooandBenjamin Vray 41a2a109c7 [FIX] web_editor: allow to go the parent snippet more easily
Before this commit to select a parent snippet you had to click on
its title in the editor panel.

After this commit, we can still click on the title but also on the
whole line. At the same time, make it so the title has a pointer
cursor and so that long titles work too.

task-2327182

closes odoo/odoo#59262

X-original-commit: 5d3310cea75014ce3c43ee89235cd42b87e0cf99
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Benjamin Vray <bvr@odoo.com>
2020-10-06 11:58:21 +00:00
Pierre Collinet (pic) 7b368e7215 [FIX] sale: Apply several fix on sales tour
1. Lead to loose the tour: Remove the step of the tour that asks
to set an address (the address is auto-completed at free trial
based on domain name).

2. Bug: At step 3, it redirects to the
invoice settings to select a localization, when you click on
"install more packages", you are sent back to the sales app.
--> this bug is related to res_config_settings.js from base addon.
I tried to fix this bug by adding a data-attribute "discard" in the
res_config_settings_views and checking this additional condition in
the js.

3. Bug: Tour blocks at last step "send by email" on quotation.
After clicking on "sent" on the pop-up, there should be rainbow
effect to mark the end of the tour.

4. Bug: Sale order line: fix the blue color on Invoiced Quantity
only, instead of the full line

5. Put the "sample product" in active= false (it's necessary for
the sample invoice but should not be visible to the user, they
should create their own)

6. Merge the 2 dates fields related to expected delivery on sale.order
--> since other modules extends this module, I made the field
expected_date invisible and put the same value in both fields. This
value is the max of the order_lines.expected_date

closes odoo/odoo#59261

Taskid: 2277314
X-original-commit: 0f81816d4ddb0febd28f6c6bb5dd50ae570333e1
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-06 11:57:55 +00:00
oco-odoo d1c918175b [IMP] l10n_eu_service: remove old and confusing feature description from manifest
This feature description had stayed there since v8. Back at the day, we used to create one tax code per tax the module created. We removed this in v9, as similar result can be achieved by looking at the generic tax report.

closes odoo/odoo#59232

X-original-commit: 3a6aaa6e95517807a11446d202566ac02ac6e03f
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-06 09:52:17 +00:00
Nicolas Martinelli 0783530e14 [FIX] base_vat: check VAT numbers UAxxx
- Go to the Contacts app
- Click on the Azure Interior company, or any other company with multiple associated people
- Set the country to Mexico
- Edit the VAT field and enter the following string: UAC070620MB3

Traceback will happen after hitting save.

It happens because `self` is a recordset in this case. Moreover, while
the VAT number starts with `UA`, the country is Mexico so the check is
incorrct.

opw-2348045

closes odoo/odoo#59260

X-original-commit: 3dbdc62b3458e9af2e74d8552a17d629dc7e2393
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-06 11:55:16 +00:00
fw-bot 285be5eb1b [FIX] sale_expense : avoid blank selection on re-invoice expenses
Changing this to radio buttons to avoid confusing the user with a
blank option

Task-2299286

closes odoo/odoo#59253

X-original-commit: ba8f62139bfcb27c14ce92f63585f9d277e74547
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-06 11:10:54 +00:00
fw-bot 06dc4e20e3 [FIX] hr_timesheet : fix timesheet visibility on portal
If a portal user was a customer but not a follower of a project
he didn't have access to the timesheets linked to the project.

Task-2299286

closes odoo/odoo#59252

X-original-commit: 13fc0ab18eb1e1d4ba47b7a1e66cd5079d692d8b
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-06 11:21:38 +00:00
Kairis 9b0bc31177 [FIX] Google_spreadsheet : traceback correction
When we wanted to add data to google spreadsheet in crm or accounting
=> it raised an error
Error because it couldn't find a propriety of an undefined object.
Now we're getting the query element from searchModel and not model.

closes odoo/odoo#59251

Taskid: 2337046
X-original-commit: 8d26094b020db0245620e9898e02486acf3674bf
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-06 11:09:43 +00:00
Swapnesh Shah b4795e6d3b [FIX] doc: correct link for runbot
Following the last summer runbot update, the URLs have changed

closes odoo/odoo#59241

X-original-commit: 7eaec4b2693b9aea67cfbde5d19dda152fd9f395
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-06 10:36:27 +00:00
Raphael Collet 5d6b697ada [FIX] core: optimize prefetching on large recordsets
This patch optimizes the performance of prefetching when iterating on
large recordsets.  The optimization is *transparent*, i.e., it requires
no code change for it to apply.

The worst-case scenario for prefetching is the following: the ORM has to
fetch a field for a given `record`, `record._prefetch_ids` (its prefetch
set) is *very* large (many thousands), and most records in the prefetch
set are already in cache.  This requires the ORM to iterate a lot on the
prefetch set in order to make a batch of records not having the field in
cache.

    records = model.browse(ids)     # large recordset
    for record in records:
        record.foo                  # fetch 'foo' every 1k records

When running such a loop on an empty cache, the overhead of prefetching
(determine a batch) grows as the loop progresses.  The time complexity
of this loop is actually O(N²)...

The overhead of prefetching is minimal when `record._prefetch_ids` is
about the size of a prefetching unit, i.e., 1k records.  This commit
modifies the iterator method such that every record returned by the
iterator has a prefetch set of maximum 1k records.

We measured the time taken by the loop above on an empty cache, before
and after this commit, on a simple model (res.partner.category) with
100k records.  The third measure is a reference one: a `_read` on all
prefetched fields (to fill in the cache) followed by the loop.

                            Total time      Time per 1k records
    Before this commit      3.690s          30ms - 45ms
    After this commit       1.176s          12ms
    Read then loop          1.161s          -

The measures are enlightening: the overhead of prefetching was more than
200% of the reference time, and the time to prefetch records grows as
the iteration goes on!  This commit reduces the overhead of prefetching
to less than 2% of the reference time, and make it scale gracefully with
data size.

closes odoo/odoo#59239

X-original-commit: d0d54d63dbf49a97e7fea36fe7fb4b860a0b6606
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-10-06 10:29:38 +00:00
Thanh Dodeur c1393a713c [FIX] website: matches icon apps to the app switcher
This commit makes it so that the icons of the website new-content
menu are closer to the icon of the app they are related to.

task-2329291

closes odoo/odoo#59236

X-original-commit: 4565a65e99a6dae323fd3d7ddf2010fea102bb91
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-06 10:17:32 +00:00
Arnaud Joset 9ace056714 [IMP] account,sale: html field for terms & conditions
Before this commit, the terms and conditions could not be html formatted text.

closes odoo/odoo#56512

Taskid: 2304199
Related: odoo/upgrade#1689
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-06 10:26:56 +00:00
Arnaud Joset 4d7ebb8cf5 [IMP] website_sale: remove /shop/terms controller in favor of /terms 2020-10-06 10:26:56 +00:00
Nicolas Martinelli 264f4b708a [FIX] website_event_sale: sell non-event tickets
- Create a ticket product.
- Add it to an event.
-  Uncheck it as ticket.
- Sell it on the website.

A traceback is raised here:
https://github.com/odoo/odoo/blob/88e32c5af9f47981bebea560de456a1404b4e382/addons/website_event_sale/models/sale_order.py#L88

It happens because a ticket is found, but `new_qty` is a `string` while
while `old_qty` is a `float`. It is coming from `add_qty` which is a
`string` while a `float` is expected.

We apply the same logic than:

https://github.com/odoo/odoo/blob/88e32c5af9f47981bebea560de456a1404b4e382/addons/website_sale/models/sale_order.py#L181-L190

opw-2347633

closes odoo/odoo#59216

X-original-commit: 859ffdbc3a80f50be9e298c0b5e86cd58eca0d89
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-06 08:51:09 +00:00
nie 3765415e6a [FIX] sale: calendar view overrides stock picking name
Steps to reproduce the bug:
- Open the calendar view of the quotations in Sales
- Select a time slot and enter a summary (A)
- Click "Create", fill in the required values and add an order line
- Save and Confirm
- Click the "Delivery" smart button

Bug:
The delivery order has the summary (A) for name and not the computed sequence.

Cause:
Context key 'default_name' is added here:
https://github.com/odoo/odoo/blob/0db882ce3eddc88adb3e5046f9b8d14685ffc8a8/addons/web/static/src/js/views/calendar/calendar_controller.js#L231
And it's propagated up to here:
https://github.com/odoo/odoo/blob/0db882ce3eddc88adb3e5046f9b8d14685ffc8a8/addons/stock/models/stock_picking.py#L483

opw:2335541

closes odoo/odoo#59210

X-original-commit: df580bdc8fdaa33685862f2210881f19017f1daf
Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-10-06 08:39:56 +00:00
jpr-odoo 7b82e5f89d [IMP] web_editor: improve confirmation message
In this commit, Improved the web_editor confirmation message for better readability.

task-2349785
Closes https://github.com/odoo/odoo/pull/59115

closes odoo/odoo#59115

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-10-05 13:36:19 +00:00
Rushi Sathawar 8990713aa3 [FIX] hr_recruitment: Prevent toggle active on refuse applicant
Currently, when click on refuse action on applicant it will
call the toogle_active and applicant is archived then it will
going to open the wizard for refuse reason due to that even if user
cancel the wizard the applicant is archived.

So in this commit, On click of the 'refuse' on applicant just open
the wizard for refuse reason and click of apply archive the applicant
with reason.
It will not affect the opening of wizard on archive of applicant from
action menu.

closes odoo/odoo#58740

Taskid: 2333037
X-original-commit: 9dfb85b494efeec7786d345315977b9bcea63b82
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-09-28 18:18:24 +00:00
Mohammed Shekha 6dd4aca6b4 [FIX] web: do not allow to edit priority field if readonly
if readonly attribute is given on priority widget then priority widget should
not be clickable and hover effect should be removed so that user can easily
understand that field is readonly.

task-2339680

closes odoo/odoo#59199

X-original-commit: 53dbfc7a65a8eb2f41d6b2373cf628c4800d1f57
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06 08:18:22 +00:00
Rémi Rahir 17b3cd79ab [FIX] crm_iap_lead_enrich: improve iap calls robustness
In its current state, the code contacting the iap service was prone to
fail in case of huge batches of leads being processed due to 2 factors:
- the call could timeout;
- any processed lead that was modified somewhere else in the meantime
would trigger a serialization failure and ultimately make the whole
batch fail.

This commit ensures that we process the leads by smaller batches and
that we avoid serialization failures by acquiring a lock on the current
batch.

We now also avoid useless calls to iap when an email address is linked
to well-known email providers to alleviate the payload and speed up the
server's reponse.

closes odoo/odoo#59190

X-original-commit: 0a898e16948b38a0029937c7c2eb6e2a38fd9a8a
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2020-10-06 07:51:59 +00:00
Paul Morelle def4f727b7 [FIX] web: load_filters in search dialogs
Since fbf347498f, when opening a view in a
dialog, the favorite filters were not loaded.
For example on the runbot:
1. In CRM, open any lead, edit it, and open the Customer dropdown
2. Create a custom filter, save it as favorite, and close the dialog
3. Open the dialog again: you don't see your new filter

With this commit, you will see your filter at step nr. 3

closes odoo/odoo#59186

X-original-commit: 418013e8dbb2aa2d4ffd4f650f080ca5a94183f9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2020-10-06 07:43:04 +00:00
Mohammed Shekha 657ef8ad7f [FIX] web: show no content helper message in center
no content helper message is displayed in bottom in modal when there is sample
data, when no content helper message is displayed in modal and there is sample
data the ndisplay no content message in center which is not the case for modal.

To produce this issue: go to Expense -> Create Expense -> Create expense line
and if there is not expense line then sample data is displayed and no content
helper message is displayed at bottom of sample data, it should be displayed
in center of sample data with blurry effect.

With this commit this issue has been fixed.

Task-2311408

closes odoo/odoo#59175

X-original-commit: 5461efc9620a6ff6f0d61cd2a15676c6b9c58fd7
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06 07:06:19 +00:00