Commit Graph
153813 Commits
Author SHA1 Message Date
Didier (did) 683f9be971 [FIX] mail: fix traceback with empty message body
This PR fix a traceback that occure when the message body is empty (eg: only
uploading an attachment).

closes odoo/odoo#99625

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-06 18:23:00 +02:00
Denis Ledoux 443b1e1576 [IMP] base: back-end views, remove attributes unused by the web client
In back-end views, the attributes
- attrs
- states
- invisible
- readonly
- required

are transfered to the `modifiers` attribute.
The web client only uses this `modifiers` attribute.
Hence, the above attributes which gets transfered
to the `modifiers` attribute can be safely removed
from the architecture sent to the web client.

In addition, in case the modifiers were all falsy
e.g. `{'invisible': False, 'readonly': False, 'required': False}`
`simplify_modifiers` was simplifying these modifiers to
`{}` and `modifiers="{}"` was set on the node,
which is a bit useless and waste transferred bytes.

This allows to gain some KB for all `get_views` calls.

For instance, with only `account_accountant` installed,
`get_views` of `account.move` goes
from 228.01 KB to 208.78,
therefore sparing 10% of KB for each calls.

An example using the `res.partner` form:

Before:
```xml
<field name="is_company" invisible="1" on_change="1" modifiers="{&quot;invisible&quot;: true}"/>
<field name="commercial_partner_id" invisible="1" on_change="1" modifiers="{&quot;invisible&quot;: true, &quot;readonly&quot;: true}" can_create="true" can_write="true"/>
<field name="active" invisible="1" on_change="1" modifiers="{&quot;invisible&quot;: true}"/>
<field name="company_id" invisible="1" on_change="1" modifiers="{&quot;invisible&quot;: true}" can_create="true" can_write="true"/>
<field name="country_code" invisible="1" modifiers="{&quot;invisible&quot;: true, &quot;readonly&quot;: true}"/>
<field name="company_type" widget="radio" options="{'horizontal': true}" on_change="1" modifiers="{}"/>
```

After:
```xml
<field name="is_company" on_change="1" modifiers="{&quot;invisible&quot;: true}"/>
<field name="commercial_partner_id" on_change="1" modifiers="{&quot;invisible&quot;: true, &quot;readonly&quot;: true}" can_create="true" can_write="true"/>
<field name="active" on_change="1" modifiers="{&quot;invisible&quot;: true}"/>
<field name="company_id" on_change="1" modifiers="{&quot;invisible&quot;: true}" can_create="true" can_write="true"/>
<field name="country_code" modifiers="{&quot;invisible&quot;: true, &quot;readonly&quot;: true}"/>
<field name="company_type" widget="radio" options="{'horizontal': true}" on_change="1"/>
```

closes odoo/odoo#99619

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-09-06 16:22:57 +02:00
tsm-odoo 0f9b11a025 [REM] mail: remove obsolete wait until event parameter
The `waitUntilEvent` start helper parameter has become obsolete. Indeed,
events are systematically awaited by the `openDiscuss`/`openView`
helpers. This commit removes this parameter.

closes odoo/odoo#99577

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-06 15:22:59 +02:00
Victor Feyens ed01b9a627 [REF] payment_custom, *: distinguish custom payment modes
This commit adds a `custom_mode` field to payment acquirers to allow
distinguishing the different payment modes made possible through the
`payment_custom` module: Wire Transfer, Cash on Delivery, On-site
picking. This avoids making direct references to the modules' data when
trying to figure out which acquirer is which, hence allowing duplicating
the acquirers in multi-company databases.

task-2853489

closes odoo/odoo#99400

Related: odoo/upgrade#3847
Related: odoo/enterprise#30966
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-06 12:01:38 +02:00
Victor Feyens 5f41f15e6b [MOV] payment_transfer: rename to payment_custom
The module `payment_transfer` was originally meant to implement a
payment with Wire Transfer flow, which it does not exactly do since all
it does it making transactions follow the payment flow until their
`pending_msg` field's content is shown to the customer. Because of that,
other modules (`website_delivery_ups`, `website_sale_picking`) started
duplicating the base acquirer Wire Transfer to create new payment modes
such as Cash on Delivery and Pay in Store.

To better prepare for a proper dinstinction of the custom modes enabled
by other modules, this commit renames the module `payment_transfer` to
`payment_custom`.

The module `payment_transfer`'s `auto-install` key is also set to
`False` since we no longer want Wire Transfer to be the default payment
acquirer for new databases.

task-2853489

Part-of: odoo/odoo#99400
2022-09-06 12:01:37 +02:00
Victor Feyens 852c2a13ed [FIX] payment: do not rely on the Wire Transfer acquirer for tests
task-2853489

Part-of: odoo/odoo#99400
2022-09-06 12:01:37 +02:00
Mahamadasif Ansari b96ca959ba [FIX] {mass_mailing_event}_track, website_event: fix the broken xpath
Since a recent commit[1] (that added invisible fields to avoid their removal
from the view when there's group applied on it and logged in user does not
fall under this group), the view definition were changed and so there were
few xpath broken which dependent on such fields.

- In event (event.view_event_form form view), invisible 'company_id' field
  was added, which broke the the xpath in website_event since it was not
  not robust and considered first invisible 'company_id' field, which now
  should be the later one after commit[1].
- In mass_mailing_event_track, 'track_count' filed was added, that broke the
  xpath in website_event_track_gantt.

This commit addresses both of the issues by:

- putting group name "right_event_details" in the "event.event.form"
  form view and providing an xpath with group name in the
  "event.event.view.form.inherit.website" form view to adapt the changes.

- removing the 'track_count' invisible field from 'mass_mailing_event_track'
  module because that field in the original view does not have any group
  applied at view or model level so we don't need to add the same one as
  invisible field in the view

This commit also remove the invisible 'seats_expected' field from event
form view in 'mass_mailing_event' module for same reason as 'track_count'
field; it does not has any groups applied at view or model level so we
don't need to add the same one as invisible field once again.

commit[1] - https://github.com/odoo/odoo/commit/0501bbd62e517f6c215d9e7e36d61747c7f5816b

task-2964291

closes odoo/odoo#99212

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-06 12:01:29 +02:00
Rohitkumar (roku) e849ca6fa7 [IMP] sale_(project),hr_timesheet: generic UX improvement for project
Purpose of this commit to improve generic usage of project app.

So in this commit done the following changes:
 - apply the 'open tasks' filter by default for my task menu
 - the search view set  the one from accounting and not timesheet for
   gross margin stat button
 - add a 'stalling for 30 days+' filter that should return open tasks whose
   last stage update was more than 30 days ago  for project task form view
 - move the 'stage' quicksearch above the 'project' one for burndown chart
 - when archiving a project containing tasks that are recurrent, disable their recurrence instead of
   raising an error
 - format some field in timesheets notebook in project sharing
 - display the 'rating email template' field by default for task stages

task-2899490

closes odoo/odoo#95636

Related: odoo/enterprise#29270
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-09-06 12:01:26 +02:00
David Monjoie 2220ff36a1 [FIX] web_editor: move table resizing handlers to editable
closes odoo/odoo#99597

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-09-06 10:58:31 +02:00
tsm-odoo 65a9e730b0 [FIX] bus: fix display reconnect notification test
The `displays reconnect notification` bus test relies on a `nextTick`
to assert that a notification is present after the websocket
disconnection.

The issue is that we can't be sure that the notification will be
displayed after this tick. Indeed, we need to wait for: the `postMessage`
to reach the bus service, the notification to be added, the notification
to be added in the DOM.

This commit solves this issue, by waiting for the next render after the
`simulateConnectionLost` method to occur.

closes odoo/odoo#99590

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-06 10:58:28 +02:00
Aaron Bohy 40c9986d7d [FIX] web: kanban: reload after creating a record
In kanban arch, one can set the attribute "on_create" on the root
node to an action xmlid. In this case, when the user clicks on
"Create", the action is executed. When this action is in target
new, it opens a dialog (typically to create a record...). Before
this commit, we didn't reload the kanban after closing the dialog.
As a consequence, the newly created record wasn't displayed. For
instance, it was the case in the Recruitement dashboard.

closes odoo/odoo#99589

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-06 10:58:25 +02:00
Mathieu Duckerts-Antoine 2600d1f2ae [FIX] web: form view does not modify useSampleModel value
Go to a (OWL) list view with sample data, click "Create" to open a (OWL)
form view and go back to the list view using the breacrumbs: the sample
data has disappeared.

This is due to the fact that the form view set useSampleModel=false in
the globalState when it is left while it does not use at all sample data
mode.

Here we make it simply pass the value that it received initially.

closes odoo/odoo#99587

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 10:58:22 +02:00
Sébastien Geelen (sge) ce8076566b [FIX] web_editor: traceback selection null in FF
In Firefox only :
In some case (editor in page but not visible) the
`document.getSelection` sometimes return `null` instead
of an empty selection object. We add some check to ensure
we avoid unnecessary traceback.

task-2971126

closes odoo/odoo#99511

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-09-06 10:58:19 +02:00
Lucas Perais e940f14ccb [REF] web: Many2ManyTagsField: only edit color in Form
One can edit the color of a tag in a Many2ManyTags field only in form view.
This commit refactors that field so that the standard field Component doesn't allow for it,
and conversely implements a specialization of the field that can, and should be
selected by the form view.

closes odoo/odoo#99499

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 10:58:16 +02:00
Paul Morelle 972b54f918 [FIX] auth_totp,auth_totp_portal: fix typo in login verb
Login is a noun and not a verb. The corresponding verb is Log in.
And indeed the translation in French was "Identifiant" instead of
"Se connecter".

closes odoo/odoo#99478

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-06 10:58:13 +02:00
Antoine (anso) 3a24c550e1 [IMP] hr_expense : change expenses category's pictograms
Current outdated pictograms had to be replaced with better designed and
visually consistent pictograms.

PNG were replaced with SVG to gain in quality and lightness.

Unused category icons were removed.

task 2951089

closes odoo/odoo#99276

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-09-06 10:58:09 +02:00
Odoo's Mergebot f93e04253f [MERGE] hr_homeworking: Add employee work location mechanism
Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#98242

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-09-06 10:58:06 +02:00
Zelong Lin d57c64f95b [IMP] mail, *: remove 'public' field in channel
*: im_livechat, website_livechat

Access right should be based on channel type and membership instead.
Chat always private, group always private, channel private should
disapear and be a group instead (migration needed), and other channel
always public (but they can still be further restricted with
the "allowed groups" feature)

task-2632861

closes odoo/odoo#90415

Related: odoo/enterprise#30980
Related: odoo/upgrade#3850
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-06 10:57:59 +02:00
Nasreddin Boulif (bon) 533ccf7fb0 [FIX] web[_editor]: Apply RTL position to translate button
Steps to reproduce:

  - Install Inventory
  - Open any product
  - Switch to RTL language
  - Edit the product
  - Try to translate field "Internal Note"

Issue:

  Button is not displayed correctly (nearly hidden).
  Issue also present with wysiwyg or codeview editors.

Cause:

  Applying style `right: 5px` to the button without taking into account
  if layout direction.

Solution:

  On translate button:
  - Apply direction left for side-space if RTL, else right.
  - If wysiwyg is enabled, add it after the buttons in the sidebar.

opw-2962790

closes odoo/odoo#99567

X-original-commit: 56f620ff65ca9c1e5d9a64f5280ea16fd469c87d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-09-05 23:51:09 +02:00
Thibault Delavallée 5f7da6920b [IMP] test_mail(_full): update counters to runbot state
Some differences between community / enterprise seems to have vanished.

Task-2710804 (Mail: Clean MailThread API)

closes odoo/odoo#99566

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-05 23:51:06 +02:00
luvi 73e2cf08a4 [FIX] web: displays the right status on hover
This commit fixes the StateSelection field, which
displayed the wrong value on hover. In legacy, the title
attribute was set to display that value. Now, it has been
replaced by a tooltip, since it can be used with touch
and is more convenient to use. A test has been modified
to assert the presence of the data-tooltip attribute.

closes odoo/odoo#99561

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-09-05 22:51:57 +02:00
Julien Castiaux 4174b330f7 [FIX] http_routing: /r russian vs /r link tracker
Install website_links, create a link e.g. to http://example.com, install
the russian language and translate the default website. Access the short
link you created before-hand, 404 website page not found.

Accessing a website starting with /r is ambiguous, is /r the
link-tracker controller or is /r a russian lang alias (nearest lang
algorithm)? The controller should be prioritary to the lang alias.

This restore the behavior as it was before the httpocalyse.

closes odoo/odoo#99555

X-original-commit: e8a1b4c0cdffb38e48ca980205a61c75c564dee8
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-09-05 20:13:17 +02:00
Géry Debongnie adc98beeb9 [IMP] web: update owl from 2.0.0-beta-16 to 2.0.0-beta-18
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-16
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-18

Details:

- imp: types: expose ComponentConstructor for typing purpose
- fix: compiler: fix falsy values for properties not keeping input empty
- fix: app: allow mounting owl apps in iframe
- fix: allow multiple occurrences of same slot in different locations

closes odoo/odoo#99554

X-original-commit: fb67514a52e10c53a09ab46c100873303f4ba1c8
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-05 20:13:14 +02:00
Philippe Wauthy c77e6f4bb4 [FIX] hr_holidays: fix leaves calculation when no allocation is required
Since https://github.com/odoo/odoo/pull/96545, the calculation of the leaves
taken was done the same way between a holiday type that requires an allocation or
one that doesn't.

This commit fixes the number of days calculation for a holiday type that doesn't require an allocation.

task-2969687

closes odoo/odoo#99546

X-original-commit: https://github.com/odoo/odoo/commit/e6b51b0a7180298cfa04cd61b754cea660eae156
Signed-off-by: phwa-odoo <phwa@odoo.com>
2022-09-05 20:13:11 +02:00
Zelong Lin d23db6e9da [IMP] mail: who command supported in group
task-2971564

closes odoo/odoo#99545

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-05 20:13:08 +02:00
Victor Feyens e648489401 [MOV] payment_test: rename to payment_demo
The name "Payment Acquirer Test" of the acquirer bundled with the module
`payment_test` is confusing. It is actually the only acquirer that
doesn't connect to a test API, and its purpose is not to make test
transactions but to showcase the integration of other apps (Accounting,
Sales, eCommerce, Subscriptions) with demo payments.

Hence, the module is renamed to `payment_demo` along with its data and
technical keys to better make the distinction between acquirers' test
environment and demo payments.

task-2853481

closes odoo/odoo#99397

Related: odoo/upgrade#3846
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-09-05 20:13:02 +02:00
Victor Feyens c9072dfe79 [IMP] payment_(alipay,ogone,payumoney,payulatam): deprecate the modules
The four payment acquirers implemented with these modules all present
a subset of the following issues:
- The user experience for the payment step is really bad: All of them.
- The API is poorly documented, breaks often, or is badly designed and
  hard to work with: All of them.
- It is no longer possible to open a new account: PayULatam, PayU money.
- The countries/payment methods/currencies coverage is limited: Alipay,
  PayU money.
- It is not possible to implement additional features such as
  tokenization, manual capture, or refunds: Alipay, PayULatam,
  PayU money.
- They have a better replacement already available in Odoo: All of them.

This commit thus deprecates the above-mentioned payment acquirers. This
means that their module can no longer be installed on new databases and
alternatives are suggested. Existing databases in which the modules were
already installed will keep working.

task-2806832

closes odoo/odoo#99025

Related: odoo/upgrade#3848
Related: odoo/documentation#2686
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-09-05 20:12:54 +02:00
Alexandre Kühn 4aa4c8e87f [FIX] im_livechat: do not cut header content in external lib livechat
Before this commit, chat window header in external lib had text
and button, due to chat window header being too narrow.

This commit fixes the issue by increasing the chat window header
height to match the visual in website livechat, which by itself
also fixes the text and button being properly visible.

Also adapt fold behaviour so it works on click anywhere in the
header, excluding buttons and title click.

Task-2973046

closes odoo/odoo#99542

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2022-09-05 18:36:01 +02:00
Kevin Baptiste 0c1d259728 [IMP] hr_contract: only show HR Officer as responsible
Add a domain on the HR Responsible field to only show HR Officers.

task-2959207

closes odoo/odoo#99540

Related: odoo/enterprise#31057
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-05 18:35:58 +02:00
Hubert Van de Walle (huvw) f592c67c37 [FIX] web: missing styles on o_form_nosheet
Steps to reproduce:

 - Go to reconciliation models
 - Click on Line with Bank Fees
 - Click on a x2many line
 -> The popup is missing some padding

closes odoo/odoo#99539

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-05 18:35:51 +02:00
tsm-odoo 3c09d6c5a9 [FIX] bus: fix websocket errors on local tests
When executing python tests with Odoo opened in the browser, the
websocket connection coming from the browser can lead to issues
with savepoints/rollbacks. Indeed, during test set up, a savepoint
is created. This savepoint is released at the end of each test.

The issue occurs when the websocket connection opens a cursor (and
thus creates a savepoint) after the one created by the test but releases
it after the one created by the test:
    - SAVEPOINT TEST
    - SAVEPOINT WS
    - ROLLBACK TO SAVEPOINT TEST
    - SAVEPOINT WS DOES NOT EXIST

In order to solve this issue, let's prevent browsers from opening a
websocket connection during python tests. This does not apply to chrome
headless since remaining threads are awaited before the end of every tour
(which means the websocket connection will be close before releasing the
test cursor).

closes odoo/odoo#99538

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-09-05 18:35:48 +02:00
Ivan Yelizariev e647811474 [FIX] point_of_sale: test session closing when an invoice is refunded
Definition of reconciled line was recently changed [1] and draft records are not
marked as reconciled anymore. However POS session closing still needs old
definition of reconciled line, because state of the related journal entry is
still draft and hence `reconciled` value is always equal to `False`.

STEPS

1. POS -> Open Session -> Order -> Invoiced
2. Backend -> Open Order - Return Products -> Payment -> Invoiced
3. Close session

BEFORE: error *You are trying to reconcile some entries that are already reconciled.*
AFTER: POS Session is closed successfully

But previous commit fixed it. This commit only adds a test.

[1]: https://github.com/odoo/odoo/commit/1d73bc7d5458b3bb3a566aa4b4a4b101a5329b9a

opw-2859747

closes odoo/odoo#99537

Related: odoo/enterprise#31051
Signed-off-by: William André (wan) <wan@odoo.com>
2022-09-05 18:35:42 +02:00
Miquel Raïch f607572da6 [FIX] account: matched move lines should be marked as reconciled
Fine-tuning of https://github.com/odoo/odoo/commit/c8c3aa96e18827c3c032540b92e95b27bbed0fc3.

Also, in _prepare_reconciliation_partials, consider case of having aml without credit, debit and amount_currency.

Part-of: odoo/odoo#99537
2022-09-05 18:35:41 +02:00
tsm-odoo d68a3867f3 [FIX] service: fix attribute error on request handler
In order for websocket upgrade to work with firefox, the http version
must be set to `HTTP/1.1`.

Until now, this was done in the `send_response` method. The issue is
that this method is also used when sending an error. This is problematic
because we use environ to know whether or not the version should be changed
which means any error during `BaseHTTPRequestHandler.parse_request` (such as
wrong http version) would have led to an AttributeError being raised.

In order to solve this issue, this modification is done when making environ.
Moreover, we previously used the request uri to know whether or not the version
should be changed, this was not really reliable, we now use the upgrade header
for this purpose.

closes odoo/odoo#99535

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-09-05 18:35:31 +02:00
Samuel Degueldre 8c1a93c800 [FIX] web: do not save settings on discard
The "beforeExecuteAction" of view buttons in the form view is set to
automatically save, so that when the user clicks a button which wil
change their current view, we ask them if they want to save their
changes.

In the case of the discard button, we  don't want to ask the user if
they want to save their changes, but we don't want to save either. This
commit fixes that.

closes odoo/odoo#99530

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2022-09-05 18:35:26 +02:00
Damien Bouvy deaed2ba46 [FIX] hr_expense: fix split wizard layout
Turns out having a <sheet> node is not well supported in layout
for dialogs, as it introduces unnecessary horizontall scrollbars.

closes odoo/odoo#99524

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-09-05 18:35:20 +02:00
Dardenne Florent (dafl) c4f9b94358 [FIX] web: daterange field: fix the input display
Before, the input of the daterange field exceeded the size of its
parent, which caused an overflow and thus a visual bug in the form
and kanban view.
Now the daterange field is displayed as expected.

Step to reproduce the bug:
- Event > Quick create : the daterange is overflowing the parent
- Event > Create : the daterange is not displayed as expected

task-2967165

closes odoo/odoo#99495

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-09-05 18:35:17 +02:00
Dardenne Florent (dafl) 915b2c3d89 [IMP] web: daterange field: update daterangepicker library
The `daterangepicker` was in version 3.0.5, since then the library is
now in version 3.1.

This version introduce a new feature that allows to automatically
(depending on the space left) position the picker above or below
the HTML element it's attached.

This commit updates the library but also take advantage of this update:

Before when clicking on a daterange field, even if there was no space
 left below, the picker was still displayed below the field.
Now, the picker is displayed above the field if there is less space
 below the field

Part-of: odoo/odoo#99495
2022-09-05 18:35:16 +02:00
Didier (did) 613448162a [IMP] mail: remove useless code in message edition
closes odoo/odoo#99487

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-05 18:35:08 +02:00
Stanislas Gueniffey 7a049df904 [IMP] account: dedicated payments sequence
Add setting on bank/cash journals to have dedicated payments sequences
Enabled by default

closes odoo/odoo#99058

See: odoo/enterprise#31059
Task: 2894299
Signed-off-by: Laurent Smet <las@odoo.com>
2022-09-05 18:35:05 +02:00
Rémy Voet (ryv) 4087bcdc5e [IMP] core: add unaccent to trigram indexes
We added trigram index for char fields since https://github.com/odoo/odoo/pull/83015.
But if `unaccent` is installed in the database (and isn't force to
`False` on field), these new trigram indexes are pointless and cost a
lot for nothing (almost nothing, it still can be used for equality
operator but in this case a btree will be far more efficient).

The simple way to fix it is to add `unaccent(<column>)` in the index
trigram definition, but unfortunately `unaccent` is not immutable and
may therefore not be indexed.  In order to make `unaccent` indexable, we
must declare it as immutable (see
https://stackoverflow.com/questions/11005036/does-postgresql-support-accent-insensitive-collations/11007216#11007216
for more information and how to do that).

With this patch, trigram indexes are created with `unaccent(<column>)`
if the function `unaccent` is available in the database, and for the
fields that are not declared with `unaccent=False`.  Moreover, we issue
a warning when `unaccent` is available but is not immutable, in which
case most trigram indexes will be useless.

odoo/upgrade#3736
task-2551518

closes odoo/odoo#95943

Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-09-05 18:34:53 +02:00
Lucas Perais 7f0f7bcdce [FIX] web: Many2One in list: keeps input after record create
Have a many2one in an editable list view. Type something in the input and click
on "Create and edit".

Confirm the record creation in the modal.

Before this commit, the input of the field disappears.

After this commit, the input stays.

closes odoo/odoo#99480

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-05 16:54:16 +02:00
tsm-odoo 591baa9003 [FIX] mail: fix indeterministic chat window manager test
Before this PR, some mail tests relying on DOM elements being present
but that are added after the messaging initialization could fail
unpredictability. This commit fixes this issue by waiting the next
render following the initialization of messaging.

closes odoo/odoo#99461

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-09-05 16:54:12 +02:00
Dardenne Florent (dafl) f0fbdb91e2 [FIX] web: kanban: fix kanban card drag&drop highlight
Since odoo/odoo@209a97c, the drag&drop of a kanban card in a columnn
is highlighted.

This feature was tested visually on a build that was not up to date
 with master.
Resulting in a visual conflict with [classes.push("bg-100");](https://github.com/odoo/odoo/commit/7cfe50749f89a2e2fdd5bfdcc943210f891e38c9#diff-4de8437424d1b687477e865e387b017fc5a6a86e9c50c9ea198da79d3a7a1a4cR266)
which overrides the highlight background-color.

This commit resolves this conflict to have the drag&drop highlight
 background.

closes odoo/odoo#99441

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-09-05 16:54:09 +02:00
Denis Ledoux f693e50476 [IMP] base: move back load_filters from get_view to get_views
It was moved during the refactoring of `fields_view_get`:
https://github.com/odoo/odoo/commit/b03c227e885efa4ccdcad43ccb56ee10371b9284#diff-7144f88ea32f36feb17ce1b8dda7dee1631f5ada34075414587df3948c6b3d1bL1637

But with the current refactoring to cache the back-end views,
its place is better in `get_views` as before.

For instance, one reason is that the checking of the condition
`options.get('load_filters') and view_type == 'search'`
will be checked multiple times when calling `get_views` with multiple
views.
If `get_views` get called for kanban, list and form, the above
condition will be checked 3 times,
while it will be only once in `get_views`.

closes odoo/odoo#99417

Related: odoo/enterprise#30974
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-09-05 16:54:02 +02:00
Denis Ledoux 1744870d8d [IMP] base: cache back-end views
The master plan finally comes to an end.

Thanks to:
- odoo/odoo#87522 refactoring `load_views`,
- odoo/odoo#94337 refactoring `common.Form` to prevent changing
    invisible fields in unit tests using `Form` instances,
- odoo/odoo#95729 refactoring the behavior of `groups=` in views,
- odoo/odoo#98551 removing the need of the `groups_id` many2many field
    on back-end views.

The result returned by `get_view`/`get_views` can now finally be easily
and efficiently cached, in order to cache back-end views.

The goal of this revision is to cache the model views and fields
already post-processed for the web client
(with the modifiers, etc., already computed)
without group restriction.
Then, from this cached version, post-process group related features,
such as removing nodes restricted with a `groups=` attribute,
set the create/write button according to the user access rights to models, ...

Not including the groups in the cache key allows:
- to have less cached versions,
  (otherwise it would be one cached version per different group combination)
- to not have to fetch the user groups to compute the key
  (with the current cache key,
  there is nothing to fetch from the database to compute the key)

Besides, post-processing the groups features
after taking the view from the cache of the view doesn't take a tremendous time:
 - parsing arch from/to string with etree is fast,
 - removing the `groups=` nodes using etree is fast,
 - adding the `create="False"`, `write="False"`, `delete="False"` on the view
   root node according to the access right of the user on the model is fast.

This allows way faster calls to `get_views` by the web client,
as the server no longer need, for each call, to fetch the views in database,
combine the inherited views, post-process the modifiers attributes, etc.

Timing tests are available on the pull request of this revision.

Part-of: odoo/odoo#99417
2022-09-05 16:54:01 +02:00
Denis Ledoux 2dccc0d031 [IMP] base: faster get_bindings
The cache key of _get_bindings was not super efficient.
The result of _get_bindings is cached,
but its performance was altered by the cache
key which requires to fetch the user groups for each call to
_get_bindings.
Besides, as there is a lot of possible group
combination, this resulted in a lot of possible cache keys,
and therefore a lot of cached values.

This revision aims to make _get_bindings more efficient
by:

- do not use the groups in the cache keys (less cached values)
- filter out actions not available to the user groups after
  retrieving them from the cache
- use has_group to do the above, which is itself cached as well,
  and therefore do not need to fetch the user groups
  at each call to get_bindings.

In addition, move get_bindings from `get_view`
to `get_views`. If there was 3 views asked by `get_views`
(let's say kanban, list, form)
`get_bindings` was being called 3 times, through `get_view`
with each time the same arguments and therefore the same result :-).
Moving it to `get_views` allows to call it only once for all view types
requested, and for the web client it doesn't change much,
as it always request the toolbar/get_bindings through `get_views` only.

In addition, add the lang to the cache of _get_bindings.
it was actually a bug not to put it: if you had 2 users
with the same group set, using 2 different languages,
the user accessing first the get_bindings would cache
the action names within his language, and then the second
user would see the action name within the language of the first user
:-).

Before
```py
In [1]: %time for i in range(1000): self.env['ir.actions.actions'].get_bindings('res.partner'); self.env.invalidate_all();
CPU times: user 790 ms, sys: 104 ms, total: 893 ms
Wall time: 1.7 s
```

After
```py
In [1]: %time for i in range(1000): self.env['ir.actions.actions'].get_bindings('res.partner'); self.env.invalidate_all();
CPU times: user 23.5 ms, sys: 9.12 ms, total: 32.7 ms
Wall time: 36.9 ms
```

Part-of: odoo/odoo#99417
2022-09-05 16:54:01 +02:00
Louis Wicket (wil) ff49527fb5 [IMP] mail, *: convert ThreadPreview to use Channel instead of Thread
* = im_livechat, rating, test_mail_full

Part of task-2948676.

closes odoo/odoo#99342

Related: odoo/enterprise#30921
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-05 16:53:52 +02:00
Louis Wicket (wil) 9beb2b13d3 [MOV] mail, *: rename ThreadPreviewView files to ChannelPreviewView
Part of task-2948676.
* = im_livechat, rating, test_mail_full

Part-of: odoo/odoo#99342
2022-09-05 16:53:52 +02:00
Thanh Dodeur a78adfb8a3 [IMP] mail: adds the blur feature to video calls
This commit implements the blur feature to the user-video (=not screen
sharing) during video calls using google's MediaPipe library*.

* https://google.github.io/mediapipe/

task-2818116

closes odoo/odoo#94982

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-09-05 16:53:45 +02:00