- In some cases One2many fields defined as computed without
inverse field defined could cause crashes if it is used
in a search.
This should not be done, but shouldn't crash either.
With this fix, trying to search on one of this fields
would just print a warning.
closesodoo/odoo#46742
X-original-commit: 4b4f1623590f2e872c565e8e56002bc3f5bf9efe
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Before this commit, the amount currency could be wrapped on a
second line (on mobile).
To fix this, we had to find a way to have more space:
- Buttons are now displayed at the top (mobile only).
- Amounts can grow (col-auto) and the other column will take the
space left (col) and add "..." when there is not enough space.
(mobile + desktop)
We also had to remove a button from a div tag in order to display
the buttons next to each other on mobile (buttons are "inline-block"
but div is a "block").
The main flow tour has been adapted accordingly and the typo has
been fixed too...
closesodoo/odoo#46680
Task-id: 2184243
X-original-commit: 159e3d4cb8a301c908f7718a56138528033e75d4
Related: odoo/enterprise#8963
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Before this commit, the company specific colors and font were
implemented by systematically overwriting a "virtual" report SCSS
asset file before rendering each report.
This caused many issues, forced frequent asset bundles recomputations
(performance problem + cache invalidation causing random bugs).
And it could simply not work in a multi-company setup where multiple
styles are involved, as the asset management could be made not
thread-safe.
PR #44225 was a first attempt to mitigate the numerous problems by
making the asset bundle invalidation less frequent. But the problems
were still present and a more complete solution was necessary for
multi-company setups.
Besides, the design of the bundle forbade making company specific assets.
This commit uses a different approach: instead of having a
company-specific asset that needs to be constantly updated, a global
"multi-company" asset is maintained and included in the report assets.
It only needs to be generated when a company style changes, not for
every rendering operation.
Unfortunately this change cannot be fully performed without updating the
template declarations, so it will require an update of the `web` (or
`base`) module to be operational.
As this represents a rather invasive change in a stable branch, extensive
testing was conducted to minimize the effects and ensure proper
degradation of features for production deployments where the new code
would be deployed without forcing an update of the `web` module:
- The report SCSS files were left untouched, to prevent any bundle
invalidation, ensuring that old cached assets would remain valid. This
means that single-company setups should not see any visible difference
after pulling the code (with or without updating `web`).
SCSS cleanup will be done later.
- Existing Python methods were kept but emptied, to make sure that
old templates and code would not crash.
- For multi-companies, the last used colors will be applied for all
reports until the `web` module is updated. The old behavior was not
working correctly anyways, so the degradation is actually limited.
- For all setups, changing the colors after deploying this patch will
have no effect unless the `web` module is updated.
/UPDATED FOR master on top of #44393/:
- removed the `res_company.update_scss()` method entirely
- fixed the report SCSS styles, as the variable names referred to the old
behavior, e.g. "$o-company-primary-color" is nonsense.
Renamed to "$o-default-report-primary-color" etc.
--
Improves #44225
Forward of #44393
opw-2168623
opw-2171040
closesodoo/odoo#46647
X-original-commit: a5b1421aecf27b1de408434d3bb6d7ac81f57dc3
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
- small mistake when you want to import a bank statement file:
it is written:
SEPA recommanded Cash Management format (CAMT.053)
while it should be:
recommended
- comma separated -> comma-separated
Task : 2200054
closesodoo/odoo#46645
Related: odoo/enterprise#8940
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Currently, to activate/deactivate records with the 'active' checkbox
user has to switch to edit mode of the form.
So the purpose of the task is to allow the user to activate/deactivate
records from the readonly mode of the form view.
In this commit, we set widget='boolean_toggle' on the 'active' field in form
view.
closesodoo/odoo#46567
Taskid: 2206794
Related: https://github.com/odoo/enterprise/pull/8918
Related: odoo/enterprise#8918
Closes: #46567
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
When a user is created, its partner_id shall not have any company_id.
A test has been added to check that in 'base/test'.
Update test_mail tests by setting a company to partner_id linked to users
as now, by default the partner linked to a new user has no company_id.
closes odoo/odoo#46515
Task: 2198688
Forward-port-of: #45900
X-original-commit: 187b12fc5715721efdd9af283e086dfc3f856fc2
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Since we now use native promises, the code in charge of alerting the
user of bundle compilation errors was opening both an alert and a
dialog (fwp of https://github.com/odoo/odoo/pull/46437).
In 13.0, the mention fwp is not enough. On the website, the JS is also
lazy loaded now so we need to wait for that lazy loading before being
able to open a modal.
The whole alerting code should be improved to not be defined in python.
Fixes https://github.com/odoo/odoo/issues/45447closesodoo/odoo#46482
X-original-commit: d5a2469b1edd0d22b366b44086d08c6f0b2247b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
In address block there is extra space between label and field
so added class o_td_label with o_form_label in span tag
Wrong hover title on create company button when company_name is set
so direct use icon attrs instead of span
closes odoo/odoo#44695
Taskid: 2182637
Closes: #44695
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This allows detailed reporting in write overrides.
Expl:
When (un)archiving multiple records together (from a view list, or in batch call),
you will only see one record at a time in `write` overrides. This means you
won't be able to return meaningful and complete messages to the end user.
Before:
1) Archive A & B
2) "You cannot archive A"
3) Archive B
4) "You cannot archive B"
After:
1) Archive A & B
2) "You cannot archive A & B"
closesodoo/odoo#46358
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
PURPOSE
Clean dead actions.
SPECIFICATIONS
Some ir.actions.act_window are not used in odoo codebase anymore
* not linked to a given menu;
* not referenced in the code;
LINKS
Task ID 2188942 (original)
Task ID 2196183 (Social/Marketing specific)
Community PR odoo/odoo#46435
Enterprise PR odoo/enterprise#8846
When we send a SMS in the contact form view, exact body is sent by SMS and
displayed in chatter. If some manual HTML is added chatter will display it
as HTML while sms receive HTML tags.
We want that the SMS content in the chatter is the same as the SMS sent and
that HTML tags are removed to avoid being interpreted.
To achieve that goal we call html2plaintext in ``_message_sms`` and in
``prepare_log_body_value`` that are two entry points to send SMS.
We also update ``html2plaintext`` to strip result in order to avoid having
unnecessary spaces left.
Task ID 2126123
PR #40441closesodoo/odoo#46362
X-original-commit: 4b7b14a5ea5e6ab521838c01813fa478154682fd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Remove a leftover special case of the ORM from a former version.
This fixes a performance issue, where an onchange recomputes a field on
one2many lines one by one.
X-original-commit: 16a75d85741db8a1f87c1d26503a9bb75197cf83
Very few people in Japan know how to type accented characters, which
brings a usability issue when the Japanese prefectures are defined
with accented characters.
closesodoo/odoo#46258
X-original-commit: db4ea065fee3e0344a65d2386799ffa6e7e47abc
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
When the `select` returns nothing more than ids that are already known, there is
no need to make it at all.
This removes one query from `_read` every time it has to fetch only fields that
are stored in a different table (o2m, ...), which happens all the time when
reading a stored field first (triggering prefetch) and then reading a o2m.
The query that is now removed was used to check access rules, but the trick is
to use `check_access_rule` to verify the rules in python instead.
Part of task-2061122
closesodoo/odoo#36263
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Since we dropped the old-api style compatibility layer,
some years ago.
This docstring was added to the 13.0 documentation
thanks to odoo/odoo#44838
So it's best not to mention this old-api style
in our latest documentation
closesodoo/odoo#46223
X-original-commit: 63691c78006fbf7077eb13f3045be21a18bbe753
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Have a template of that form:
```xml
<t t-if=""/>
<!-- Comment -->
<t t-elif=""/>
```
Before this commit, both python and JS crashed because any type of node
between branching directive was forbidden
After this commit, Comments are just ignored and removed, while actual
template nodes are still forbidden between branching directives
There is no crash anymore
closesodoo/odoo#45899
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
- The form view on `res.users` displays information about
how many record rules, ACL and groups are applied to the users.
In some cases the current users may not have the required
access rights to compute those values.
To fix this issue, the computed fields are now computed
in `compute_sudo` mode
closesodoo/odoo#46149
X-original-commit: 653f81f49ba4d92648eb04209cdbe73894dfac08
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
This makes the behavior of `onchange()` consistent in the case of
inherited models (with `_inherits`).
closesodoo/odoo#45910
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
The old path would just return e.g. `Array(2)` for an array of size 2,
which is not very useful when trying to see if an array's contents are
relevant to an issue.
Turns out arrays are serialized pretty much exactly like objects
without a subtype, just with property names being indices instead of
keys. So add a case which formats such remoteobjects as
array-literal-ish.
closesodoo/odoo#46056
X-original-commit: 6d5639024fa0f7501efe836e5571cd45bb46b123
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
If some contacts are linked to a user, we keep the company consistent
but we should do it only if a company is set on the destination partner.
opw-2199352
closesodoo/odoo#46000
X-original-commit: 3f9cb47cb6fdc240a58f3daa3bd4cf32f55cb084
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
The image illustrating some kanban cards (like "Employees" or
"Contacts") has a weird scaling and rendering on smaller screen sizes.
Step to reproduce (on small screen):
1. Open Employee
2. Apply a filter
3. Picture is ugly (shape changes to get something pretty weird)
This commit fixes it by:
1. removing the rounding which was only applied (sic) on smaller screens
2. adjusting the size and/or the margins of the image to keep its ratio
and the alignment with the other kanban cards.
Task ID: 2198419
closesodoo/odoo#45956
X-original-commit: dd5db84464998b45d0524055f9c96bcad894c4c9
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
When performing an import-compatible export, m2m values would be
exported as a record per cell unless the `id` subfield was the first
to be exported. Which is not the case when using the export UI (as it
always adds the field itself before any subfield). This would make the
m2m not actually export-compatible in most cases.
* export m2m "display name" in an import compatible format as well
* re-prioritise exporting xids when there are multiple m2m exports in
import-compatible mode
* never fall back on the o2m / non-import-compatible m2m path for m2ms
in import-compatible mode
Note: if multiple m2m fields are specified only one of them gets filled.
Task 2065428
closesodoo/odoo#37407
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Ravi Singh <ras@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
Some of the implicit side-effects got missed, namely that under some conditions
(e.g. using an odoo subcommand) `initialize_sys_path` can be called before the
config has been loaded at all, resulting in the first call not properly setting
up things, and one of the subsequent calls fixing things up.
Since this breaks workflows right now, quickly fix it, we'll re-investigate
how to fixup the entire thing in order to restrict & enforce a single call.
closesodoo/odoo#45844
X-original-commit: 6cb4c829e1559bcf836e4b573051760565b7d0c1
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Since Chrome version 80, the V8 javascript engine is using an new
pointer compression feature [1]. This features tries to reserve more the
4GiB of memory. As a consequence, during HttpCase tests, odoo tries to
launch chrome headless in a subprocess but fails because of the
memory-limit-soft.
With this commit, the Chrome browser is spawned in a forked process
that removes the memory limit.
Also a new Chrome CLI switch is used to prevent crash reports to be sent
to google.
[1] https://v8.dev/blog/v8-release-80closesodoo/odoo#45859
X-original-commit: 726d9c50720c2d3c9e617e998ed0dcd12272a271
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
During an HttpCase, when the Chrome browser starts, it may happens that
the websocket is unreachable. In such a case, the stop method is called
and tries to stop the browser gracefully by sending a `Browser.close`
through the websocket ... which is not reachable.
The result is a confusing traceback. With this commit, nothing is sent
is the websocket is not available.
Moreover, the `sigxcpu_handler` attribute is used in the stop method but
not yet declared. Fixed by moving it before calling the _chrome_start
method.
X-original-commit: 0d156fd3bc114b40680ca5aa0456e0f21a5b8cff
When a field is related, defining a selection or selection_add will
have no effect and the paramater is ignored.
Log a warning and fix all fields badly definied
Closesodoo/odoo#45716closesodoo/odoo#45832
Related: odoo/enterprise#8613
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Commit 9a482fc introduced change for the document layout preview:
all "td" tag included in clearfix were in display: flex;
Because of this some styles were broken in form views on mobile.
We could have only put this rule in the right scope but
we preferred to fix this correctly.
Steps to reproduce:
- Go to Settings
- General Settings
- Click on Configure Document Layout
Related to task-ID: 2184243
closesodoo/odoo#45830
X-original-commit: 0206ee8f8a3652ae0eeb5aa78a94b92bd6e84921
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
The idea is to make the dispatching and error-handling consistent for
JsonRequest and HTTPRequest.
In 8809c77f60 we introduced a way for
request-specific error-handling, but JsonRequest.dispatch() was
still catching all errors internally, instead of letting them bubble
up to ir_http._handle_exception()
By removing the internal try except in JsonRequest.dispatch(), we do not
change the behavior much as there are only a couple of "if" in
ir_http._handle_exception() before returning to the request-specific
handle_exception. However we give the opportunity to modules to
customize exception handling even for JsonRPC, the same way it is
possible for HTTP requests.
Here is a simple pseudo code of the flow
ir_http.dispatch():
try:
request.dispatch()
catch Exception as e:
ir_http._handle_exception(e)
ir_http.handle_exception(e)
request._handle_exception(e)
closesodoo/odoo#45639
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
This fixes the following issue. Set the field `arch` on a view; this
automatically writes on `arch_db`, which is a translated field. If some
translations are discarded, a call to `unlink()` invalidates the whole
cache. And then things go wrong: when `arch_db` is validated, the field
`arch` is missing from cache, and the ORM sets it to `None` because the
field is still protected by the initial write!
Fix the issue by avoiding the call to `unlink()`, and do it in SQL
instead.
closesodoo/odoo#45740
X-original-commit: e7679152ee480a51ef2b6d208ae7a05b2ef61941
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
On a standard odoo install, `MigrationManager._get_files` represent
more than 4% of an install. This is because the legacy
odoo/base/maintenance/migration path was added to upgrade.__path__
once by module, making the get_filed check 574^2 os.path.exists.
This commit adds a check on initialize_sys_path to call it only once,
and merge legacy path with upgrade-path management in order to benefit
of the `up not in upgrade.__path__` check. This second part of the fix
will also remove the local dir from the upgrades paths.
A further improvement would be to fix MigrationManager in order to skip
_get_file work on a fresh install, (wip by rco-odoo)
closesodoo/odoo#45699
X-original-commit: 497330a695ed52a33f9c9b9c27b149446de0db29
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Not setting a value for paperformat_id on 'Company Document Layout'
will also make paperformat_id False on the company but it is required
in the settings.
Without this commit, you can get in the weird situation of being able
to set a value on the document layout but having an error in the
general settings as a required field is missing.
Apply the same logic as in the other views
closesodoo/odoo#45527
X-original-commit: e518063e48936a3f8f9f921950cdae209e67ab47
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Issue
- Remove ~/.odoorc
- Launch a server
- Try to dump the db in db manager
Ok
- Restart the server
- Retry
pg_dump not found
Cause
When the .odoorc file is not there,
the pg_path option is not present so
the normalize method set it to None
When the server is restarted, it re-checks
the options (which are strings) and in the
normalize method we check "if not pg_path"
but 'None' is truthy so it thinks this is
a real path.
Solution
Check if not pg_path or if pg_path string
is None
OPW-2189789
closesodoo/odoo#45369
X-original-commit: f080964694c01a79c52e05c0ceb42c18d4c77df5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
The purpose is to force developers to explicitly manage the removal of
field via migration scripts.
closesodoo/odoo#45269
Related: odoo/upgrade#777
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Purpose
=======
Improve the state creation flow.
Some users created states by mistake, we want to avoid this situation.
Specifications
==============
Do not allow to create country from the partner form view.
Disable the quick create of the state in the partner form view.
When we create a state from the partner form view, set by default the
country of the state to the country of the partner.
Task 2178289
closesodoo/odoo#44291
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, it was possible (and common) to create search views
without fields and only filters, the consequence was that a search for
that particular search view was not possible. (See
https://github.com/odoo/enterprise/pull/7852)
With this commit, a warning is raised if no field is defined within a
search view, preventing these "common mistakes" from happening again.
closesodoo/odoo#45058
Task-id: 2179521
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Sometimes, constraints are not delayed during a module upgrade: the
module is 'to upgrade' but in 'init' mode :-/
Fix this by relying on the module's state only.
closesodoo/odoo#45179
X-original-commit: 878b6538961a9b6a5fe1c6ac68d4ff39391abcdf
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Custom models and fields set up the registry as part of their CRUD.
Make sure to flush() before setting up the registry, in order to avoid
neverending recomputations (as fixed by the former commit).
closesodoo/odoo#45163
X-original-commit: af6dbb5c7c165dcf37bf87ee76c0170795ecb574
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
In some case, a pre-migration script calls `xml_import.parse` to force
reload a no-update data in pre-script. It is possible that fields are
marked to recompute in the process. The problem is that the reference to
the field added in `env.all.tocompute` won't be the same as the
reference of the same field after calling `registry.setup_models()`,
leading to an infinite loop while recomputing this field, since
`fields.__get__` wont find `self` in `env.all.tocompute`.
This problem was discovered when trying to migrate a database with all
modules installed (no demo data) from 12.0 to 13.0 (for commit
references: http://runbot.odoo.com/runbot/build/1176576 with database
comming from http://runbot.odoo.com/runbot/build/1171714).
This commit adds a check before executing `registry.setup_models()` in
order to log when some fields to compute remain before breaking fields
references, and adds a `flush()` after pre-scripts to fix the current
issue.
X-original-commit: 41b9d810066774736c4077bba1dc9c9fba004f48
This is a followup of 1d553eea7b.
Systematically logging import tracebacks can fill up log files, and
waste disk space. We therefore log those tracebacks in DEBUG mode, so
that they can be activated only when needed.
closesodoo/odoo#45075
X-original-commit: 017e3d798c55b1bdac221aea76d3d944f045ee65
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
* Code cleanup
* Avoid a safe evaluation of the field value when loading those records.
closesodoo/odoo#44883
Related: odoo/enterprise#8283
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
- Activate variants and pricelists
- Go to Product > Products Variants
- Search for anything on the 'Pricelist' filter
A traceback is raised: 'Can only create cache keys from hashable
values...'.
This comes from the following change:
https://github.com/odoo/odoo/blob/4b06fe19fa68255b7982d15e5847da2f6d6209fd/addons/web/static/src/js/views/control_panel/control_panel_model.js#L962
It returns a list instead of a string. Since a list is not hashable, it
causes the issue.
There are not much solutions since the context key `pricelist` can be a
`list` or an `int` (an ID). We force the cache key conversion to a tuple
to avoid the `TypeError` and handle the `list` use case (which was
broken on top of crashing).
opw-2187757
closesodoo/odoo#45064
X-original-commit: ec0a8767143b4c4818418281803c4f52fefa8d2a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
When adding a custom field, the ORM also adds it to all the inherits'ed
models, but with the state `base`, because those inherited fields are
automatic (created by the ORM). However, dependencies are enforced for
`base` fields, while they can be ignored for `manual` ones. This is a
problem when a custom field is fucked up: its inherited fields will make
the registry crash.
We fix the issue by not enforcing dependency check on fields inherits'ed
from custom fields.
opw-2191114
closesodoo/odoo#45024
X-original-commit: 2db0787dc9e8717200aaf1d71ac64df1c17f4143
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>