Commit Graph
152817 Commits
Author SHA1 Message Date
Xavier Morel 992fb00b64 [FIX] test_new_api: properly conclude tours
- the x2many tour would finish on a click canceling the creation but
  not wait for that to resolve, leading to the driver catching it in
  the act (checking before the client had had the time to switch),
  just need to wait for the list view to be displayed
- the constraints tour would just drop in the middle of a creation
  with an error dialog open, so need to finish the entire thing and go
  back to the list view

Part-of: odoo/odoo#96517
2022-08-04 09:14:10 +02:00
Xavier Morel 9915953342 [FIX] account_tour: ensure the form is saved by the end of the tour
Since 54ea956490 the form view has an
"urgent save" fallback mechanism. Even if nothing has changed since
the last (?), it will save during unload, which leads to extra
requests during the browser teardown (deletion of cookies and storage,
navigation to about:blank, ...), which can lead to inconsistent
behaviors and non-deterministic errors.

- add check steps at the end of the tour to wait for relevant terminal
  states
- perform an explicit save during the tour (before confirmation)

Ideally we'd really only block on *dirty* forms, because logically the
urgent auto save thing should not trigger if the form is not
dirty. However I'm not sure there's any way to check for that
externally, so saved it is...

Part-of: odoo/odoo#96517
2022-08-04 09:14:10 +02:00
Xavier Morel a52789a8b5 [ADD] web_tour: utility steps to finish form edition
A tour finishing while a form is in edition mode is an issue, as it
then triggers an `urgentSave` which generates network traffic (and
promise handlers) during browser cleanup, at a time when the state of
the browser may not be entirely coherent.

Two methods seem to be the most common here:

- drop form during creation, aka the tour mostly wants to mess around
  with onchange & ui & error reporting, in those cases the tour just
  stops using the form, the "proper" way to handle this is to cancel
  the creation and wait until back to the list view (note: the utility
  step does not currently handle situation where the creation was
  triggered from an other form view, or canceling an edition)
- save form during creation or edition, aka the tour wanted to create
  an object, did trigger a save, but didn't wait for the save to
  complete, leading to the tour finishing mid-save (which in theory
  should allow the save to complete but may still trigger odd effects)

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Xavier Morel d22cd89a60 [FIX] web: opt clickall out of form edition check
We can't really know where the clickall tour will end, and if it ends
on the settings action things are rather difficult as saving or
discarding the settings form returns to the edition mode.

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Xavier Morel b31bb2cf98 [FIX] core: add missing timeouts on end-of-tour waits
Not entirely sure why they come into play, but apparently they
sometimes do.

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Xavier Morel 07ecd396b0 [ADD] core: error if a test finishes with a form being edited
Since 54ea956490 the form view has an
"urgentSave" fallback when the page is unloaded (tab closed, page
navigated away from, ...).

In tours, this translates to new network requests being performed
during the browser cleanup, possibly chaining further into more
network events.

Flag these tours as incorrect (by making them fail if we find a form
in edition mode after receiving `"test successful"`).

Adjust testing of http cases because I've added an empty line between
the signal and the actual message for better readability on complex
error messages.

Also provide opt-out, as for some tours it's difficult to impossible to
truly fix them: the `allow_end_on_form` class attribute can be set to
`True` in order to disable the new behaviour.

To implement this, update the browser runner receive the test class
directly (rather than just the test class' name) for more
introspection flexibility.

Part-of: odoo/odoo#96517
2022-08-04 09:14:09 +02:00
Benoit Socias c0ed93f8b9 [FIX] website_slides: make text readable in white navigation bar
The navigation bar inside the Courses main page and the courses list
are forced to white with an inline style.
When a dark palette is used it makes the text color white as well.
Because of this the texts in those navigation bars cannot be read
anymore.

This commit removes the forced white background so that colors can
automatically adapt to the palette.

Steps to reproduce:
- Pick a dark palette.
- Go to the "Courses" page.
=> "All courses" and its icon were not visible anymore.

task-2855511

closes odoo/odoo#97148

X-original-commit: 852acad7585fa884f365dd2fc10348446d56d4e9
Related: odoo/enterprise#29995
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-08-03 20:48:04 +02:00
Benoit Socias 5de6b5048a [FIX] web_editor, *: restore defaults before applying preset
*: website, website_sale

Before this commit when a search bar was within a navigation bar, its
autocompletion popover was using the text color according to the
navbar's background color determined by the theme. For dark themes, this
made the autocompletion appear almost as white on white.

This commit uses the defaults before applying a specific preset color
so that the dropdown menu style within the navbar uses the original
color.
It also resets the `text-muted` style used in "No results" message.

Also removing the `website_sale.productsSearchBar.autocomplete` template
which was not referenced anymore.

Steps to reproduce:
- Select a dark palette (e.g. one that makes the navigation bars black).
- Drop a "Products Search" block.
- Reset its background color.
- Pick a color combination with a dark background.
=> The autocompletion's "No results" message is shown without contrast.

task-2855511

X-original-commit: f9bf40cb53cf487c8736c1f565c2f0d3834acd5e
Part-of: odoo/odoo#97148
2022-08-03 20:48:04 +02:00
Audric Onockx (auon) 45f26fdd43 [IMP] web: dynamic placeholder for column creation
- Purpose

Improve the UX of the "column creation" mechanism in the kanban view
so that users better understand what it is they are creating.

- Specifications

In the kanban creation mechanism, use the name of field on the model
(e.g. when grouped by stage_id in project.tasks kanban, "Add a Column"
would become "Add a Stage" because the stage_id field's name is "Stage").

task-2755570

closes odoo/odoo#95550

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-03 20:47:56 +02:00
Adesh Jolhe (adjo) 540c740ae4 [IMP] sale_,hr_(project,timesheet): generic improvements for project
Purpose of this PR to improve generic usage of project app.

So in this commit did the following changes:
 - Changed recurrence conformation messgae
 - Changed Burger menu actions  in
   project.project kanban view
 - Added quick search Description in project.task search view
 - In product form view hide button based on condition
 - Added sample data in project_milestone_views
 - switch the state and the author fields from place and add author
   label underneath it's value
 - switch the date and the progress fields from place
 - Added table-stripes class
 - Changed label sprint summary to summary in project_update_default_description
 - In project.project form view and project.update right-side panel hide
   'collaborators' button on condition

task-2895388

closes odoo/odoo#95245

Related: odoo/enterprise#29089
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-03 20:47:50 +02:00
Alexandre Kühn b7b4161873 [IMP] im_livechat, *: Refactor JS Public Livechat (step 13)
*: website_livechat

This commit is a step towards refactoring the JS of public livechat,
so that it reuses the same architecture as the code of Discuss.
This implies code that uses JS models and OWL components.

Task-2943607

closes odoo/odoo#97403

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-03 19:33:53 +02:00
Julien Mougenot 3faaecf1f3 [FIX] web: Make Ace editor field reactive
Before this commit, the Ace editor field did not update on props change.

Now, it will update its value and options when the props keys "value",
"mode" or "readonly" are modified.

closes odoo/odoo#97396

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 19:33:50 +02:00
Dardenne Florent (dafl) 455a061d09 [FIX] web: stacked bar is properly displayed
Stacked bar does not support the stacked option in the y axes.
This option was introduced in the stacked line generalization and was
set to False if the user is in the bar mode.

closes odoo/odoo#97410

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-08-03 16:31:11 +02:00
Samuel Degueldre 2add185ff5 [FIX] web: fix tooling not working in enterprise and autorefresh config
Previously, the pre-commit hook was modified to disallow commiting when
the config files were not up to date, the paths that were checked for
changes assumed that the hook was executed in the community repo which
breaks in enterprise and disallows commiting completely instead.

This commit fixes that, and also reloads or refreshes the tooling
automatically when it is not up to date before running prettier and
eslint instead of aborting the commit and asking the user to do it by
hand.

closes odoo/odoo#97404

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-08-03 16:31:07 +02:00
Jorge Pinna Puissant b348889077 [FIX] web: sort on grouped list
Since 48ef812a63, a warning was raised
(python side) when a grouped list is sorted by anything different from
an aggregate or the first field of the group.

Now, only the first field of the group or an aggregate fields can be
used to sort a grouped list.

closes odoo/odoo#97392

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 16:31:01 +02:00
Lucas Lefèvre 01e1b0fcc4 [IMP] web: add spreadsheet modules to web tooling
Enable automatic linting and formatting for spreadsheet modules.

`o_spreadsheet.js` lib file should not be checked since the file comes from
an external library (`o-spreadsheet`)

closes odoo/odoo#97393

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-03 15:10:17 +02:00
Pratik Raval 8b1daf9b80 [FIX] website_slides_survey: prevent crash on survey deletion
Currently, when we delete a single certification that is linked to a course,
it gives a validation error, which is good. But when we try to delete multiple
certifications that are linked with courses, it throws an error.

This commit fixes the issue by properly handling multiple records in the
deletion check, and updates the ValidationError message accordingly.

taskID-2901629

closes odoo/odoo#97391

X-original-commit: fecc1babb63ad1164189c95bb019afb2469043bb
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-08-03 15:10:14 +02:00
Antoine (anso) 46cceb4806 [IMP] payment_mollie : change the icon of the module
The actual icon have to be replaced with a new one
in order to follow the style of other payment acquirers modules

task-2937637

closes odoo/odoo#97387

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-08-03 15:10:10 +02:00
Sébastien Theys 2a104bff47 [IMP] mail, im_livechat: remove obsolete SCSS rules
These rules no longer target any element.

closes odoo/odoo#97386

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-03 15:10:07 +02:00
Samuel Degueldre 1107e18234 [IMP] web: configure prefer-const eslint rule to be more lax
We recently added the prefer-const eslint rule, but the default
configuration of this rule disallows some things that we often do and
which we do not think are bad practice such as declaring a variable with
let so that it's available to a function defined below, but assign it
only once later, we also sometimes destructure variables with let where
some of the variables could be const but not all, in those cases we
accept that some variables will be mutable even though it's not strictly
necessary in favour of conciseness.

closes odoo/odoo#97384

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-03 15:10:04 +02:00
Tiffany Chang (tic) 2542e91fb7 [FIX] mrp{_subcontracting}: auto assign backorders linked moves
Previous fix: https://github.com/odoo/odoo/pull/84631 missed the case
when raw_move_ids have already done move_orig_ids (i.e. when 2/3 step
MOs or subcontracting w/ resupply contractor). This made it so when
MOs are backordered, these moves would not be reserved even though they
were in the original MO.

This issue was fixed during a refactoring (reserved amounts are now
distributed to backordered MOs), but this commit will add a test to
prevent the issue from returning in the future.

Part of Task: 2777571
Original PR fix (pre-refactoring): odoo/odoo#91460

closes odoo/odoo#97383

X-original-commit: a825d9ed715b369128c876174ca6ebfac72adbe5
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Tiffany Chang <tic@odoo.com>
2022-08-03 15:09:57 +02:00
Tiffany Chang (tic) 38b97971e9 [FIX] mrp_subcontracting{_purchase}: handle subcontract qty decrease
Steps to reproduce:
- create a subcontracted product (i.e. create subcontract BoM)
- create and confirm PO for subcontracted product (qty > 1)
- try to decrease PO qty for subcontracted product

Expected Result:
Since receipt is not yet validated, the qty in the receipt should
decrease (it will in the subcontract MO as well, but this doesn't matter
since no one should work directly with the MO)

Actual Result:
A validation error occurs saying the qty to produce must be non-negative

We allow neg demand qtys to be proprogated from SOs and POs since
https://github.com/odoo/odoo/pull/76752 . While we added in a check to
make sure MOs are not created when a neg qty change is proprogated, we
forgot to add a check for subcontracted created MOs, hence the
validation error (i.e. the neg qty change is trying to create a
subcontracted MO of a neg amount.)

Task: 2777571 (issue 2 of additional issues)
X-original-commit: 251f146b6ecb0e2d428089669199a6deb3a6c060
Part-of: odoo/odoo#97383
2022-08-03 15:09:57 +02:00
Tiffany Chang (tic) b463ae62d2 [FIX] mrp_subcontracting: correct UX behavior
Fixes a few incorrect subcontracting UX behaviors:
- When subcontract BOM is flexible, the record burger should always show
  so user can more easily record varying quantities
- When `show_operations=True` then `action_assign_serial` button in
  Operations tab should only show if subcontract BOM is NOT strict AND
  has no tracked components (instead of always showing regardless of BoM
  consumption and its components)
- When a subcontract receipt is backordered, the Done moves should no
  longer return `_action_record_components`.
- When 'show_operations=True' for receipts, we shouldn't display the
  subcontracting component lines in the Detailed Operations tab

Task: 2777571
X-original-commit: e9b9fe541df984bba33c4f44d48e57820ea4968f
Part-of: odoo/odoo#97383
2022-08-03 15:09:57 +02:00
William Braeckman 79eb9187ba [FIX] website_sale: fix invalid product type in test
Prior to this commit a non existing product type was used in one of the
test.
This commit changes it to an existing one.

closes odoo/odoo#97380

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-08-03 15:09:50 +02:00
mafo-odoo 3d7369dc10 [FIX] website_sale: wrong css selector for visitor in product descprition
Issue:
The product descriptions on the /shop page (always shown if the product
description option is checked) are shortened... but only if the user is
logged in. It should also be the case for visitors.

Explanation:
Using css selector for data-oe stuff is a problem for visitors as they
don't apply to them. To fix the issue we change the selector to a classic
css class.

opw-2926847

closes odoo/odoo#97379

X-original-commit: eb50e48c798e3a5f39fa333d4248973a31e16a9f
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-08-03 15:09:47 +02:00
Jorge Pinna Puissant b90059e936 [FIX] web: apply correctly the css to the boolean fields in the settings
Since 4f984568e1, the css theme is not
correctly applied to the boolean fields in the settings, allows them to
take a big width.

Now, the max width is fixed. Note that, this was already the case on the
legacy views

closes odoo/odoo#97378

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-03 15:09:44 +02:00
Stefan-Calin Crainiciuc (stcc) 08420e9d84 [FIX] mass_mailing: Create mass mailing without logo
Steps to reproduce the bug:
- Let's consider a company c and a user in this company u.
- Delete the logo of c
- Go to mass mailing > Create

Bug:
Traceback is raised

opw-2927807

closes odoo/odoo#97326

X-original-commit: edda787471d539e9e32ab0dfe4f15235dacec48d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: stcc-odoo <stcc@odoo.com>
2022-08-03 15:09:41 +02:00
luvi 0e0fc0032e [FIX] web: progressbar field in kanban
This commit fixes the style of the progressbar
in kanban. It also remove a useless
t-on-click that was left in the template
by mistake

closes odoo/odoo#96957

Related: odoo/enterprise#29878
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 15:09:31 +02:00
luvi ec7fa71bc5 [FIX] web: classNames set on fields in list view
This commit fixes the case where classNames set on fields
used in list views were set on the cell instead. This was
causing style issues as some classnames could modify the
display option of the cell instead of styling the field
appropriately. As the layout could break easily, it is more
safe to only apply the classnames to the root div of field
elements.

A test has been added to verify this behavior.

Part-of: odoo/odoo#96957
2022-08-03 15:09:31 +02:00
Ahmed Khalaf (ahkh) 32fc7661b3 [IMP] stock: replenishment locations
this commit will allow users to setup replenish locations and replenish
them directly if they have negative forecast
instead of checking forecast qty per warehouse,
this adds the abiltiy to replenish to any internal stock location,
marked as replenish location, instead of just the warehouse location

Task Id: 2796757

closes odoo/odoo#93633

Related: odoo/upgrade#3626
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-08-03 15:09:19 +02:00
Samuel Degueldre d2a59acc6b [FIX] web: fix image field preview not updating when uploading an image
Previously, when editing an image field and choosing a new image, the
image preview would update itself to show the selected image. With the
conversion of the image field, this behaviour was lost. This commit
restores that behaviour.

closes odoo/odoo#97370

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 13:45:24 +02:00
Aaron Bohy 74586b8f4e [FIX] web: actionService: do not crash on unknown view type
In community, some actions contain view types that only exist in
enterprise (e.g. in MRP, Work Orders, there's a gantt view). Before
this commit, it crashed because the view doesn't exist. This commit
simply ignores those unknown views.

closes odoo/odoo#97369

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-03 13:45:20 +02:00
8f2c15a719 [FIX] bus: poll different channels in different tabs
Commit b743fda doesn't seem to work properly.
Steps to reproduce:
- Open a spreadsheet A in one tab
- Open a spreadsheet B in another tab
=> the master tab should poll both spreadsheet channels but it
does not.

The condition here sheems wrong
https://github.com/odoo/odoo/blob/bf2ce0aa0c7d45c90d7ff104d5af5f99b29d59ae/addons/bus/static/src/js/crosstab_bus.js#L299
`peerChannelsBefore` is not really "before the channel was added".
It's "before outdated channels are cleared".
It already contains the new channel added to local storage by the slave tab!
Hence it wrongly returns `false` which means the poll request is not
restarted.

Additional fix required since e2aeb5f
-------------------------------------

Commit e2aeb5f broke a little more the feature.
It is assumed the ids in `channels` are matching the ids in `lastPresenceByTab`
(previously named `peers`). It was no longer true since `lastPresenceByTab`
is now managed by multi_tab service (with it's own id).
With those non-matching ids, channels from other tabs were always considered
outdated and therefore cleaned up.

Small comment on the change in the mock server
----------------------------------------------

Cross tab bus tests were not working properly.
The error message string "XmlHttpRequestError abort" was stringified
(stringifying a string), leading to "\"XmlHttpRequestError abort\"". Since the
implementation depends on the exact error message, tests didn't propely
reflect reality.
This is technically not needed anymore since bus tests are no longer using
the legacy mock server but it can't hurt to fix it. (the new mock server
doesn't have this issue)

closes odoo/odoo#97036

X-original-commit: f25f36a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Goaman <nby@odoo.com>
Co-authored-by: tsm-odoo <tsm@odoo.com>
2022-08-03 13:45:02 +02:00
Lucas Lefèvreandtsm-odoo 3f60066283 [FIX] bus: stop listening when tab unloads
When a tab is closed (unloads), the main tab is still considered the main tab
and event listeners are not properly removed.

In practice, it's probably not an issue because the tab is killed by the browser,
but it could still potentially have unexpected and undesired side effects.
It's safer to clean everything properly.

The issue is much more visible in tests because the mutli_tab and bus services
are still "active" after we simulated a tab unload.

Part-of: odoo/odoo#97036
Co-authored-by: tsm-odoo <tsm@odoo.com>
2022-08-03 13:45:02 +02:00
tsm-odoo d367580f82 [FIX] web: correctly resolve mock RPC promise
The wrapping promise synchronously resolved to the rpc promise.
Hence it could not be aborted since the promise was actually already
resolved.

Part-of: odoo/odoo#97036
2022-08-03 13:45:02 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
Noe Antoine 137eddcdb4 [IMP] survey: improve image readability and add zoom widget
Before this commit, images displayed on survey question answers
were small and hard to read, and nothing existed in order to zoom
on them properly.

AFTER THIS COMMIT

Backend:

A new field value_image_filename is added to store the names of
the image fields. They are seen when editing an answer (line).

The max_height and max_width of the images are raised to 1024 px
on their field definition in survey.question.answer to compromise
between image resolution and space, and in order to be able to
zoom on them and still see details

Survey:

A hovering frame is visible on the images, as well as a zoom in
cursor, to indicate we can click on them to zoom in. The rest of
the answer frame is the selection area. Clicking anywhere on the
modal closes it. Until then, a pointer cursor hints the feature.

A new widget SurveyImageZoomer is added. Once the user has clicked
on a choice image, a transparent modal is opened on the whole screen.
This is thought for all size devices : it can be closed by clicking
anywhere, or the cross button, or ESC key. It will always be destroyed.
Also, for small width screens, we do not take the whole height but leave
bands over and below to indicate the mobile users can leave by clicking out.

The image will be displayed in the foreground, zooming on small images
by default, by setting a min width depending on the screen width. We
also avoid using a zoom too large to avoid very low resolution.

The widget allows zooming as long as the image stays in the frame.
The user can zoom both with the mouse scrolling and + and - buttons,
sized to allow medium screen (tablets) to press them accurately.

All keys are disabled but the 'ESC' one when the Zoomer is open to
avoid (undesired) survey navigation.

Task-2566584

closes odoo/odoo#73718

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-08-03 13:44:46 +02:00
Lucas Perais 64b6b630b9 [FIX] web: views: relational_model: domain set in python has dynamic values
Define in python a domain on field in the string form containing a leaf of that style
`[('field', '=', field)]` the second field doesn't have quotes around as we want it to take the current value
of the record, JS side.

Given that the field is a m2o, click on the autocomplete to trigger a name_search with that domain.

Before this commit, there was a crash as the dynamic value for `field` was absent from the evaluation context
of the domain.

After this commit, the domain sent to name_search, or at any time, is correctly evaluated.

closes odoo/odoo#97342

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 12:25:39 +02:00
Michael (mcm) baea858abc [IMP] hr_timeoff,web: convert radio image field
This commit converts the radio image field of hr_timeoff
to the new framework and renames the registry key to
time_off_radio_image.

closes odoo/odoo#97103

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 12:25:36 +02:00
Michael (mcm) a18ac8b272 [IMP] web: cache fields_get in DomainSelector
Before this commit, the DomainSelector did a lot of
RPCs to fields_get each time it was rendering.
Now, we use the view_service.loadFields which does the
RPCs and caches the results.

closes odoo/odoo#96852

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 11:06:30 +02:00
Michael (mcm) 4ce19e0c37 [IMP] web: add loadFields fn to view service
This commit adds a function `loadFields` to the view
service to load the fields of a given model and cache them.

Part-of: odoo/odoo#96852
2022-08-03 11:06:30 +02:00
Michael (mcm) 80638a3f92 [FIX] web: get correct operator in DomainSelector
Before this commit, giving an unknown operator for a
certain field type made the DomainSelector crash.
Now the component lists all existing operators to find
one that matches and prevent crashing.

Part-of: odoo/odoo#96852
2022-08-03 11:06:30 +02:00
Nicolas Bayet 52d8f8a253 [FIX] web_editor: try to paste html before files
Before this commit, when trying to paste into the Odoo editor, if file
and html was in the clipboard, the file got precedence and were added
instead of html.

task-2941679

closes odoo/odoo#97359

X-original-commit: 0af0927f48f213d835a7d4a8396fc6376476e220
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-08-03 09:24:39 +02:00
Alexandre Kühn 3bceb9159b [IMP] im_livechat, *: Refactor JS Public Livechat (step 12)
*: website_livechat

This commit is a step towards refactoring the JS of public livechat,
so that it reuses the same architecture as the code of Discuss.
This implies code that uses JS models and OWL components.

Task-2942001

closes odoo/odoo#97354

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-03 06:34:21 +02:00
Panagiotis Kyriakou b2f4511454 [FIX] hr_timesheet: fix error thrown when accessing configuration page
This commit fixes an "Uncaught Promise" error that is thrown when the
timesheets configuration page is accessed since 150f63c1b6.
The error stems from the appStoreWidget component and specifically from
how the component props are handled.

closes odoo/odoo#97341

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-03 06:34:15 +02:00
Lucas Perais 8fc7aa4ff1 [FIX] web: views: translate terms with right context and domain
Before this commit, when clicking on the translate button on a translatable field,
the translate dialog had too much data, among them wrong data because the domain
to fetch them was wrong. The context was also wrong.
This lead to a crash in subsequent operations (modify and save)

After this commit, the translate dialog is usable and fetches data with the right context
and domain.

closes odoo/odoo#97280

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-03 06:34:12 +02:00
Lucas Perais a3f6712951 [FIX] web: form_view_tests: adapt to new eslint rules pre-commit
With the rule const preferred, let something; and assigning only once triggers an error.
let something = undefined; does the trick and is what was intended.

Part-of: odoo/odoo#97280
2022-08-03 06:34:12 +02:00
Lucas Perais f9434f6cf8 [FIX] web: tooling: refresh script executable.
Fixup b099b0cb35 where the new script was not made executable.

Part-of: odoo/odoo#97280
2022-08-03 06:34:11 +02:00
stefanorigano (SRI) b3990e7d13 [IMP] web: SearchPanel, revamp scss
This commit simplifies the component SCSS improving bootstrap
integration and allowing components other than 'SearchPanel' to use the
same tree-view design.

Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2795166

closes odoo/odoo#87687

Related: odoo/enterprise#25781
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-08-03 06:34:03 +02:00
tsm-odoo de498ee63a [FIX] mail: fix remove attachment from composer test
This PR fixes the 3922 runbot issue.

closes odoo/odoo#96972

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-08-03 04:31:46 +02:00