Commit Graph
6281 Commits
Author SHA1 Message Date
Andro Gvivradze 01703e3ac8 [FIX] base: send correct report paperformat to wkhtmltopdf
Prior to this commit get_paperformat function in ir_actions_report.py file
was trying to get a paperformat_id of an empty report and as there was none
was automatically returning company paperformat_id. After this commit said
function will try to get a paperformat_id of the report with specific
report_ref value.

Task-2980708 (Fix Ticket Reports)

Closes odoo/odoo#100199
Closes odoo/odoo#104561
Closes odoo/odoo#100715

closes odoo/odoo#104915

X-original-commit: 78e2c6456d2f9f06d42c18d7b1849d5fad4deb46
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-11-04 09:52:59 +01:00
Tommy (tong) 9ed41b2bd7 [IMP] base: add Malay language
Purpose
=======
Add Malay language for Malaysian Localisation.

X-original-commit: 9dcb35a62b7d23249442a9ab045e88cb57165208
Part-of: odoo/odoo#104734
2022-11-04 09:52:54 +01:00
niyasraphy 3fbb79f62c [FIX] base: update app list wizard text alignment
closes odoo/odoo#104869

X-original-commit: cea6974f35289d1ed47dfcf822a4dc25b0e8494c
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2022-11-03 16:43:34 +01:00
Thibault Delavallée aa323c3e36 [FIX] base, snailmail: Swaziland is now Eswatini
Swaziland was renamed to Eswatini in 2018. Time to update naming in Odoo.
We choose to make it in 16 as

  * it is the newest stable, not much people are using it in production, aka
    most people will have the updated name;
  * there is no need to rename it for all production databases previously
    as if used, it is easy to update its naming from Odoo directly;

Cheers !

X-original-commit: 4f97baa5b4d01b4510f0adc7064ec2846612a481
Part-of: odoo/odoo#104770
2022-11-03 08:42:51 +01:00
william eaa2e3b452 [FIX] base: import related field with name containing %
To reproduce, import and invoice containing one line with a tax of
i.e. `21%` on it.

Because the message is recursively expanded to follow the relation of
the field, the interpolation symbol needs to be escaped every time.
Otherwise the message will contain something like
> No matching record found for name '21%' in field '%(field)s/Taxes'

Where `'21%'` will try to be mistakenly interpolated.

X-original-commit: ceb3ce3030b47baa2aca128d364a823becb173ab
Part-of: odoo/odoo#104764
2022-11-02 22:20:40 +01:00
Rémy Voet (ryv) f66fa9433f [MOV] core,base: move logic of O2MIdMapper
O2MIdMapper Class inherit of 'base' Model to change the behavior of
`create`.
Because it is in base and the `_import_current_module` is set in
models.py, move it at the end of create in models.py.

closes odoo/odoo#99550

Related: odoo/enterprise#33063
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2022-11-02 15:34:30 +01:00
Rémy Voet (ryv) 3353dfdb29 [REM] core,base,*: deprecated some methods to be remove correctly later
- Deprecated `norecompute` (on Environment class) because it is useless
and do nothing.
- Deprecated `cache_restart` (`res.company`) because `clear_caches` do
the stuff.
- Deprecated `write_company_and_print_report` (`res.company`) because
since https://github.com/odoo/odoo/pull/33863/, it is unused
- Deprecated `open_company_edit_report` (`res.company`) because since
25f7040998, it is unused.

Part-of: odoo/odoo#99550
2022-11-02 15:34:30 +01:00
Hoang Tran 5c907fe1e3 [IMP] core: make sure addon dir exist before loading
Loading an non-existing addon directory affect all other modules to be
not loaded. This commit makes sure the path exist before proceed to
explore all the modules under that directory.

closes odoo/odoo#104704

X-original-commit: d77d9f8a9ff945f5f61924eda835c877eb4f281c
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-11-02 12:37:21 +01:00
Chong Wang (cwg) ca70d74766 [FIX] web: fix translation dialog
In the PR #97692, writing empty str `''` to a model term field no longer removes
all translations. Instead, only the translation for the current language is set
to empty str `''`.

Before this fix, if a web user sets a translation to emtpy str, and reopens
the translation dialog, the translation will be reverted to the 'en_US' value
which is wrong.

closes odoo/odoo#104181

X-original-commit: f97ff6308d472121e65a34d30b4dc5ab35065220
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Wang Chong (cwg) <cwg@odoo.com>
2022-11-02 12:36:59 +01:00
niyasraphy 00f4161182 [FW][FIX] base: server action sample code line-breaks
In the server action form, in state "code" ("execute python code") a linebreak is missing between the two "lines" of python, resulting in nonsensical code.

closes odoo/odoo#104682

Forward-port-of: odoo/odoo#104665
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-11-02 11:38:35 +01:00
Rémy Voet (ryv)andniyasraphy 998de25f51 [IMP] base: improve model description
closes odoo/odoo#104555

X-original-commit: 67323e4f0af942e60bc6332282315c811c7d7e24
Signed-off-by: Rémy Voet <ryv@odoo.com>
Co-authored-by: niyasraphy <niyasraphyk@gmail.com>
2022-11-02 10:40:19 +01:00
Krzysztof Magusiak 167cf8fff8 [FIX] tools.image: Update IMAGE_MAX_RESOLUTION
New phones go up to 48MP (Samsung Galaxy A22).
Also the error message was saying 4.5 instead of 45.

opw-3020614, opw-3020502

Close #104424

closes odoo/odoo#104546

X-original-commit: 8b19107c69c648dbfba2a9304c04f0f55aac4b46
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-11-02 09:45:40 +01:00
Niyas Raphy 6710a84d6e [IMP] base: Better breadcrumb for cron triggers
The breadcrumb uses the "name" field by default which is lacking for
cron triggers. Use the cron name instead so that it shows

> Scheduled Actions Triggers Base: Auto-vacuum internal data

instead of

> Scheduled Actions Triggers Base: ir.cron.trigger,1

See also #69096

closes odoo/odoo#104599

Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-10-31 14:33:56 +01:00
Nils Hamerlinck b92082d494 [IMP] http: bind http.request before calling _get_session_and_dbname() on new request
closes odoo/odoo#104605

X-original-commit: a4a71d34ffa60154f2764e1dfa5b0d688644603c
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-10-31 13:39:53 +01:00
Joseph Caburnay 1a4750942a [IMP] base: truncate long email in res_users kanban
Instead of making the language badge a list item, we bundle together
the email and the language badge and put them in a flex container
that wraps when the email is too long. The .ms-auto in the language
badge element makes it "float" to the right (or end).

Furthermore, we removed the t-if conditions because:
- Email (login) field is required anyway so it will always be there.
- Language badge will not render an element if it's empty.

closes odoo/odoo#104262

Task-id: 2758990
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-10-31 13:39:51 +01:00
Julien Castiaux 7d9f117505 [FIX] website: generate routing map without request
This fix allows generating the sitemap (via `website.search_pages`) via
RPC. The changes are necessary as since #99667 the `request` object is
no more available to RPC-executed functions.

See also: the `test_search` test case of `website.tests.test_page`.

closes odoo/odoo#104567

X-original-commit: 8f4e214417cfb1aed7e595b8d6ab71f33a347b29
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-10-29 04:51:02 +02:00
Julien Castiaux 1e57ad2076 [FIX] base: no request.is_frontend attribute in RPC
Install website then render a qweb template via xmlrpc, attribute error:
`request` has no `is_frontend` attribute.

Inside the qweb's `_prepare_environment` override of the http_routing
module (a dependency of website) is the following code snippet:

    if (not irQweb.env.context.get('minimal_qcontext') and
            request and request.is_frontend):
        return irQweb._prepare_frontend_environment(values)

The conditionnal is about injecting extra informations in the qweb's
context in case we are serving a frontend request. By default, there is
no `is_frontend` attribute on the request object. That attribute is set
by the ir.http's `_match` override of the http_routing module (a website
dependency): it is set True when we don't match any endpoint or that we
match an endpoint that is `website=True`, it is set False otherwise.

The ir.http's `_match` method is called whenever we are serving a http
request whoose session is bound to a specific database. i.e. when there
is a valid database saved in the request's session. When there is not
database in the request's session (or that it is invalid) the matched
endpoint is directly called without going throught ir.http. Most
endpoints are only accessible via ir.http.

The two `/xmlrpc` and `/jsonrpc` endpoints are examples of endpoint that
do not require an established database connection to work. They perform
the request authentication and database connection themselves. It is
possible to call those two endpoints with no database saved in the
session, thus it is possible to call those two endpoints without going
throught ir.http. This is expected.

The two endpoints's duty is to execute public model methods and return
the xml/json serialized result. To do so, a registry is loaded on the
database with all the installed modules, including http_routing.

We fall in a situation where (1) there is a request, (2) we are using a
registry where http_routing is loaded, (3) there is no `is_frontend`
attribute on `request` as we didn't serve the endpoint via ir.http. This
situation is illegale.

To solve the problem, instead of working on the `if request.is_frontend`
bit of the above conditional, we decided to work on the `if request`
bit. ISO-model wise, RPC is an extra 8th layer built on top of HTTP.
HTTP is merely a transparent transport between a RPC client and a RPC
server, any other request-response capable procotol could fit. The
method executed via RPC must be independant from the usage of HTTP as
mean of transportation thus it should not be capable of using the
current request.

The proposed change is to temporary un-expose the current request from
the local-stack during the execution of the RPC method. This fixes the
problem as the code now run like it was executed from the shell or from
a cron. The other benefit is that the pattern used inside the condition:
`if request and request.is_frontend` doesn't need to change.

X-original-commit: f28863bfdaac3f644fcb274c856e0770783ed75c
Part-of: odoo/odoo#104567
2022-10-29 04:51:01 +02:00
Denis Ledoux ab7ca604be [FIX] base: res.config.settings must not have <t> nodes
The res.config.settings form view is handled with a custom widget
expecting a very specific structure.

a `<t>` node in the middle of
`<div class="settings">`
and
`<div class="app_settings_block">`
screws things up, and the app block will no longer be shown as expected
in the web interface.

This issue has been introduced with
odoo/odoo#103799

The current revision reverts the change so it becomes as before,
the `<t>` blocks with only `groups="..."` are removed from the
architecture, even if they have not been added by the postprocessing
itself.

An alternative fix is done,
directly in the `web_studio` module of odoo/enterprise,
to overcome the issue odoo/odoo#103799 was solving.

Both issues are covered with unit tests:
- the issue odoo/odoo#103799 was solving is covered with the unit test
  added in the related odoo/enterprise#33075
- the issue solved by the current revision is covered with units tests
  added in this revision directly.

closes odoo/odoo#104542

X-original-commit: 56d2de23919f9efa3cd1eef756725e8bc9b86d81
Related: odoo/enterprise#33410
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-28 21:33:58 +02:00
william bebfa9b52c [FIX] base,core: order of self.env.companies
Using a `frozenset` leads to non deterministic issues.
Because when nothing is set in the context key `allowed_company_ids`,
`self.env.companies` will fallback on `self['res.company'].browse(user_company_ids)`
Since the browsing is done on a non ordered set, the recordset doesn't
follow the `_order` set on the model, by definition.

This has the effect of not being deterministic when iterating on
`self.env.companies`.

For instance
https://runbot.odoo.com/runbot/build/20539598

closes odoo/odoo#104538

X-original-commit: bfee55b14c918c44ebbb2563d5dc0e102edf396e
Signed-off-by: Rémy Voet <ryv@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-10-28 20:39:50 +02:00
Xavier Morel 5d47883262 [REM] core: dead code for JSONRPC HTTP status
When `make_json_response` was added in
034d01b2f3 and `_response` was updated
to use it, the `http_status` extracted from the error object was
removed.

But it's still set by `handle_error` and a local is defined for
it. Drop that.

closes odoo/odoo#104507

X-original-commit: b0ea1cd6a2628a6acd1e2d79cc862976c63b1565
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-10-28 17:18:10 +02:00
Joseph Caburnay d650ab6a9b [IMP] web,im_livechat: introduce @odoo/owl module
This is done so that using owl features and functions is done using
the standard import syntax, instead of destructuring properties out
of the owl global object.

So instead of just:

`const { Component } = owl;`

inside an odoo-module, we now do:

`import { Component } from "@odoo/owl";`

Note that we haven't removed the global `owl` object so existing
code will work as is.

Furthermore, we also augmented the tsconfig.json that's generated
from the tsconfig subcommand to take into account the path
of owl.js.

Task-id: 3032274
Part-of: odoo/odoo#104260
2022-10-27 14:41:17 +02:00
xmo-odoo c9356b3582 [REM] core: SQL compiler helpers deprecated since 14.0
closes odoo/odoo#98138

Related: odoo/enterprise#33244
Related: odoo/documentation#2844
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-10-26 19:03:48 +02:00
xmo-odoo 6a343a32ef [REM] core: deprecated TestCase classes
Part-of: odoo/odoo#98138
2022-10-26 19:03:47 +02:00
xmo-odoo 84e6be4150 [REM] core: deprecated osv-memory-age-limit option
Part-of: odoo/odoo#98138
2022-10-26 19:03:47 +02:00
xmo-odoo 110770b7c1 [REM] core: openerp.addons alias and legacy ad_path
Part-of: odoo/odoo#98138
2022-10-26 19:03:47 +02:00
xmo-odoo e98b44998f [REM] base: legacy autovacuum API (power_on method)
Part-of: odoo/odoo#98138
2022-10-26 19:03:47 +02:00
xmo-odoo d200dcfb2c [REM] core: exceptions bits deprecated since 14.0
And formally deprecate the contents of `odoo.osv.osv` so we can
eventually finally remove it.

Part-of: odoo/odoo#98138
2022-10-26 19:03:46 +02:00
Xavier Morel 18446f23f1 [REM] core: support for the deprecated <report> and <act_window> tags
Part-of: odoo/odoo#98138
2022-10-26 19:03:46 +02:00
Xavier Morel 6c6ca16626 [REM] core: deprecated Environment methods
Part-of: odoo/odoo#98138
2022-10-26 19:03:46 +02:00
Nicolas Martinelli 5c80ca4d1d [FIX] http: nodb fallback in case of connection error
When calling a `auth=none` route with a non-existing DB name, the server
redirects to `/web/database/selector`. Such a route can be called
without database, therefore it is expected to work if the database
doesn't exist as well.

Before the HTTP refactoring, the fallback was `_dispatch_nodb` [1]. We
roll back to the same behavior since there is no good reason to redirect
to `/web/database/selector`.

Commits 4b330f3173 and de4e67dcc529163 are reintroduced as well.

[1] https://github.com/odoo/odoo/blob/b3199e949ae70307e8181ba0d6237871d6d07af7/odoo/http.py#L1529

closes odoo/odoo#104174

X-original-commit: 1565e85890f1d14e067edd1c198c7199ab536307
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Olivier Dony <odo@odoo.com>
2022-10-26 16:07:31 +02:00
Xavier Morel 55d9f318fb [IMP] web: update pdfjs to 2.16.105
Our current version is getting rather outdated. Replace by
the *legacy* bundle: pdfjs now provides a non-polyfilled version of
the library, which is probably faster though it doesn't save overly
much (for the entire bundle anyway). Use polyfilled version for
safety, though it's unclear whether non-chromium Edge is still
supported by Odoo. If not, we could just use the non-polyfilled
version.

The difference is quite large for pdf.js (+32.5%), however it is much
less consequential for the sandbox (+1%) or for the much larger
worker (+5.6%). The biggest difference is likely performances
but... who knows?

Notes:

- The main reason for this change is that automated vulnerability
  scanner have apparently started scanning for `postMessage(..., '*')`
  and the previous bundles includes a version of corejs polyfills
  without zloirock/core-js#542), therefore triggering those scans. As
  the PR notes this is almost certainly not a concern because of the
  innocuous payload, but there is no reason to waste time on those
  reports if we don't *have* to.
- The bundle now includes "standard fonts", those were removed as
  they're heavy and may not be necessary for our usage (?).
- All the bitmap images were dropped and replaced by svgs, which is
  nice.
- The local changes since the previous update were *not* impacted in
  this, the entire thing was just reset to upstream. This means
  changes which were backported (922c7c72, 6943714f) are superseded
  but more odoo-specific changes will have to be reapplied in further
  commits.

Part-of: odoo/odoo#100067
2022-10-26 09:07:34 +02:00
Victor Feyens 46f80759eb [FIX] base: settings access test
Probably since recent changes in the views architecture, and
because the test coverage was recently extended, this test
failed when l10n_mx_edit module was installed.

While verifying the current user has access to all the fields specified
in the settings view, we browse all the fields, including the ones in a sub-view:

<field name="x_ids">
	<tree>
		<field name="whatever">
	</tree>
</field>

x_ids being a settings field, but not whatever, which made the test fail.

To fix this problem, we check the fields belong to the res.config.settings
model before trying to access it.

closes odoo/odoo#104119

X-original-commit: 60f22b71063eada039f59321722e794c653acbde
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-10-26 01:58:46 +02:00
Denis Ledoux 49232b7697 [FIX] base: prevent to disable companies still used by users
The initial bug report was the ability to disable all companies
at once and messing up the whole database when you do so.

However, forcing administrators to choose a new company for active users
before archiving a company seems relevant, and solve the
above reported issue in the same time.

closes odoo/odoo#104112

X-original-commit: 786ed3c7a688a662767abfb6e74e7f6dbc938f2e
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-25 23:05:50 +02:00
Xavier Morel e2b3463b5a [IMP] core: formally deprecate __openerp__.py manifests.
`__manifest__.py` was introduced in Odoo 10 and quickly migrated
to (c758e9043a fixed the last holdouts).

Deprecate old manifests. People who need the compatibility can just
add a symlink (or duplicate the file if they're working on FAT or an
old os where core.symlinks can't be set to `true`).

closes odoo/odoo#103952

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-10-25 17:16:09 +02:00
Damien Bouvy 5a79a2857f [FIX] (various): adapt to grid form views
closes odoo/odoo#102993

X-original-commit: c5a9d95ee13d0ed1d261e803d15d1f17cedfaab6
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-10-25 16:11:59 +02:00
Victor Feyens ba5678b441 [FIX] base: resurrect lost test coverage
Since #98551, groups have been moved from views fields to xml content
to harmonize the behavior of xml and view groups.

Nevertheless, this reduced the coverage of the test verifying settings user
are always able to open the settings view.

This commit brings back part of that coverage, checking for each application manager
group that the settings view can be opened and saved correctly.

closes odoo/odoo#103989

X-original-commit: bb067f894a5e5511370990b98981e739565d2f2a
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-10-25 13:03:41 +02:00
Denis Ledoux 6ad3d40172 [FIX] base: ensure the removal of <t groups="...">
See the explanation here:
https://github.com/odoo/odoo/blob/5069c8fd1cee063827873de0f6c2d9fe938337a9/odoo/addons/base/models/ir_ui_view.py#L1209-L1217

The strategy was to create a temporary
<t groups="..."> node which gets deleted after the postprocessing.
The deletion counted on the fact `groups` was the only attribute set
to delete this temporary technical node. In case
someone configured manually in a view architecture directly a t node
with a groups and something else.

But, studio adds another attribute to nodes with "groups=" in the
context of the studio edition (`studio=True` in the context)
https://github.com/odoo/enterprise/blob/7e66f89e1c85852908edc45e72706e51838960b0/web_studio/models/ir_ui_view.py#L53
and therefore another attribute was added on this temporary technical node,
which therefore didn't get deleted properly before being send to the
webclient.

So, we change the heuristic, instead of relying no the fact
`groups` was the only attribute, set a technical attribute on the node
to identify it comes directly from the postprocessing and it must
be deleted properly before being sent to the webclient.

closes odoo/odoo#103832

X-original-commit: 53c684a69bbe8894f05306631272bcf08c226f96
Related: odoo/enterprise#33096
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-24 14:12:17 +02:00
Rémy Voet (ryv) 370cae07b8 [FIX] test_performance: adapt query count of one2many operations
Since https://github.com/odoo/odoo/pull/99415,
query count for one2many operation was too high, fix it.

closes odoo/odoo#103807

X-original-commit: 09acbbe9ca7cc524288589cb2f9dfcd30b244461
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-10-24 08:22:45 +02:00
FrancoisGe c998fdd77b [FIX] base: consider multi_edit="1" views editable
Since odoo/odoo#95729

nodes with a `groups=` are completely removed from the views when
the user is not part of the group, instead of being made invisible.

In that PR, views have been adapted to add back fields, with invisible="1",
when they were required, for instance when they were used in a domain
of another field which was still there despite the user is not part
of the given group.

As `tree` views having `multi_edit="1"` where not considered
as editable views, the domain of fields in these views were not
validated:
- https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1460
- https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1321-L1322

while they are well required for the web client,
in `multi_edit="1"` this is possible to edit relational/many2one field,
and therefore it will do `name_search` calls using the domain of the
field, and therefore the fields used in these domains must always
be present in the views. Without it, a crash in the web client occurs
when attempting to edit the relational/many2one field.

This revision targets to consider the `multi_edit="1"` tree views
as editable, to make the field domains validated as they should be.

Hence, views are adapted to add back fields with `invisible="1"`
when they are required in domains of other fields.

Part-of: odoo/odoo#103790
2022-10-23 12:30:03 +02:00
Du-ma c41228a27d [FIX] base: make data argument optional
It was not always set (e.g. in the generate_email call of
mail.template) and it executes methods like _render_qweb_html where
data was already optional.

closes odoo/odoo#103840

X-original-commit: ddb2bf9f9cb6ea3a4bbdc4fb68c7fbcb0e66aa43
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-10-21 22:18:52 +02:00
Pedro M. Baeza 205ec645f0 [FIX] base: config fields_get arg name mismatch
The arguments for the method `fields_get` are `allfields` and
`attributes`, but this model is overriding it with different name,
provoking the error:

TypeError: fields_get() got an unexpected keyword argument 'allfields'

This commits fixes it renamign the argument to the correct one.

TT40013

closes odoo/odoo#103771

X-original-commit: 3884136b73b1efe4de6a28b9447a72a5d257666c
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-21 16:15:03 +02:00
Xavier Morel 75adabf11f [ADD] *: examples of Model.grouped
closes odoo/odoo#101522

Related: odoo/documentation#2783
Signed-off-by: Rémy Voet <ryv@odoo.com>
2022-10-21 13:06:09 +02:00
Xavier Morel d50db0587b [ADD] core: ORM-level internal grouping utility
When looking to fetch grouped data from the database, `read_group`
should work(-ish), especially with support for `array_agg`. This also
means this need should be more or less solved around RPC: client can
either `read_group` or group on the client side.

This leaves a glaring hole in the fabric: there's no convenient tools
to apply grouping to recordsets. `itertools.groupby` exists, but it
requires that the input be grouped by the key function, and it yields
an iterable of items which is not the most convenient for recordsets.

This here utility:

- is exclusive to recordsets
- returns a mapping of grouping keys to subsets of the input recordset
- keeps the prefetching of the source recordset
- allows grouping on a field, or an arbitrary (callable) key
- should work even on "new records" (aka should be suitable for
  onchanges / arbitrary compute functions)

While the method is RPC-compatible, it's not especially designed for
that, it is likely a much better idea for the client to `read` the
data they need then group that client side on whatever criteria they
are interested in, or `read_group` the aggregated information they
need directly if that's an option.

Part-of: odoo/odoo#101522
2022-10-21 13:06:09 +02:00
maximilien(malb) 5c57230536 [FIX] base: Missing colspan
Since the recent css change the text of the description field was no taking all the place he could, so it was impossible to read, thanks to the colspan it's now the way it was intended

closes odoo/odoo#103634

X-original-commit: 93d29540ff6a6756a84d904047d4e9554d6d9ad7
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
2022-10-20 14:14:54 +02:00
niyasraphy c9ba639017 [FIX] base: button label
The Owl web client does not suppress GTK-style mnemonics, so these
should be removed, as otherwise they are explicitly displayed.

Following GTK rules, the old GTK client would use the `_` letter
prefix in labels to underline the letter and use the corresponding
character as accelerator/mnemonic for activating the
control (https://docs.gtk.org/gtk4/ctor.Label.new_with_mnemonic.html).

The web client "supported" this feature by just ignoring and dropping
the `_` it found in labels, even after it gained support for keyboard
accelerators (= hotkeys).

The new Owl form just ignores GTK-style mnemonics entirely, not
performing that preprocessing on widget labels. As a result, the
mnemonic marker (`_`) now appears literally in some labels, and needs
to be removed.

closes odoo/odoo#103563

X-original-commit: ca80632a1045b26927f72d93f4ec58e7a58b5654
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-10-20 08:23:54 +02:00
Denis Ledoux 59a78b344a [FIX] base, crm: format address mixin _get_view override
The same override of `_get_view` was done in `res.partner` and `crm.lead`
in order to call `_view_get_address`, to change the address format
of the partner and lead form.

The definition of `_view_get_address` was already shared between these
two models through the `format.address.mixin` mixin.
So, why not share the override of `_get_view` also in this mixin,
so only one override needs to be written, instead of two.

In addition to merge the code of the `_get_view` override
in `format.address.mixin`, also set the `_get_view_cache_key`,
so the partner and lead form are correctly cached by company,
in case multiple companies in a same db use different address views.

Before this revision, this wasn't the case for `crm.lead`,
which therefore leaded to a bug when two companies where
using different address view, and one company accessed the lead
form before the other, therefore caching its own view version
in the cache, re-used later by the second company when fetching
its own lead form.

This revision takes the opportunity to add a unit test for crm.lead,
to assert the expected form according to the company address.
There was already a test for res.partner, but not for crm.lead.
To avoid copy/pasting the unit for both models,
a common test class is created, re-used to test both res.partner
and crm.lead.

closes odoo/odoo#103438

X-original-commit: 7e4a8b77024af663c5555c6d56557e2c6136b24b
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-19 20:47:51 +02:00
Stéphane Bidoul 8e040df274 [IMP] core: add odoo.__main__
This allows launching Odoo with "python -m odoo".

This manner of launching python applications is now widespread.
In particular it makes it easier to configure an IDE debugger to run with the correct python version.

closes odoo/odoo#81864

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2022-10-19 15:12:44 +02:00
Aurélien Warnon 8a2a171aa4 [FIX] core: remove 'firebase_admin' warning ignore line
Followup of: odoo/enterprise@b58637f1ab

That completely removed the firebase_admin library support, making this warning
ignore line not necessary.

Task-3000338

closes odoo/odoo#103474

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-19 11:11:56 +02:00
Alexis Lacroix 7a23c27e85 [IMP] base: add banner_route to graph view attributes
odoo task id 2985113

closes odoo/odoo#102397

Related: odoo/enterprise#32382
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2022-10-18 13:16:39 +02:00
Damien Bouvy 297830886c [IMP] base: prevent company duplication in UI
Ducplicating a company is not allowed (see copy override in
base/res_company.py), therefore removing the button from the view
altogether can avoid user confusion.

Task-3000228

closes odoo/odoo#103250

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-10-17 11:13:42 +02:00