Before this commit, images displayed on survey question answers
were small and hard to read, and nothing existed in order to zoom
on them properly.
AFTER THIS COMMIT
Backend:
A new field value_image_filename is added to store the names of
the image fields. They are seen when editing an answer (line).
The max_height and max_width of the images are raised to 1024 px
on their field definition in survey.question.answer to compromise
between image resolution and space, and in order to be able to
zoom on them and still see details
Survey:
A hovering frame is visible on the images, as well as a zoom in
cursor, to indicate we can click on them to zoom in. The rest of
the answer frame is the selection area. Clicking anywhere on the
modal closes it. Until then, a pointer cursor hints the feature.
A new widget SurveyImageZoomer is added. Once the user has clicked
on a choice image, a transparent modal is opened on the whole screen.
This is thought for all size devices : it can be closed by clicking
anywhere, or the cross button, or ESC key. It will always be destroyed.
Also, for small width screens, we do not take the whole height but leave
bands over and below to indicate the mobile users can leave by clicking out.
The image will be displayed in the foreground, zooming on small images
by default, by setting a min width depending on the screen width. We
also avoid using a zoom too large to avoid very low resolution.
The widget allows zooming as long as the image stays in the frame.
The user can zoom both with the mouse scrolling and + and - buttons,
sized to allow medium screen (tablets) to press them accurately.
All keys are disabled but the 'ESC' one when the Zoomer is open to
avoid (undesired) survey navigation.
Task-2566584
closesodoo/odoo#73718
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Define in python a domain on field in the string form containing a leaf of that style
`[('field', '=', field)]` the second field doesn't have quotes around as we want it to take the current value
of the record, JS side.
Given that the field is a m2o, click on the autocomplete to trigger a name_search with that domain.
Before this commit, there was a crash as the dynamic value for `field` was absent from the evaluation context
of the domain.
After this commit, the domain sent to name_search, or at any time, is correctly evaluated.
closesodoo/odoo#97342
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit converts the radio image field of hr_timeoff
to the new framework and renames the registry key to
time_off_radio_image.
closesodoo/odoo#97103
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the DomainSelector did a lot of
RPCs to fields_get each time it was rendering.
Now, we use the view_service.loadFields which does the
RPCs and caches the results.
closesodoo/odoo#96852
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, giving an unknown operator for a
certain field type made the DomainSelector crash.
Now the component lists all existing operators to find
one that matches and prevent crashing.
Part-of: odoo/odoo#96852
Before this commit, when trying to paste into the Odoo editor, if file
and html was in the clipboard, the file got precedence and were added
instead of html.
task-2941679
closesodoo/odoo#97359
X-original-commit: 0af0927f48f213d835a7d4a8396fc6376476e220
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
*: website_livechat
This commit is a step towards refactoring the JS of public livechat,
so that it reuses the same architecture as the code of Discuss.
This implies code that uses JS models and OWL components.
Task-2942001
closesodoo/odoo#97354
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit fixes an "Uncaught Promise" error that is thrown when the
timesheets configuration page is accessed since 150f63c1b6.
The error stems from the appStoreWidget component and specifically from
how the component props are handled.
closesodoo/odoo#97341
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Before this commit, when clicking on the translate button on a translatable field,
the translate dialog had too much data, among them wrong data because the domain
to fetch them was wrong. The context was also wrong.
This lead to a crash in subsequent operations (modify and save)
After this commit, the translate dialog is usable and fetches data with the right context
and domain.
closesodoo/odoo#97280
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
With the rule const preferred, let something; and assigning only once triggers an error.
let something = undefined; does the trick and is what was intended.
Part-of: odoo/odoo#97280
This commit simplifies the component SCSS improving bootstrap
integration and allowing components other than 'SearchPanel' to use the
same tree-view design.
Part of the overall v16 SCSS optimization/restyle, task-2704984.
task-2795166
closesodoo/odoo#87687
Related: odoo/enterprise#25781
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
This test is quite long as it is testing all the website form behaviors
in edit mode.
It is sometime failing due to the tour taking longer than 60 seconds.
runbot-4257
closesodoo/odoo#97336
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
To reproduce the issue:
1. In Settings, enable "Multi-Step Routes"
2. In the Routes, unarchive the route R called "Replenish on Order
(MTO)"
3. Create a storable product P
4. Update its quantity: 10
5. Create and confirm a sale order with one line:
- Product: P
- Quantity: 10
- Route: R
6. Update the SO line:
- Quantity: 8
Error: Once the SO is saved, 2 new deliveries are created:
- One from Customers to Stock with 2 x P (this one should be merged with
the existing one)
- One from Stock to Vendors with 2 x P (his one should not exist)
The route R only contains one rule, which is a MTSO one. On step 5, when
confirming the SO, `_run_pull` will be called and will create a stock
move SM01 based on that rule. In case of a MTSO rule and because there
are already some available P, the procure method of SM01 will be MTS
(see [1]). Then, once SM01 is created, we will confirm it and we won't
do anything more.
The process is not the same on step 6. When saving the SO, `_run_pull`
is called again but this time, because the needed quantity is negative
(-2), the procurement method is set to MTO (see [1]). Therefore, when
confirming such a stock move, two undesirable consequences occur:
- Because its procure method is not the same than SM01, we won't merge
the stock moves (this explains why a picking is created from Customers
to Stock)
- Because its procure method is MTO, we will create and run a
procurement to get -2 x P at Stock. It will find a rule thanks to the
route "Receive in 1 step". The rule creates a receipt from Vendors to
fulfill the need. This explains why an unexpected picking is created.
When processing a procurement with a MTSO rule and a negative quantity,
if we want to know the procurement method of the new SM, we should try
to find and copy the decision we took for the positive move (if it
exists). That way, we ensure that the 'returning phase' (the quantity
decreasing) will follow the same behavior as the initial one (when we
confirmed the SO).
[1]
https://github.com/odoo/odoo/blob/20e0ad13afa2a0ff85d555ab57a6800d3db30341/addons/stock/models/stock_rule.py#L244-L254
OPW-2885751
closesodoo/odoo#97332
X-original-commit: 8c6d282de13b205436a7c5c49facd3efc71a740f
Signed-off-by: Adrien Widart <awt@odoo.com>
Since commit 5ccc32fcf7, it's no longer
possible to write on invisible fields.
Make sure the field product_uom_id is visible to avoid a traceback.
closesodoo/odoo#97313
Signed-off-by: Josse Colpaert <jco@odoo.com>
Have a x2many field with a _view_ref (ie tree_view_ref) in its context
Open the select create dialog (Search More) of that field
Before this commit, there was a crash because the _view_ref string was passed to the get_views
as if it were an Integer ID.
After this commit, there is no crash, and the select create dialog opens correctly.
closesodoo/odoo#97224
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
* Broaden the valid URL pool by including some URL without subdomain
if they have a white listed TLD.
* Change a link 'href' when we change the link label,
if the new label is a valid URL.
* Ensure the domain extension cannot be only digit.
task-2858621
task-2901795
closesodoo/odoo#97297
X-original-commit: 500bc6dc9958fe8a9ca396f87544e8866efa744b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Change the unit test to reflect new spec:
* Some TLD are white listed to not required a subdomain to be considered a valid URL.
=> .com, .net, .org + all ccTLD
* URL of a link need to be changed to equal the label, is the label is a new valid URL.
* Domain Extention cannot be only digit
task-2858621
X-original-commit: c13ba3ec771334c9cd7708305b40b9bf1a234bcc
Part-of: odoo/odoo#97297
As `discuss_public_channel_template` is sandboxed for the `webclient`
the following CSS rule is not applied anymore.
```css
.o_web_client {
direction: ltr;
}
```
This commit adds it specifically for this template to reflect the
language direction in this sandboxed environment.
closesodoo/odoo#95893
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Currently, if your tooling is not up to date, the pre-commit hook will
happily just format your code with the outdated config. This is
undesirable because the next person to touch the file with an up-to-date
config will introduce a bunch of linting noice in their commit.
This commit adds some basic checking by comparing the config files and
aborting the commit if they are out of date, and suggesting a refresh
when the eslint/prettier config files have changed or a full reload if
the package.json has changed.
closesodoo/odoo#97286
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
This commit adds a refresh script which is a lightweight alternative to
the reload script in case the package.json hasn't changed but some
eslint/prettier files have been changed (new rules or ignored files).
Part-of: odoo/odoo#97286
The prefer-const rule disallows using const on variables that are never
reassigned, this improves readability by allowing the reader to know in
advance that all variables that are declared with const are never
reassigned and all variables declared with let will eventually be
reassigned.
The curly rule disallows braceless if/else, for and while which is a
rule we have thus far been enforcing by hand.
Part-of: odoo/odoo#97286
Be in another language, edit and save a record which has translatable fields.
Before this commit, there was a crash because no changes were done on the record, making
a programming error.
After this commit, we can edit and save a record with translatable fields without changes.
closesodoo/odoo#97240
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, in a list view, if you create a new record without
modifying it and then exit the action then your new empty record will
be saved.
This causes two problems:
- you don't want to save a new empty record
- you get a "View can't be saved" error if there is a require field
The solution is to abandon new invalid records if they have not yet
been modified.
closesodoo/odoo#97169
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The render API was confusing as mixing the access to the report and
the rendering env.
The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.
This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value
This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.
Task-id 2670865
closesodoo/odoo#91341
Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Before this commit, it is possible to have duplicate field names in an
alert translation.
How:
- enable multi-language
- go to a form view with at least one translatable field
- edit the value of that field
- click on save (the translate alert displays the field name once)
- edit the same field a second time
- click on save
Result Before:
The translate alert displays the field name twice.
Result After:
The translate alert displays the field name once.
closesodoo/odoo#97287
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Improves the odoo garbage collector for large amounts of attachments.
The odoo garbage collector takes around 20 sec to process 1000 records. In one of our deployed projects with production data, there are 790,000 records. According to our tests, each batch of 1000 records takes 20 seconds and hence the whole process is currently taking around 4 hours to complete, as shown below:
(790,000 records / 1000) * 20 sec *(1 min / 60 sec) * (1 hour / 60 min) = 4.38 hours.
Since the Odoo garbage collector routine runs periodically and currently takes more than 4 hours, this behavior is not acceptable in this application, because if there is any other app that tries to use attachments at the same time (for instance invoicing), it will not be able to do it since the Odoo garbage collector will lock the table, leading to a deadlock.
After adding the index parameter to the store_fname field the total time decreased drastically from 4 hours to 10 seconds since now each batch of 1000 k records takes only 13 ms.
closesodoo/odoo#97281
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Sometimes, no picking type match the domain, but picking_type_id is a required field.
closesodoo/odoo#97278
X-original-commit: afcad067bccc7676b4e40cc57f8d9b5792068802
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Install Documents
Open Settings > Documents, enable 'Accounting' files centralization
Configure 'Journals' with a single line
- Journal -> Vendor Bills
- Workspace -> Finance / Supplier Invoices
Now in go to Accounting>Vendor>Bills
Upload an xml representing a vendor bill, including an attachment
encoded in the <Allegati> tag
Open created bill
Traceback. The error is caused by the attachment included in the xml
registered without res_id/res_model.
In the document flow the attachment will receive a res_id, but not the
res_model, causing the traceback when retrieving the attachment
opw-2919610
closesodoo/odoo#97277
X-original-commit: 377e8eedb2ceb444d6b331debdffa17c47e4a898
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
The button should only be shown if a tokenization-capable acquirer is
enabled (or if a token already exists), but a typo made the button being
shown regardless of that (first) condition.
closesodoo/odoo#97276
X-original-commit: b301844cbdcb07b4e13186cae85257b18ca54654
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
The invoice status was badly computed since the loyalty refactor due to
the use of the wrong value when comparing to the previous state.
(to_invoice instead of to invoice)
TaskId-2936708
closesodoo/odoo#97002
X-original-commit: e88dcd26eebf0e527929a0c48e259895822cf23e
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
The mock server's mockReadGroup function would not properly compute the
value, range and domain of the returned groups for date/datetime fields.
The value should be expressed in the local timezone,
and the range/domain shoulb be expressed in UTC timezone.
Consider the following:
- a record with a datetime field of value "2016-12-14 12:34:56" (expressed in UTC)
- a user with an UTC+2 timezone offset
- a read_group with groupby "['datetime:hour']"
The corresponding group would have had the following metadata:
- value: `"12:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 11:00:00"], ["datetime", "<", "2022-12-14 12:00:00"]]`
- range: `{ from: "2022-12-14 11:00:00", to: "2022-12-14 12:00:00" }`
It now has the following valid metadata:
- value: `"13:00 14 Dec"`
- domain: `[["datetime", ">=", "2022-12-14 12:00:00"], ["datetime", "<", "2022-12-14 13:00:00"]]`
- range: `{ from: "2022-12-14 12:00:00", to: "2022-12-14 13:00:00" }`
closesodoo/odoo#96946
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
formatDate and formatDateTime had their default 'timezone' option set to
false but this was changed to true in order to have the same behavior as
the legacy formatDate and formatDateTime functions.
Part-of: odoo/odoo#96946
Before this commit:
When the page is expanded and try to add any block with an image, try to change
the image using replace button. It lands the user at the top of the page instead
of staying image place.
After this commit:
The user will stay at the image place after clicking on replace button.
Task-2753302
closesodoo/odoo#97266
X-original-commit: da4fdd90622b1f6ba2e45e717fcb4fdde09033af
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
fields having a tooltip in the future UI.
4/ some cleanup of existing messages too
The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX
closesodoo/odoo#97279
Signed-off-by: Fabien Pinckaers <fp@odoo.com>