In some cases, we want to use the regular FieldMonetary widget (performing the amount rounding correctly) but without displaying the currency symbol since the currency code is displayed elsewhere.
This is needed because some currencies are using the same currency symbol like USD / MXN.
Task: 2555114
Part-of: odoo/odoo#91448
The use case is the following:
- Create a kanban view
- Customize it to open a form view on the right when clicking on a kanban card
- The form view is initialized using the context with a 'default_...' key to set a field.
=> Since the context is different every time, the 'load_views' rpc call is always triggered, leading to performance issues.
Task: 2555114
Part-of: odoo/odoo#91448
This commit should be reverted once Chrome has been upgraded to v97+ on
Runbot.
closesodoo/odoo#92921
X-original-commit: abac4e9eb4be8e31f776d745ad1fd19a310c608f
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Since Chrome 97+ some assertions in a parseDateTime test was failing.
This commit adapts these assertions as the behavior in this browser
version is more sensible.
X-original-commit: 866133f5b292ae17b68e1e593cf4c9a29f7e8839
Part-of: odoo/odoo#92921
Access `/web/image/82303?height=16`, traceback because the placeholder
image cannot be resized to `"16"`.
closesodoo/odoo#92891
Signed-off-by: Julien Castiaux <juc@odoo.com>
It was introduced on js refactoring in v15
closesodoo/odoo#92825
X-original-commit: 4dd941150aba0a11f1fb9c604ce11a149018f97a
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
Using lazy values allows you to not do query when the content is not
displayed or if it is already cached. Adding `t-cache` only reduces
render time, but combining it with lazy values saves browses, computes
and query.
Thus for the `/shop` page the page is displayed in 60ms (before: 250ms).
Part-of: odoo/odoo#88276
In order to make the process of signing faster, automatic mode should be the
default one. This commit implements this behavior and adds tests for it.
task-2862209
Part-of: odoo/odoo#92340
This will reduce memory leaks in tests.
Indeed `destroy` is not a standard service method, it must be called manually.
And references to messaging service were unnecessarily kept in env.
Note: ideally everything should be cleaned this way, not just messaging code.
In other words, env itself should have no retainers at the end of each test, but
completely removing all of them is a much bigger work that is outside of the
scope of this PR.
Part of task-2850875
Part-of: odoo/odoo#90934
Added debugTestId url searchParam that executes that test in debug mode.
While in debug mode, one can fully interact with it, and the console logs
the test's internal state.
closesodoo/odoo#92770
Signed-off-by: Géry Debongnie <ged@odoo.com>
Steps to follow
- Use chrome
- Connect to a runbot with the demo account
- After a couple refreshes, the mail.MessagingMenu isn't displayed
Cause of the issue
The navbar should be updated when there is a new item added to the systray registry.
For that, the navbar listen to the update event with the `useBus` function.
`useBus` itself uses `useEffect` which only starts listening after a component has been mounted/patched.
-> The update callback is never called in this case because new items are added before the callback is registered.
opw-2801467
closesodoo/odoo#92768
X-original-commit: c2fd26881ceae95417e2a0afc71fdf8567e3b8c0
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Release notes:
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-8
Fixes
-----
- portal: allow use of expression to describe portal target
- compiler: fix issue with identifiers with same name
- reactivity: fix memory leak
- app: validate props for root component in dev mode
Improvements
------------
- component: display nice error for wrong child component
- props_validation: have clearer error messages
- component: only useState on props that are already reactive
- compiler: add better support for "in" and "new" operators in templates
- misc: export the validate function
- app: add setting to warn if no static props object
- add static App.registerTemplate and update Portal to use it
- add basic infrastructure to buid owl-runtime without compiler
closesodoo/odoo#92599
X-original-commit: 7fc0cc7c3f1c770dd80e8c3f3316c249d0708fe4
Related: odoo/enterprise#27916
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
Rationnals
----------
Web servers can serve some resources (e.g. static files) right away
without any interaction with the web application. The network model of
most web servers makes them capable of handling thousands of
simultaneous requests when it comes to intensive IO operations such as
streaming data from a file. The network model of Odoo is different: it
is capable of a lot of processing power but can only serve a handful of
requests at a time, i.e. Odoo (with some help from postgres) is
optimized for CPU operations, not IO.
Some users don't configure their web server, they use a basic
configuration that relay all requests to Odoo. The result is that many
Odoo HTTP Workers can be busy streaming static files instead of
processing other requests. This can lead to a worker starvation, i.e.
all workers are busy streaming files and cannot process new requests.
X-Sendfile
----------
In this work, we add the support for the [X-Sendfile] header family,
they are multiples http headers that can be used by the web application
to communicate with the web server in order to delegate the delivery of
files stored on the file system. Odoo still receives the request but it
does no more stream the file content from within its HTTP worker,
instead it skips the response body altogether and sets the `X-Sendfile`
special header with the path of the file on the filesystem. The web
server intercepts that special header, open the file and stream it.
Using those headers, we can use the best of both the web application and
the web server. The web application is still responsible to locate the
resource and verify the access rights, the web server is still
responsible of streaming the content.
Using X-Sendfile is opt-in via the `--x-sendfile` CLI flag. We set both
`X-Sendfile` (apache) and `X-Accel-Redirect` (nginx). If you are using
apache, make sure `mod_xsendfile` is enabled. If you are using NGINX
you have to add the following location block:
location /web/filestore { # custom path, hardcoded within Odoo
# Prevent access from the outside world, i.e. makes this
# route only accessible via X-Accel. MANDATORY!!!
internal;
# Give access to the filestore using this server's
# permissions. Odoo is in charge of verifying the access
# rights.
alias /path/to/odoo/data-dir/filestore;
}
The Odoo [deployment documentation] has been updated accordingly.
[X-Sendfile]: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
[deployment documentation]: https://www.odoo.com/documentation/master/administration/install/deploy.html#serving-static-files-and-attachments
Changes to the API
------------------
To benefit most from X-Sendfile, all APIs related to streaming content
over HTTP has to be adapted. They are: (1) `request._serve_static`,
(2) `ir.http._serve_fallback`, (3) `/web/content` and (4) `/web/image`.
Each used it own way to deliver content: (1) `_serve_static` was using
`send_file` (flask's send_file that as been vendored with odoo 10
years ago and not maintenained since then), (2) _serve_fallback was
handcrafting a `werkzeug.wrappers.Response`, (3) /web/content-image were
using the "binary server" `ir.http.binary_content` API.
I has been decided to remove all 3 APIs and to merge the code inside of
the new `http.Stream` object and the `ir.binary` helper model.
A Stream wraps what is going to be sent to the browser, it can be a path
to a file on the locale filesystem, a blob of raw data or an URL to an
external resource. The Stream also holds various metadata that are
mainly used for caching. The preferred way to create a Stream is via one
of its three factories so that all the metadata are set. The factories
are: `from_path`, `from_attachment` and `from_binary_field`. A stream
instance exposes a single method `get_response()` used to create the
corresponding HTTP response object out of the stream.
Inside of `ir.http` were a few methods that were not related to the http
routing and formed what was called the "binary server". All those
methods have been removed and the feature have been refactored inside of
the new `ir.binary` model. The removed methods are:
- `_xmlid_to_obj`
- `_get_record_and_check`
- `_binary_ir_attachment_redirect_content`
- `_binary_record_content`
- `_binary_set_headers`
- `binary_content`
- `_response_by_status`
- `_get_content_common`
- `_content_image`
- `_content_image_get_response`
- `_placeholder_image_get_response`
The new `ir.binary` abstract model exposes the following utilities:
**`_find_record`**
Find an attachment or a record with a binary-field out of an xmlid or
out of a pair record-model/record-id. Check the access rights and the
access token.
**`_get_stream_from`**
Create a Stream from an attachment or a record with a binary-field.
**`_get_image_stream_from`**
Same as `_get_stream_from` but adapted for images. It sets a sensible
ETag on the stream and has image resizing support.
**`_placeholder`**
Get the image placeholder blob.
Testing
-------
It is possible to test the web server configuration using the
`test_http` module. Install the module then run the unittest using the
`webserver` test-tag. By default it attempts to connect to a web-server
running on `http://localhost:80`, you can change this URL by setting the
`WEB_SERVER_URL` environment variable.
odoo-bin -i test_http --stop-after-init
WEB_SERVER_URL='http://localhost:80' odoo-bin --test-tags webserver --stop-after-init
closesodoo/odoo#88134
Task: 2801675
Related: odoo/documentation#2083
Related: odoo/enterprise#26191
Signed-off-by: Julien Castiaux <juc@odoo.com>
Currently only the `*.assets_*` CSS and JS files are considered as
assets. Because of this some assets from `web_studio`, `pos` and
`document_spreadsheet` become available for selection as documents.
This commit replaces the existing blacklist by a check on whether the
URL matches `/web/assets/*`.
Steps to reproduce:
- Install website, web_studio and pos.
- Drop a Text - Image block in the home page.
- Replace the Image.
- Go to the Documents tab.
=> Some JS/CSS/map assets were available for selection.
task-2799866
closesodoo/odoo#89151
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since 43474916 and ff37a2fe, the function `name_get` now returns an
empty string for missing records. This change was not reflected in
mockServer.
This commit also copies the tests of `name_get` on the legacy mockServer
to the "new" one. They were missing.
closesodoo/odoo#92473
X-original-commit: 638fab65cdf7a615138dee1395f54224b3ea1e77
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
bcf665a291 introduced this deprecation warning without a stacklevel
argument. Adding it makes the error highlighted precisely where the
deprecated import occurred.
closesodoo/odoo#92420
X-original-commit: 9c01ab0deec4b82c60d8f942c39f2ca33aa42afd
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Paul Morelle <pmo@odoo.com>
odoo/odoo#87522 introduced the concept to automatically
inline tree, kanban and form views under one2many/many2many fields
within form views.
The goal being for the web client to make less `get_views` calls.
However, currently, automatically inlined form views
under one2many/many2many fields leads
to more triggered onchanges than before,
triggering more field computations than before,
potentially leading to performance issues
as more fields are computed than before.
Besides, they are not visible in the tree/kanban view
and their computation can therefore be considered useless.
At worst, it can even causes bugs, by triggering computation
in places they were not used / do not handle correctly,
as explained in
https://github.com/odoo/odoo/pull/87522#issuecomment-1132554918odoo/odoo#91878
This revision reverts the behavior to automatically inline
form views, while keeping the inlining of kanban/tree views.
However, by reverting this, we re-introduce a limitation
of the web client behavior regarding onchanges,
explained in odoo/odoo#91935.
This is therefore not perfect,
but at least the previous behavior is back.
In the future, work will be done to re-introduce the automatically
inlined form view, while solving both issues:
- Do not trigger more onchanges than necessary,
- Solve the limitation of the web client shown in odoo/odoo#91935closesodoo/odoo#91968
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
It is very common when using kanban view to need a way to declare what
action is executed when clicking on a record. The default action
(switching to form view) is sometimes not what we would like. For
example, clicking on a project kanban record should open the
corresponding tasks, instead of the project form view.
Until this commit, it was not possible to do this simply for a whole
kanban record, however it was possible to add a button with a name and
type attribute to specify the resulting action. This commit introduces
the same idea, but on the complete kanban record, instead of just a sub
element.
To specify the action that should be executed when clicking on a record,
one can now use the 2 attributes 'action' and 'type' (which corresponds
to the 'name' and 'type' attribute for the kanban record. 'name' was
also considered, but it was too weird). For example:
<kanban default_order="name" action="action_brand_model" type="object">
...
</kanban>
Part-of: odoo/odoo#92071
Define "Bootstrap v5 ready" utility-classes to handle font-size.
These classes definitions can be safely removed after migrating to v5.
task-2838625
Part-of: odoo/odoo#90476
Define "Bootstrap v5 ready" utility-classes to handle border-width.
These classes definitions can be safely removed after migrating to v5.
task-2842691
Part-of: odoo/odoo#91298
Since (at least) Chrome 94+, some element's sizing computation returns a
slightly different value (in the order of a fraction of a pixel). Sadly,
due to rounding, this difference has an impact on exact sizing assertion
(specifically in the list view column sizing tests).
As the difference is *really* small, introducing a margin of error (i.e.
<= 1px) looks reasonnable ; as implemented in this commit.
closesodoo/odoo#92203
Forward-port-of: odoo/odoo#92066
X-original-commit: 5f0353814fc314b75a34a38e700bd7f0797dd18d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Before this commit, patchDate used the machine offset and not the offset
fixed in luxon.
For example:
Date to Patch = 01-01-2000 10:30:00
Machine offset = -120 (UTC-2)
Luxon offset = 360 (UTC+6)
Before:
Patched Date = 01-01-2000 10:30:00 UTC-2
After:
Patched Date = 01-01-2000 02:30:00 UTC-2
closesodoo/odoo#91591
Signed-off-by: Bruno Boi <boi@odoo.com>
Before this commit, the dialog 'View Metadata' open the date in utc since the
refactoring of Owl. It is not coherent with all others dates shown in form.
Now we show the date in the timezone of the current user.
Part-of: odoo/odoo#92108
Now, if you don't have ExternalID for the current record when you open the
'View Metadata' submenu from the debug menu, we add a button to create one.
Part-of: odoo/odoo#92108
To reproduce
============
- choose boxed layout as document layout in settings
- enable packages in inventory
- set Incoming Shipments of warehouse on 3 steps
- enable detailed operations of *PACK* operation
- create a pack transfer
- in detailed operations tab, set destination pack
- validate the transfer and print the delivery slip
on PDF the line of destination pack is white text on clear gray (unreadable)
Purpose
=======
on that line two style classes are applied and both of them are changing the background color,
`.o_line_section` :
https://github.com/odoo/odoo/blob/9ce6136be700ae426b8910efd2357d16e2f49d7d/addons/web/static/src/scss/layout_boxed.scss#L61-L64
`.page > table:not(.o_main_table) tr td:last-child` :
https://github.com/odoo/odoo/blob/9ce6136be700ae426b8910efd2357d16e2f49d7d/addons/web/static/src/scss/layout_boxed.scss#L73-L75
We are taking the background color from one and the text color from the other one that don't match.
Specification
=============
to solve the issue we set the text color on `.page > table:not(.o_main_table) tr td:last-child` so that when this style class is
applied it has it's own text color, that matches the background, and doesn't take it from an other class.
opw-2841460
closesodoo/odoo#92096
X-original-commit: 4ee580d32f88fa9a13775355c75503678369c421
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
This commit adds the possibility to have a custom placeholder in the
command palette depending on the namespace.
closesodoo/odoo#91947
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
It is now possible to get access to the action context keys when the
search filters are evaluated. This means that a search arch filter like
<filter name="my_filter" domain="[('my_field', '=', context.get("my_value))]"/>
can be safely evaluated if "my_value" is in the action context (or in
the user context or is builtin as before).
closesodoo/odoo#91959
Signed-off-by: Géry Debongnie <ged@odoo.com>
Since Chromium 97, folded `<details>` content has non-zero computed
width and height which returns false-positive QUnit
`assert.isNotVisible()` calls.
In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950
when Chromium implemented the ability for "Find in page" to search in folded
`<details>`. To do so, the `content-visibility` rule was used instead of
`display: none` which, even if functionally similar, has an impact on the
values returned by `getBoundingClientRect()` (i.e. used in
`assert.isNotVisible()`.
A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028
to highlight this change of behavior. What emerged from this report's
discussion is that Chromium has no intent to revert this change and
instead put the emphasis on avoiding to use `getBoundingClientRect()`
and similar methods for visibility check (even pushing a proposal for a
`Element.isVisible()` API; cf. https://github.com/w3c/csswg-drafts/issues/6850).
This commit works around this issue by forcing the content to `display:
none`, like in the previous Chromium versions.
closesodoo/odoo#91833
X-original-commit: b718e7eb5ceb827f59ac395577408b7bc54aa3f9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Until now, when we add to patch the ui size, we would have patched one of the following:
- config.device.{isMobile,size_class}
- (wowl) env.isSmall / env.services.ui.{isSmall/size}
- (legacy) env.device.isMobile
- (legacy/wowl) browser.innerWidth
The issue is that patching one does not affect the others resulting in an incoherent state.
In order to ease ui size patching, the `patchUiSize` method has been introduced. This method
take either a size or a width as parameter (eg. SIZES.SM, 1920) and affect all the properties above.
task-2582313
closesodoo/odoo#91540
Related: odoo/enterprise#27428
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Steps to reproduce:
- Have two companies set up
- In settings, check for company 2 the Files Centralization
- For a Product, upload a document
Issue:
The document will not appear in Documents.
It will only appear if the option is checked for company 1
Cause:
The company_id is not fetched correctly throughout the process.
There is a similar solution for the specific `documents` upload route:
https://github.com/odoo/enterprise/blob/bdf712d66c3e5cee70a6b424b69a618fe655a39f/documents/controllers/main.py#L147-L149
Solution:
Get the id directly from the cookies
opw-2774365
closesodoo/odoo#91751
X-original-commit: 46db92d5211c215d07448676e619154390b7147f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>
If applied, this commit will fix the following bug by fixing
the url used to ping the server
Steps to reproduce:
1- open apps with debug mode
2- click on updates
3- the server is read as if it is offline
Bug:
in ecfe85db84 all links are changed
static/src/(img|fonts) => static/(img|fonts) however in this specific
case the server is remote
(https://apps.odoo.com) and it still needs /src/
Fix:
add /src to the url
OPW-2791531
closesodoo/odoo#91112
X-original-commit: bf629cf3063119a5c819f74329a51a0e1a7c172f
Signed-off-by: Géry Debongnie <ged@odoo.com>
The boolean_toggle should only be disabled when there is a readonly
modifier, not when the view is in readonly mode.
Cause of the issue
The input was disabled but the `_onClick` was registered on the
widget root node.
Solution
- Listen for clicks on the input element
- Override the render method to set the disabled prop according to the
readonly modifier.
opw-2739468
closesodoo/odoo#91601
X-original-commit: 29a2402153dc95414dad8c833487e7dd18c8a222
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Instead of having 4 buttons to select a view in calendar, we start using a
dropdown button with the framework data-hotkey approach.
task-2704432
closesodoo/odoo#81705
Related: odoo/enterprise#23131
Signed-off-by: Arnaud Joset <arj@odoo.com>
This PR prepares the ground for the one introducing the new environment in the discuss app.
Indeed, switching from `env.browser` to the wowl `browser` makes a lot of noise in the main
PR. In order to reduce this noise, this change is done now.
task-2582313
closesodoo/odoo#91622
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Since 15.2, when creating an invoice containing both a recipient address and an invoice address, the addresses would both appear on the left, one after the other.
This made reading difficult and the invoice unclear.
Furthermore, the company address wasn't present by default on the invoice : it was only there if a layout had previously been selected.
This PR:
- reverts the behaviour of the company address, i.e. it appears even if no layout is (yet) selected ;
- aligns the delivery and the recipient address on each side of the page when necessary, while not changing the outcome if a single address is given.
Also displays a "title" above the addresses when necessary to make things clearer.
task-2809240
related : https://github.com/odoo/enterprise/pull/27240closesodoo/odoo#91487
X-original-commit: 1e745256fabbec4d6979180d8f792c99be463509
Related: odoo/enterprise#27383
Signed-off-by: Florian Gilbert <flg@odoo.com>
This commit shows the sum of field 'recurring_revenue_monthly' on
leads' kanban progressbar next to the sum of 'expected_revenue',
if the recurring revenu is enabled for logged in user.
taskID-2414576
closesodoo/odoo#66237
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
As result of [1], control panel's search menu-items were highlighted
correctly on ':hover', but not using a keyboard.
This commit assigns the default <Dropdown> 'focus' class on both
circumstances.
[1] https://github.com/odoo/odoo/pull/87448
task#2852217
closesodoo/odoo#91206
Related: odoo/enterprise#27355
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Before this commit, some dialog's footer buttons were glued to each
other which impacted their readability and usability.
This commit fixes it by properly applying the existing `gap` CSS rule
which defined the spacing between the buttons, and this independently of
the structure of the footer.
Indeed, due to historical reasons, the `.modal-footer` may contain
drastically different structures depending of the kind of modal.
A non-exhaustive list of encountered structures:
- `.modal-footer > button`
- `.modal-footer > div > footer > button`
- `.modal-footer > div > button`
Note: some existing rules already illustrate that in `modal.scss`.
task-2792884
closesodoo/odoo#91371
X-original-commit: d15bfc785d392a7dffadf9489d1d21f449d42ca4
Related: odoo/enterprise#27337
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Prior to this commit:
- If the color attribute is set on a field on which the user might
not have access to the model / record, a traceback is returned. However,
in the case of a M2O, the name_get would be returned, so its is
a pity that the color raise an access error.
After this commit:
- A search_read is made instead of a read, which returns nothing if
the user does not have access to the model / record and does not raise
a traceback.
closesodoo/odoo#91147
X-original-commit: 3e8744418d629a62e9eacd16dfa4721921e02453
Related: odoo/enterprise#27318
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>