Commit Graph
5538 Commits
Author SHA1 Message Date
Christophe Monniez 9e41603743 [FIX] tests: fix race condition when spawning chrome
When Chrome is spawned, the `DevToolsActivePort`file is awaited to read
the port. Sometimes the file is read but is still empty, resulting in a
ValueError when trying to cast into integer. This happens when Chrome
did not have time yet to write into file.

With this commit, we expect the file to contain at least 5 bytes which
is enough to contain the max port number.

closes odoo/odoo#80791

X-original-commit: aab53fbb4e02461e0f23cf202d393e30a73fbc92
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-12-03 08:55:46 +00:00
Martin Trigaux b50a705d04 [FIX] base: ensure all attachments are in sudo
>>> u1 = self.sudo(False).browse(1)
>>> u2 = self.sudo().browse(2)
>>> (u1 + u2).env.su
False
>>> (u2 + u1).env.su
True

Ensure all attachments are always in sudo

Before this commit, a portal user could not go in debug asset

Introduced at 3a98996eed

closes odoo/odoo#80807

X-original-commit: 9f0ce611b2acf5927a7703a7811081c4adbc3f41
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-03 07:27:40 +00:00
Victor Feyens 69dc4bba42 [IMP] core,sale: enforce batch creation support for sale order (lines) 2021-12-02 12:12:04 +01:00
Yannick Tivisse 232d66069a [IMP] sale: Make some field precomputed 2021-12-02 12:12:03 +01:00
Christophe Monniez c6600d1ea4 [IMP] core: bump master release version to 15.2
closes odoo/odoo#80708

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-12-02 08:31:59 +00:00
Victor Feyens 2f1b15d982 [FIX] core: in _auto_init, only log computation message if table is not empty
closes odoo/odoo#80687

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-12-01 17:09:00 +00:00
Yannick Tivisse 87224e158c [IMP] core: precompute docstring
Part-of: odoo/odoo#80687
2021-12-01 17:09:00 +00:00
std-odoo 3b97f601be [FIX] base: avoid variable name collision with functions in QWeb
Bug
===
The arguments of the lambda function might be the same as other
variables in the QWeb. In that case the template rendering will crash.

To avoid this issue, we encapsulate the name of the argument to be sure
it's not the same as other variable in the QWeb engine (so the name of
the argument can no longer make the QWeb rendering crash)

Task-2674716

Closes #78392.

Forward-port of 96b09b127028e5c9a83c89acce86e1b6df904c6f
2021-12-01 17:30:51 +01:00
Martin Trigaux aa07f93ef7 [IMP] package: update lxml version
Update the version to benefit from the fix for
https://github.com/advisories/GHSA-pgww-xf46-h92r
https://nvd.nist.gov/vuln/detail/CVE-2020-27783

This vulnerability is reproducible in Odoo with
html_sanitize(..., sanitize_tags=False) which does NOT happen for
user-facing content.

Remove old compatibility check (lxml 3.1 was released in 2013)
and cleanup global variables only used once

closes odoo/odoo#64248

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-12-01 14:07:47 +00:00
Raphael Collet 0011823932 [FIX] core: cr.transaction no longer depends on registry
The cursor features a "transaction" object to manage application-
specific data in relation with cursor operations.  In its initial
implementation, the transaction object was created by the registry.
This created a requirement: in order to be used in environments, a
cursor had to be created by registry.cursor().

We now remove that unnecessary technical requirement by making
environments create the transaction object on demand.

closes odoo/odoo#80644

X-original-commit: e902713648bca329e6821859462b2128aad62c09
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-12-01 08:44:48 +00:00
d04a5b5c8c [REF] core: compute fields before database insertion.
Until now, stored compute fields were computed after database insertion.
This meant that required fields should not be computed, for instance,
unless some hackish code was added to make it work.  Another trick was
to provide some default value, but this actually prevents the field for
being computed after insertion.

This commit provides a field parameter to specify that the field should
be precomputed: adding precompute=True on the field definition force the
method create() to compute its value before inserting the new record in
the database.  For the reason explained below, precomputing fields is
not always correct, and therefore the default remains to not precompute
a field.

Some stored fields must be computed after insertion, for instance:
* statistics fields computed with search/read_group/...
* fields referencing the current record (res.partner.commercial_partner_id)
* fields referencing another record that does not exist yet (think about
  records created by one2many fields)
* fields depending on the create_date/write_date/create_uid/write_uid

Those fields shouldn't be defined with precompute=True, which triggers
their computation post record creation.  This is why, by safety, we
consider the default behavior to be precompute=False.

closes odoo/odoo#80449

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Yannick Tivisse <yti@odoo.com>
2021-11-30 14:30:48 +00:00
Julien Castiaux 12589081b0 [FIX] base: cron "run now" button runs without ctx
Change the lang of your user, translate the name of some records (e.g.
translate the "Customizable Desk" product to "Bureau personnalisable")
and create a cron that simply log the name of that record. Schedule the
cron to be automatically executed, check the created log entry (setting
> technical > logging) it is the default english name. Go back to the
cron, click "run now" contextual button, check the created log entry: it
is the translated name.

When they are automatically executed by the cron worker, crons run with a
minimal context without lang. When the user clicks on the "run now"
button his context was wrongly used while executing the code.

Closes #45388

closes odoo/odoo#80532

Signed-off-by: Julien Castiaux <juc@odoo.com>
2021-11-29 16:27:58 +00:00
Rémy Voet (ryv) c3399b5470 [FIX] base: fix performance scalability of create
Issue:
------
The `create` method (models.py) doesn't scale correctly
(with huge number of values) when compute store no-readonly
field(s) are in values (at most one).
It is due to the method `protecting` (api.py) which has a
bad complexity in the `create` situation
(list of (field, records) pairs as argument):

O(r²) with `r` = number of record containing the protected field:
List of `len(r)` send to `protecting`,
loop of this list (`r` factor), loop on fields (constant factor),
create a new frozen set with the previous one (`r` factor).

Fix:
----
Decrease the complexity to O(r) by creating a map of set of ids by
protected field which allows avoiding recreating a new frozenset
for each record (update with tuple of one inside => O(1)).

Performance gain:
----------
For a very simple model with only one compute store no-readonly field,
and all `create` `values` contains this field.
+--------------+---------------+---------------+---------------+----------------+
|   Batch ->   |     1000      |     10000     |    30000      |     80000      |
+--------------+---------------+---------------+---------------+----------------+
| Before (sec) | 0.083 ± 0.006 | 1.433 ± 0.091 | 8.764 ± 0.609 | 94.428 ± 3.021 |
| After (sec)  | 0.069 ± 0.003 | 0.706 ± 0.006 | 2.188 ± 0.076 | 5.875 ± 0.104  |
+--------------+---------------+---------------+---------------+----------------+

closes odoo/odoo#80437

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-29 11:22:24 +00:00
Victor Feyens cfda86fa53 [IMP] base/settings: avoid forcing the flush
when no modules needs to be (un)installed.

closes odoo/odoo#62249

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-26 09:44:58 +00:00
Victor Feyens 76982c059c [IMP] base: do not apply/reset unmodified settings
When "Saving" a settings wizard, all its settings are written, even if
not modified.

This implies updating ir.default and ir.config.parameter models.
By verifying whether there were effective changes, we can
avoid:

1) the searches to get the corresponding records from database
2) the cache clear triggered by default/parameter updates/creation

This commit thus reduces the queries triggered when saving settings,
but also the queries of future operations, since we avoid clearing
the ORM cache if not needed.

Part-of: odoo/odoo#62249
2021-11-26 09:44:58 +00:00
Victor Feyens 27fc76dcd1 [IMP] base: use cached reference when fetching groups in settings
The settings wizard provides the implied_group logic to add/remove
implied_groups to an existing group (by default base.group_user).
When verifying those special fields (onchange, default_get and execute
calls), ref is called once by group, by field.

E.g. a field
group_broll = fields.Boolean(implied_group="broll")
will trigger two refs ("broll" & "base.group_user") for each
onchange/default_get/execute call on res.config.settings.

This commit uses the cached method to fetch ir.model.data,
avoiding a lot of queries (depending on the fields defined on
res.config.settings model)

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
Victor Feyens 34dd6a2dba [IMP] base: provide a cached method to fetch module records
Following the API for ir.model records, the same logic is provided for
ir.module.module records.

This allows to avoid a bunch of queries when modifying/opening settings.

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
Victor Feyens 659bc441da [IMP] base: do not compute unwanted defaults for settings wizard.
At create, the ORM fills the missing create values with the defaults,
calling default_get.

In the case of res.config.settings model, the default_get overrides triggers
a lot of operations to manage its custom field logic (config parameters,
defaults, modules installation, ...).

This slows down the creation (and application) of settings updates for "nothing".

This commit ensures the defaults are not recomputed for fields whose value
was provided to the create call, reducing the effective time of settings flow.

Part-of: odoo/odoo#62249
2021-11-26 09:44:57 +00:00
wan 2b80f3e5f1 [IMP] core: allow nested declaration of xml for one2many fields
Some data are formatted as a tree structure with a relation of parent.
We are adding meaning to the structure:

* This improves readability and allows to fold/unfold records in
  editors.
* This could be done before using `eval`, but this allows to have an
  xml_id for those records. It also allows to update the records without
  having to rewrite on the parent x2many field.

Part-of: odoo/odoo#76675
2021-11-25 00:31:16 +00:00
Goffin Simon 669976db67 [FIX] base: The symbol ANG must be before the amount
REF:https://www.xe.com/currency/ang-dutch-guilder/

opw:2690166-

closes odoo/odoo#80188

X-original-commit: e84af51ffbb550d069288e498e96604cb610443e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-11-24 15:49:11 +00:00
Elisabeth Dickinson 8a01be5d62 [IMP] base: redesign company image
Align style of company_image.png with avatar_grey.png to keep interface
and usage coherent.

Task-2487489
Task-2688887

closes odoo/odoo#80304

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-24 12:31:17 +00:00
Florent de Labarre 49a23bb3fa [FIX] base: simplify field dependencies to avoid costly invalidation
Consider upgrading module 'base' on a database with millions of 'res.partner' records.
The upgrade of country and country state data makes a very costly search to reverse
the dependencies of the non-stored computed field 'contact_address', just for the sake
of invalidating its value from cache, which is most probably not present at all.  The
cost of the search is so high that it may prevent from upgrading the module (timeout).

closes odoo/odoo#80251

X-original-commit: b7f9d0b7c3dfbca0f4897a650983a298da811ce1
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-23 13:55:01 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Julien Mougenot 54b45aec9e [FIX] base_import_module: Keep manifest assets of dynamic modules
The `ir_import_module` module is used by users to upload custom module
data via a zip file. The zip file can contain xml data, xml views and
static files.

Before this commit, the "import module" feature of this module was
broken since the imported module's manifest was lost after the import
was performed.

Now, 'ir.asset' records are created along with the attachments pointing
to the imported static files.

closes odoo/odoo#80120

X-original-commit: ec77577796e72707fbb2077f05067428cebc3c7f
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2021-11-22 11:12:44 +00:00
Jeremy Kersten 27df588c15 [FIX] *: remove trailing slash from controllers
Follow-up of c1ae086cdb

closes odoo/odoo#80139

X-original-commit: 58ee1a5906e4b2a50fb248085abd9caab97f4c52
Related: odoo/enterprise#22421
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-11-19 18:53:45 +00:00
Jeremy Kersten 7f3a2b700f [FIX] base: fix acl error on wizard merge contact
Since 5dc4cff60a, we removed the access read on ir.model.*

Before this commit, an employee without admin rights cannot merge partners
because he doesn't have the right to read the model ir.model.fields.

Now with use a sudo to find the reference field and avoid the traceback.

closes odoo/odoo#80119

X-original-commit: 1815b108004b407714705b6f62b65f4cfc38a395
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-11-19 16:33:16 +00:00
Nicolas Martinelli 7bbe15bc15 [FIX] base: GC files progressively
- Get a database with millions of files in the checklist (do not ask how
  this happened)
- Set a cron timeout low enough so that `autovacuum_job` times out

The file GC will endlessly timeout without being able to delete any
file.

This is due to how the `_file_gc` method is built: we first build the
whole whitelist, then we perform the deletion. With millions of
checklist files, the loop which builds the `whitelist` takes ages. It
ultimately leads to a timeout of the scheduled action, and therefore no
file is deleted.

To avoid this, we delete the files progressively. The checklist is split
in chunks, and we check which files must be GC'd in a given checklist
chunk. This way the files are removed even in case of timeout, meaning
that there will be less files to check during the next run. Eventually
the GC won't timeout anymore.

closes odoo/odoo#79834

X-original-commit: dbae52479062ace9e2b2d376ec2d601d86482f86
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2021-11-16 12:20:02 +00:00
xmo-odoo 2789824fcc [FIX] core: dbname threadlocal in evented CDT
Since #77735 the chrome runner uses a receiver thread to better handle the
full-duplex nature of Chrome's websocket communication.

However that thread was missing the `dbname` threadlocal, leading to some of
the logging and reporting to be mis-configured, and thus the filtering on CI
(runbot) to exlude any logging message emitted from the receiver thread, such
as the screenshot notifications.

Fix by passing the current `dbname` to the receiver thread when spawning it,
and having said receiver start by setting up the threadlocal.

closes odoo/odoo#79808

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-11-16 11:34:37 +00:00
张文广 d0d8d28cba [FIX] base: return all the css attachments
When detecting if the assets where already preprocessed, the method
only the last asset type matching was returned and deleted.
In standard, it should not have any impact as all assets are of the
same type but it may be possible to mix it with external modules.

Sign CLA

closes odoo/odoo#79786

X-original-commit: 0c2f83f4a6c4603d107007ac77c94e6a2805cd81
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-15 16:41:28 +00:00
Raphael Collet 8b6232ed25 [FIX] tests: allow OdooSuite to handle unittest.TestCase without crashing
closes odoo/odoo#79713

X-original-commit: 6ae762f1e4a7f3eb5320d28428310905961dfad3
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-15 08:18:26 +00:00
Aktiv Software 8143a641a2 [FIX] base: remove duplicated mandatory field name
When trying to save a new res.partner without name, an error appeared saying
Invalid fields:
- Name
- Name

Add condition to the domain to make it required only when displayed

Fixes #77976

closes odoo/odoo#79727

X-original-commit: f65e3d9d21d269058dd842a4319b5b2242df103e
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-13 07:15:46 +00:00
Leonardo Pavan Rocha 351056ec5d [IMP] base,hr: add tests for avatar mixin
In task 2404630 the avatar feature was created and no tests were written due to
the iminent freeze. This PR implements tests for the avatar feature, such as
avatar generation and placeholder logic.

task-2578233

closes odoo/odoo#79688

X-original-commit: 400b3fd93266f88832446c8f7422f6e14b958115
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-11-12 12:00:23 +00:00
Stefan RijnhartandRaphael Collet 8f574a274a [14.0][FIX] Keep original kwargs intact for reuse on retry
closes odoo/odoo#79589

X-original-commit: 6387619d308c8969cbafe6acf77f6d22075ac6ba
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2021-11-10 10:43:17 +00:00
Xavier-Do 9b1957fd81 [FIX] core: revert check on new models before setup
This reverts commit 9cc4d6956b71291958114196107b1889109e92a1.

How to reproduce the issue:
- Starts from a database with some modules installed (account).
- Install a module with data only (l10n_generic_coa)

The models are not setup and the data fails to install.

A proper fix would be to mark the registry as dirty when new models are
added and only setup models when needed.

Since the faulty commit was part of a bunch of optimization and the
impact of this particular one is quite small, reverting it is a quick
and easy fix waiting for a better one (maybe, one day).

closes odoo/odoo#79552

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-11-09 14:46:21 +00:00
std-odooandnounoubensebia cd8e0e9f46 [IMP] base, *: hide non-relevant fields for portal users
Purpose
=======
Hide non-relevant fields for a portal user. E.G. we want to hide the
notification type,  the menu customization... Because those fields
make no sense for a portal user.

Force the non-internal user to receive notifications by emails since
they can not open Discuss.

Task-2508521

Part-of: odoo/odoo#77766
Co-authored-by: nounoubensebia <neb@odoo.com>
2021-11-09 14:45:49 +00:00
std-odoo 7b3685052c [IMP] base: make the onchange of the "virtual group fields" work
Purpose
=======
In the `res.users` view, we can add / remove a group of a user with a
simple selection / boolean field.

This trick is done with an override of "fields_get" to return fields
that don't exist, and override the create / write to write on the
"groups_id" when we write on those "virtual fields". So with this trick
we can create new fields in the `res.users` view by just adding a new
group.

So when you write on the virtual fields, it will add / remove a group.

But this implementation will not trigger the on-change of "groups_id"
(because those field do not exist).

With this commit, the "onchange" of `groups_id` field will be triggered
when you write on those virtual fields (and so the computed method
which depends on `groups_id`, e.g. the `share` field).

Task-2508521

Part-of: odoo/odoo#77766
2021-11-09 14:45:48 +00:00
Thibault Francois ade64948ab [FIX] cloc: re introduce exclusion of design theme
Since
https://github.com/odoo/odoo/commit/ebf8d67485f7f71f6eb51762298cf50c5835ee08
design-themes repo is not excluded from the cloc count.
The module website_animate that was used as beacon to identify
the folder that contains the design-themes as been merged into website.

We need a new one, theme_common seems a reasonable candidate

closes odoo/odoo#79512

X-original-commit: f493b43462b7db14bb7f2b444c189f284acb1a1d
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-11-08 17:48:49 +00:00
Nasreddin Boulif (bon) 0e50113f69 [FIX] base,l10n_ch,account_qr_code_sepa,payment,websitesale: Display all QR codes in QR bill
Issue:

  When trying to print a Suisse QR bill, if multiple images are presents
  in document and they have a url as src, some pictures will not be
  displayed.
  (Same issue may occur with simple QR code)

Cause:

  It's a known issue with wkhtmltopdf: https://github.com/odoo/odoo/commit/2949138a7d84cd6c925ea1745d62f25ef077bb8b
  Also, adding css class to body by js break wkhtmltopdf.

Solution:

  Replace link by base64 image value (use a function to retrieve base64
  image instead of image_url).
  Remove class 'l10n_ch_qr' added by js (no need since CSS file didacted
  to this report).

  Move `_get_qr_code_base64` and `_get_qr_code_url` logic/flow
  (since generic) to account module.
  Move specific logic like `_get_qr_vals` and
  `_get_qr_code_generation_params` to specific module (ex: l10n_ch).

  extra: Alter some css for better rendering + update unitest.

opw-2620082

closes odoo/odoo#77643

X-original-commit: 699b6eeac993e3a8d97ae7949170f7e18ca05831
Signed-off-by: Olivier Colson <oco@odoo.com>
2021-11-08 09:25:47 +00:00
Raman Salihi 4cad597041 [FIX] base: use display_name instead of name in assert_log_admin_access
`assert_log_admin_access` uses the `name` field of `ir.module.module` for logging.
`assert_log_admin_access` was added to `install_demo` method of `ir.demo` in d345fb649e3e3c1bf141dca49b45503b8b3a7164 but `ir.demo` does not have `name` field, hence causing AttributeError.
The proposed solution here is to use `display_name` instead

closes odoo/odoo#79398

X-original-commit: 9d6f54e7f7219cbbda41129e35682f6a76aae1d4
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Raman Obaid Ahmed (raob) <raob@odoo.com>
2021-11-05 11:00:54 +00:00
Rémy Voet (ryv) 837e72fbfa [REM] base: remove unused code in translate.py
Remove unused code of translate.py file:
- remove unused trans_parse_rml method (since 3425752eac)
- remove unused in_modules method (since eb04aa1e39)
- remove unused ENGLISH_SMALL_WORDS set (since d85bf78976)
- remove unused node_pattern compiled regex (since 085e972e4a)

task-2678192

closes odoo/odoo#79011

Signed-off-by: Rémy Voet <ryv@odoo.com>
2021-11-03 11:06:18 +00:00
Martin Trigaux 8ae1a43663 [FIX] base: correct evaluation context for report rendering
Fix of 57665a02f7b4 which was problematic in point_of_sale
2021-01-19 11:09:41 +01:00
Adrian Torres ed6595ed15 [FIX] base: prevent messing up existing registry 2021-04-08 08:20:03 +02:00
Christophe Simonis b81850a123 [IMP] core: large object support 2021-04-20 11:40:02 +02:00
Xavier Morel b51b094c2b [IMP] http: avoid cycle on request 2021-01-26 09:05:35 +01:00
Yannick Tivisse a7e99e261f [FIX] ir_demo.py: Force admin access to load demo data
Only admin users should be able to load demo data, if needed.

This is only possible from the settings dashboard, and thus,
the method could be decorated.

See: c002e2eb37
2021-09-20 13:01:55 +02:00
Didier (did) 1afcc9c368 [IMP] bus, mail, *: improve longpolling bus notification format
* = auth_signup, calendar, im_livechat, snailmail_account, survey, test_mail,
    web_editor, website_crm_iap_reveal, website_livechat

The aim of this PR is to improve/fix various flaws and limitation of the current
API, to make it easier to use and more efficient.

Notification are now defined with 3 distinct parts:

- the channel determines which client(s) should receive it
- the type determines how it should be handled
- the payload determines any extra information helpful for handling it

Channel
=======

Business code
-------------

- Record channel is introduced for ease of subscribing to and sending
  notifications to specific partners, channels, documents, ...
- String channel is still supported (but it is converted internally to the tuple
  channel).
- Tuple channel is still supported without any change (but should be avoided
  whenever possible due to its complex syntax).

The channel is no longer sent to the client. When the channel was used for
business purpose, the information it contained has been moved into either the
new type, or the payload itself.

Technical note
--------------

All channels are now internally converted to the tuple (db, ...) channel, which
is necessary for the platform code (saas/sh).

Internally, the bus.bus table is not changed, type and payload are grouped
together into what was (and still is) called message.

Type
====

Type is introduced to uniformize the way notifications are sent and handled.
All existing notifications already had some kind of manually-built type in them.
This is now officially supported at the bus API.

In client code this will allow (to be done in future commits) to register one
handler per specific type, instead of having to iterate and to filter all
received notifications on every handler.

Payload
=======

Payload (ex message) did not change, it can still be anything depending on
business needs.

Few adaptations:
- When the type was included on the payload, the type has been moved to the new
  type parameter.
- When the channel was used in business code, its data has been copied into the
  payload.

task-1891151

closes odoo/odoo#79201

X-original-commit: 543af27c7d6836ffac9e80ff8490b6ddbd849221
Related: odoo/enterprise#21998
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 16:05:23 +00:00
Paolo (pgi) fe7ed6627d [FIX] base: invalid UNIQUE constraint just warn
When a submodule overrides an old UNIQUE constraint with a new one,
records in that module may respect the new one and not the old one.
As the old module is updated, it would fail giving an ERROR message,
and therefore blocking the Odoo.sh deployment pipeline.

i.e. website_sale (old): res_users_login_key -> ['login', 'website_id']
             base (new): res_users_login_key -> ['login']

With this patch, the error level is changed from ERROR to WARNING,
leaving Odoo.sh free to continue the build deployment, as the error
was not a blocking one.

closes odoo/odoo#79199

X-original-commit: 8ed3641f81502d3a7e9c9bb93771c6f5601a31a9
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2021-10-29 14:07:47 +00:00
Florent de Labarre d9300962c1 [REF] base: add _is_public on partner
To be use in mail, ... and prevent issue with archived partner

closes odoo/odoo#70665

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 14:07:43 +00:00
Olivier Dony dc99d15fdc [FIX] web,base: make code more defensive, cleanup
Following-up to previous commit, this one makes the
`get_translations_for_webclient()` more defensive with regards to the
absence of a `lang` key in the context, rather than relying on callers
to protect it. The rest of the logic was already fine with this.

This allows simplification of the `session_info` logic and removal of
the conditional for `translation_hash`.

Further cleanups in `session_info()`:
 - removed a duplicate calls to `session.get_context()`
 - removed duplicated resolutions of `request.session.uid`

closes odoo/odoo#79182

X-original-commit: 3eca1a2e58b8c644c0701d33d0c9d0330bdc234f
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2021-10-29 11:54:21 +00:00
Rémy Voet (ryv) 846647229f [IMP] core: remove dead code
closes odoo/odoo#78948

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-10-28 16:08:46 +00:00