Commit Graph
157455 Commits
Author SHA1 Message Date
Kamlesh Pathekar a923e720ff [FIX] website_sale: show automatic invoice label
In this commit, we shows the label of automatic invoice field.

task-3110526

closes odoo/odoo#108712

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-11 20:57:21 +01:00
Pierre Masereel 66f8901143 [FIX] mrp: cannot open product template view
When you don't have any mrp access rights and want to open a product
template form view, you get an access error. This is caused by the field
bom_count that tries to count the number of BOM without having the
access rights.

So we only add this field to the view, and the action that depends on it
when you have mrp access rights.

closes odoo/odoo#109636

X-original-commit: a655276d556f1d2bf92c3f3160a8306cc673a115
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-11 19:26:48 +01:00
Jairo LlopisandJulien Castiaux 5f1a77236a [IMP] bus: allow debugging websockets worker
Previous behavior: when debugging the websockets worker, source code is always minified.

Now, if user is in `debug=assets` mode, the asset won't be minified and it will be easier to debug.

@moduon MT-1900

closes odoo/odoo#109583

X-original-commit: 6360bbdbdcc6f2c150ceaa9f7fb5b0760e0f8940
Signed-off-by: Julien Castiaux <juc@odoo.com>
Co-authored-by: Julien Castiaux <Julien.castiaux@gmail.com>
2023-01-11 19:26:43 +01:00
luvi 9e46fbd332 [FIX] web: fix ExportDataDialog issues
Since the rewrite of this dialog, some inconsistent behaviors were
present compared to the legacy implementation. This commit fixes some
of them.

First, many2many fields couldn't be expanded as it was the case before.
Secondly, the export list generated by default was wrong, and it has been
fixed by this commit. The defaultExportList that was computed in the as
expected for the direct export is now also used to display the right
fields from the right pane as it ignores the fields that are explicitly
not exportable.

Finally, minor UI issues have been fixed, like a wrong title.

Tests have been added to assert the correct behavior of the dialog when
selecting records.

closes odoo/odoo#109670

X-original-commit: 86b634a120de0843fbd90079e9e457818fd4acde
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-01-11 17:58:47 +01:00
Samuel Degueldre b34429b984 [IMP] web, test_lint: forbid private class fields
We don't want private class fields to be used in Odoo because they limit
how classes can be patched from the outside, extensibility is one of
Odoo's biggest strength and we do not want to limit it.

This commit adds the `no-restricted-syntax` rule to eslint configs with
a rule that forbids private class fields.

closes odoo/odoo#109664

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2023-01-11 17:58:41 +01:00
Pierre Masereel 4b2692ba2e [FIX] spreadsheet_dashboard: hide sequence for read only users
When a user is not in the 'Setting' group, he sees the cmenu item
configuration and display the dashboard groups, but cannot edit them.

The main issue lies in the sequence field handle, hence we hide this
field for users that cannot configure the dashboard groups or the
dashboards themselves.

closes odoo/odoo#109655

X-original-commit: e9699b7f0deab8ffd0a64d27c7bbedc8f4e2daf7
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Masereel Pierre <pim@odoo.com>
2023-01-11 17:58:39 +01:00
Jesús Alan Ramos Rodríguez 325d576fe9 [FIX] base: fix incorrect call of method of dictionary
This PR fixes an issue introduced in commit https://github.com/odoo/odoo/commit/b9feebc25cc8caad97e5c3cb2953643bfd14984f

When this line is executed, the following error is shown:

closes odoo/odoo#109652

Attributeerror: 'dict' object has no attribute 'vals'
X-original-commit: f3b6225e268711e3d9e6f6fda24f398e2f506259
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-01-11 17:58:36 +01:00
Thomas Lefebvre (thle) 8d229f22b3 [FIX] website_sale: remove reward line from cart
Steps to reproduce:
- go to e-commerce;
- add a product to the cart;
- add a gift card;
- remove the gift card form the cart.
(the user must not belong to the group 'base.group_system')

Issue:
A user error appears.

Cause:
The gift card is a product that cannot be added
to the cart like the others.
Therefore, an error is triggered.

Solution:
Make the error trigger only when adding products to the cart.

opw-3114090

closes odoo/odoo#109654

X-original-commit: 9cc699b89688261220aeb39a99fd866c27808d0a
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2023-01-11 15:39:11 +01:00
Bruno Boi 3a814f50ba [FIX] web: back to same action w/ pending changes
Before this commit, when a user was on a form view with pending changes
and would click on the browser back button. If the previous action was
the same action, the user would be redirected to the form view but a
traceback would be raised because the form view was not able to handle
the pending changes "in time".

Here "in time" means before the form view is rendered. The form view
when rendered will try to update its display name through its controller
config, but as the new controller will be in fact the same as the
previous one, its config is currently being changed while the previous
form view is still using it. This leads to a traceback.

This commit fixes this issue by making sure that the changes are
properly commited before changing the config for the new controller.

The same kind of issue has been fixed in the action service for the
restore function, but there are no sensible ways to test this particular
use case.

closes odoo/odoo#109653

X-original-commit: e8a95c37e4e9ee4e4a65a3bfb216d3fa55544933
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-11 15:39:08 +01:00
Kevin Baptiste b3bc6c08a0 [IMP] hr_holidays: show all employee leaves in Off Today
In the timeoff overview, the "Off Today" filter was only showing leaves
that were occuring on the current day, hiding all the other leaves of
the employee occuring that same period.

Now it will display all the leaves for that period for the employees
that are currently off.

task-3098759

closes odoo/odoo#108290

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-11 15:38:56 +01:00
Rohitkumar (roku) 0e7c7e4c78 [IMP] hr_holidays: improve filters ux in the time off
The purpose of this PR is to improve the filters for time off
In Commit,
    Filters relabelling:
     - Approved Allocations -> Approved
     - Active Time Off  -> Active
     - Archived Time Off  -> Archived
     - Cancelled Time Off -> Cancelled
 - remove the `Current Year`  filter in  hr leave
 - re-sequence filter of the hr leave and and hr leave allocation

task-3090753

closes odoo/odoo#107378

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-11 15:38:54 +01:00
gawa-odoo 023473d70c [FIX] account: update fiscal position when updating taxes
The fiscal positions for the new taxes should also be
provided, when we create the taxes, so the clients
don't have to manually input them.
Only fiscal positions that exist in the db and with new
taxes are created.

Related: https://github.com/odoo/odoo/pull/108571
task-3116246

closes odoo/odoo#109637

X-original-commit: 362b152cee6252ee6531c15a3e07b5917b36bc45
Signed-off-by: William André (wan) <wan@odoo.com>
2023-01-11 14:31:09 +01:00
Thomas Lefebvre (thle) a77f644fd2 [FIX] sale_loyalty: find sequence of a non-iterable
Steps to reproduce:
- go to e-commerce;
- add a product to the cart;
- add a gift card;
- remove the product from the cart.

Issue:
A traceback appears.

Cause:
We are trying to find the maximum of a non-iterable object.

Introduced by 7004b17ee5433e3b14561358348b42326f549261

opw-3114090

closes odoo/odoo#109635

X-original-commit: ae074117db7e7da1ba36a9151fae12bc16fb15ed
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-11 14:31:06 +01:00
Ivan Yelizariev 4ca947c092 [FIX] base,web: fix address widgets in reports for RTL
This reverts following commits
1. a63f616c280ff464e331e3ba97265a8c29a86871
2. 5b7c3805a0

Instead of aligning address to left, we use default aligning, i.e. align to the
right for RTL langugages.

Commit n.1 was an attempt to finalize idea of the commit n.2, but it turned out
that left aligning looks just too bad for rtl users. So, this commit reverts
both of them, but keeps span/div changes in commit n.2

opw-3053457

closes odoo/odoo#109634

X-original-commit: 4af9fcf99f118e5dd85fb59d2e63f5b817233f07
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-01-11 14:31:03 +01:00
rhe-odoo ad284c0a0b [IMP] point_of_sale: add payment methods image
This commit adds default image to payment methods.
It also let the user set custom images to his payment methods.
Those images will be displayed in the payment screen next to the name.

closes odoo/odoo#109446

Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-01-11 14:30:52 +01:00
luvi b31daf2f7b [REF] web, *: improve view scale selector style and behavior
*: hr_holidays, hr_work_entry_contract

The commit introduces a new standard view component made to implement
in a consistant way the scale/select the appropriate period to display
in a view. This component is currently used by the Calendar view.

Tests have been added for this new component, as its behavior specs must
remain comprehensive. When there is no options or only one, the button is
removed from the view to keep space available, as its purpose is reduced.

This component gives the opportunity to keep the same style and behaviors
for views implementing it (eg: Calendar, Gantt) and should be used in
other views as well as soon as they are converted to Owl.

Other modules have been adapted to use the component name in xpath instead
of the span with the o_calendar_scale_buttons element. Tests have been
adapted as well.

A scss file has been modified to prevent the arrow to be misplaced on touch
devices due to a higher padding in the dropdown item element.

part of task #2867569

closes odoo/odoo#109090

Related: odoo/enterprise#35435
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 14:30:46 +01:00
niyasraphy bf0001ea3d [FIX] sale_loyalty: traceback after removing products from cart
before this commit, when removing a product from cart raising traceback.

add a product to cart, apply a gift card code to this order from backend sale form.

now when trying to remove the original product from cart raises traceback:  max() arg is empty sequence

this is raised to calling max() on empty list, to fix the issue, set a default=10 is passed to max.

closes odoo/odoo#109625

X-original-commit: 526aeb2f3232f32404eb09b68aa2171c97568489
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-11 13:21:01 +01:00
niyasraphy 346a289ecf [FIX] website_sale: remove upgrade widget from delivery_mondialrelay
before this commit, in the website settings the Mondial Relay field is shown with upgrade_boolean widget. upgrade_boolean widget is the widget that shows the enterprise label and on clicking it, will show end user the wizard to upgrade to enterprise.

actually the module delivery_mondialrelay is part of community edition and thus removing the widget from the field.

closes odoo/odoo#109616

X-original-commit: e08a083ae5a38fb40a2b2e8a47642111f0286805
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2023-01-11 13:20:58 +01:00
Laurent Smet 7a8a712a34 [IMP] web: improve notebook
to allow for easier overriding
related to odoo/enterprise/#35426

task-3111695

closes odoo/odoo#109594

X-original-commit: 2ad805d5a88a510844fc398d089b3e3c46e5cb9d
Related: odoo/enterprise#35641
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
2023-01-11 13:20:53 +01:00
JF Aubert 0cdf410a44 [IMP] mrp: Remove mrp.immediate.production model
closes odoo/odoo#108446

Task: 3094741
Related: odoo/upgrade#4163
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-11 13:20:48 +01:00
JF Aubert 74c1944ea0 [FIX] web: fix product favorite tooltip
Avoid tooltip like 'Favorite: Favorite' in priority field.

Task: 3094741
Part-of: odoo/odoo#108446
2023-01-11 13:20:47 +01:00
JF Aubert b0a6c525b0 [IMP] mrp: Improvements
- Many ui/text updates
- Fix To consume field display
- Add Draft/Done filters to Scrap views
- Fix BoM name_create problems due to _rec_name set to product_tmpl_id

Task: 3094741
Part-of: odoo/odoo#108446
2023-01-11 13:20:47 +01:00
niyasraphy f843f45700 [IMP] web: camel case lettering
currently in the db creation page in the db manager, except phone number and demo data fields use camel case lettering. this pr will make phone number and demo data fields with camel case lettering, which will unify the form.

closes odoo/odoo#108326

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 13:20:41 +01:00
FrancoisGe 8959b67ed0 [FIX] web: changing the language should reload the page
Before this commit, when saving a language change in My Profile,
nothing happened. The expected behavior is a page reload.

How to reproduce:
- Go to the "My profile" tab in the User Menu
- Edit the language
- Click on save

Before this commit:
The record is save.

After this commit:
The record is saved and the page is reloaded.

closes odoo/odoo#109508

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-11 12:16:05 +01:00
Ivan Yelizariev 64682a61bb [FIX] web: add basic support for Json fields
`fields.Json` is introduced in v16. There are just few usage of it in standard
code. It's usually used via `widget="analytic_distribution"`. However, user may
add the field to list view via a Studio. To prevent errors, this commits adds
basic formatter for the field.

STEPS:

-In the Purchase app, add a new Menu based on the existing Model "Purchase Order Lines"
-In the list view of that new Menu, add the existing field "Analytic
-Distribution"

opw-3055926

closes odoo/odoo#109573

X-original-commit: d0621a2aec9cdc4bad348804fe5ada974b75f322
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-01-11 09:38:56 +01:00
Benoit Socias 3ef5004c13 [FIX] web_editor: merge inline elements into previous color font
Before this commit when a color was applied on a text that spans several
nodes, it was wrapping each text node in a font node to which the color
was applied. Because of this, applied gradient colors were restarting on
each text part. (e.g. before a bold section, on the bold section, after
the bold section: each had a distinctly drawn gradient)

After this commit the bold and italic nodes are considered similar to
text nodes and are wrapped inside a common font node to which the color
is applied - using the mechanism that already existed for text nodes.
Actually applied on all visible inline & inline-block elements that do
not contain a font node (and are not buttons).

task-2666200

closes odoo/odoo#109537

X-original-commit: 8c965cad4d3fdbfefbbd5caa43d8c21e3a8e064f
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-01-11 09:38:53 +01:00
Benoit Socias bae305fd24 [FIX] web_editor: span gradient across text style changes
Since [1] the gradient text image was reset within each font or span
block (e.g. for applying bold style).
The change was done because Chrome does not inherit the involved styles
when a transform is used, which is the case in animated texts.

After this commit the inherit style is only applied on animated texts.
This lets the gradient span across style changes.
Note that there is no solution yet for animated texts: they still have
a restarted gradient.

Steps to reproduce:
- Drop a Title block in a website page.
- Add a few words.
- Select the whole title's text.
- Make its text color a gradient. (Not the background color)
- Select the second word (avoid picking the word in the middle to
easily see the visual impact).
- Make that word bold.
=> The gradient restarts within the bold word instead of continuing
across the whole text - even though no text animation is used.

[1]: https://github.com/odoo/odoo/commit/187acb938f70a2130d25fa76079221339c742f1e

task-2666200

X-original-commit: 372eeebb47b93890d567185879981e817cdc1326
Part-of: odoo/odoo#109537
2023-01-11 09:38:53 +01:00
PNO 9807aa9186 [FIX] delivery: speedup compute bulk weight
On the PR https://github.com/odoo/odoo/pull/107558 some performance improvements were made when computing the weights.
Unfortunately, this caused some slowdown on other cases.
This PR keeps the read_group introduced on https://github.com/odoo/odoo/pull/107558 but reduces the number of 'get' by taking all the information needed only once before entering the for loop.

For comparison, these are the differences on _compute_bulk_weight when going to Inventory/Receipts:

| Before PR 107558  | After PR 107558 | After this PR
| -------------     | -------------   | ------------- |
| 550 ms            | 10.30 s         | 560ms  |

And these when removing the filter by default (leading it to fetch heavier records):

| Before PR 107558  | After PR 107558 | After this PR
| -------------     | -------------   | ------------- |
| 2.27 s            | 24.48 s         | 1.89 s |

OPW-3107540

closes odoo/odoo#109481

X-original-commit: 4bbf782505e72761c7c77abfe4fbd53e151e5bf0
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-11 09:38:49 +01:00
Odoo's Mergebot b986e1fce8 [IMP] {website_}event_sale: add pricelist picker
Purpose
=======
As an Event seller, I might not use the /shop page
because I do not sell goods, only tickets.
That being said, I do this in multi-currency for example,
and need visitors to be able to pick the relevant pricelists.

Specifications
============
Adding the price currency on the event ticket
so that users will know which currency is used.

Adding a pricelist picker on the website event
front-end and on the ticket registration page
to allow the user to display the prices depending
on a selected pricelist.

Task-3081384

closes odoo/odoo#106980

Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-01-11 09:38:47 +01:00
amdi-odoo ba5da3a1ec [IMP] website_event: Reduce daterange width
Purpose
=======
Reduce the daterange widget width in the add
event website modal to avoid unecessary white
gaps.

Task-3081384

Part-of: odoo/odoo#106980
2023-01-11 09:38:46 +01:00
amdi-odoo f23c463b26 [IMP] {website_event}_sale: add pricelist picker
Adding a pricelist picker on the website event
front-end to allow the user to display the prices
depending on the selected pricelist.

Adding a picker to change the ticket pricelist
on the ticket registration page.

Task-3081384

Part-of: odoo/odoo#106980
2023-01-11 09:38:46 +01:00
amdi-odoo a708026eaa [IMP] event_sale: Add price currency
Adding the price currency on the event ticket
so that users will know which currency is used.

Task-3081384

Part-of: odoo/odoo#106980
2023-01-11 09:38:45 +01:00
Tom De Caluwé 11c3dc1541 [FIX] website_forum: avoid singleton error
The current domain on the forum post child_ids field is not guaranteed to work
since it requires the recordset on which it is applied to be a singleton.

closes odoo/odoo#109596

X-original-commit: d9983167a7c534a08854ad5327e36a8343ef1e5d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-01-11 08:29:45 +01:00
FrancoisGe e2cb2e7d23 [FIX] web: disabled button in list view
Before this commit, setting a disabled attribute on a <button> tag in
the arch of a list view was ignored.

How to reproduce:
Going into a list view with a <button disabled="1"> tag.
Click on the button

Before this commit:
The button is not disabled and a crash is displayed on click.

After this commit:
The button is correctly disabled and there is no crash on click.

closes odoo/odoo#109337

X-original-commit: c8ef3262e3aa167a520dcb0d1b229e61e5e2e362
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-11 08:29:43 +01:00
Maximilien (malb) 4b9894c4a4 [IMP] l10n_ve: Translation
All the localisation should be written in english and then translated to the native language of the country. In this case, the Venezuelian localisation was written is Spanish, this PR translate the module in english and add the corresponding PO file in spanish.

closes odoo/odoo#109494

Task-id: 3126154
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-01-11 07:27:14 +01:00
Ahmad Khanalizadeh b29eea8022 [FIX] point_of_sale: use float comparison in discount lines
Before this commit if there is a rounding error in product list prices,
a note is added to the invoices indicating that a discount is in
effect, while that is not the case.

Exact steps to reproduce:
1. Create a new tax with the amount of 21%
2. Make it included in the price
3. Create a new product with price of 1.65$ (1.36$ excluding tax)
4. Open a PoS session, add the product to the error
5. Enable invoicing and validate the payment

To fix this, the float comparison methods should be used.

opw-3121143

closes odoo/odoo#109585

X-original-commit: 238532f396bbc3d4fbe14d75e756307536dfe3c6
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Khanalizadeh Ahmad (khah) <khah@odoo.com>
2023-01-10 21:39:46 +01:00
lathuat1997 c1b826c495 [FIX] hr_expense: add employee_id to expense list on expense sheet form
Issue:
On expense sheet form:
- Choose an employee not like current user.
- Create an expense from expense list.
- Edit expense list and save expense sheet.
=> Error: "You cannot add expenses of another employee."

Purpose:
- Expense list has not `employee_id`.
- When save form, `employee_id` on expense list is current user.

Solution:
- Add `employee_id` on expense list.

closes odoo/odoo#109575

X-original-commit: 5558bfada8212106cee730357620000b726549cd
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2023-01-10 18:54:58 +01:00
Laurent Smet c19b29a851 [FIX] account: Clean inconsistent currencies when creating statement lines
foreign_currency_id & currency_id must always be different on a statement line.
However, this happens sometimes when importing statement lines in csv.

closes odoo/odoo#109574

X-original-commit: 0b2cb4c82fa38ca1242c2344546768e481841116
Related: odoo/enterprise#35630
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-01-10 18:54:55 +01:00
Rémy Voet (ryv) 880daf6e59 [REM] base: remove useless module_nr field of ir.module.category
The last usage was an unused tree, previously removed.

closes odoo/odoo#109420

Related: odoo/enterprise#35586
Related: odoo/upgrade#4192
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-01-10 18:54:48 +01:00
Rémy Voet (ryv) 782fb61a3b [REM] base: remove useless list view of ir.module.category
The tree view `view_module_category_tree` was unused, remove it.
The form view (`view_module_category_form`) of `ir.module.category` is
still used in the `view_groups_form` view.

Part-of: odoo/odoo#109420
2023-01-10 18:54:47 +01:00
Rémy Voet (ryv) 2e2ca3dac0 [REM] base: remove useless field field_parent of ir.ui.view.
This field is useless since 905e01921f.
Remove it and all occurence of it in view records.

Part-of: odoo/odoo#109420
2023-01-10 18:54:47 +01:00
Rémy Voet (ryv) f9dc7e2698 [REM] base: remove deprecated methods of ir.ui.view
Since https://github.com/odoo/odoo/pull/87522 (landed in v16),
`fields_view_get`, `_fields_view_get` and `load_views` are deprecated.
Remove it for maintenance (and it is the last usage of
the useless field `field_parent`).

Part-of: odoo/odoo#109420
2023-01-10 18:54:47 +01:00
Xavier BOL (xbo) c0c5ca4b44 [IMP] hr_timesheet: avoid select internal project in task views
Before this commit, when the user creates a task in the (quick create)
form view of task, he can select the internal project. The goal of this
project is to contain the timesheets representing the time offs of each
employee.

This commit filter the projects available for the task creation/edition
to be sure the user cannot select internal project.

closes odoo/odoo#109002

Related: odoo/enterprise#35377
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-01-10 18:54:40 +01:00
Odoo's Mergebot 4217f9662e [IMP] survey: improve question triggering robustness
The PR improves user experience and database consistency for triggered questions.

* Deleting questions/answers used in triggers will clean those triggers to avoid corrupt
trigger configurations.
* Questions and Survey are saved during edition allowing to add questions with score,
  validation parameters (checked against SQL constraints), and triggers on the fly
 without having to save the survey and reenter edit mode. This required to modify the
 basic_relational_model `Record` `save` method to be able to display a notification
instead of another modal in case of `ValidationError`.
* Questions that are moved and placed before their trigger will show the icon in
`text-danger` with a warning message on hover, because other forms of feedback
would be too strong to be given when users are busy reordering.

Tests are included to ensure the specific behavior and needs of this module in case
some JS framework implementations change later on.

See details on each commit.

Task-2623482
See odoo/upgrade#3613

closes odoo/odoo#78705

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-01-10 18:54:29 +01:00
Florian Charlier b1d1856245 [IMP] survey, web: enable chaining question creation
## Survey
Due to the behavior of X2Many fields, the questions created when editing
a survey were not usable immediately after creation to be conditional
triggers for new questions. The whole survey had to be saved first, which
wasn't a smooth experience for the user.

This commit will save the survey and question at several times:

### For each new question added

Similarly to what was implemented for chatbot scripts, enables the
immediate computation of allowed question/answer triggers, permitting their
use when chaining question creation.

This also enables to check the answers "validation" fields immediately, and
activating scoring and add scores to question/answers without requiring the
extra steps of saving and re-entering edit mode for the survey.

### When rows are deleted

This will trigger the immediate removal of the triggers icons on
questions that were triggered by an answer to the deleted question.

### NOT when questions are moved

As there is no convenient way to ensure questions are properly ordered with
respect to their triggers (order dependency) without popping error messages
at every step when reordering questions, we chose to mark the misplaced lines,
missing trigger records or triggers that will be ignored (with the new
`trigger` widget).

This could have been done entirely with 'server' logic, but that would have
required additional saves and cleaning fields even more often, even during a
temporary reordering step, which isn't convenient.

### Misc
Finally, note the extra fields added on the question_and_page_ids field of the
survey form view, required to trigger these fields' update consistently
(required after reordering or removing records which sometimes doesn't occur
without these).

Tests ensuring the behavior of the X2Many (saving parent on open/edit and show
notifications on error) and the trigger widget are included.

## web
To support the functionality described above, we need to allow the caller of
'save' to catch errors to prevent default handling (here to use a notification
instead of an additional Dialog).

Task-2623482
Part of odoo#78705

Part-of: odoo/odoo#78705
2023-01-10 18:54:28 +01:00
Florian Charlier 91b306b5db [IMP] survey: enforce question triggering consistency
Before this commit, the state of a question triggering fields could be
inconsistent/corrupted:

* If a question used as trigger for another question was deleted,
  `is_conditional` would stay `True` even as `triggering_question_id` would be
   `False`, which would eg. prevent saving the question edit form unless this
   is not manually fixed.
* If an answer used as trigger was deleted, the triggered question
  would never show on a survey session, but still appear as "triggered" and
  causing the same trouble on form edition.

In this commit, we
* update `unlink` methods to remove the triggering fields on triggering
  question/answer deletion
* add SQL constraint to ensure DB consistency (also improving the survey
cloning/copying behavior robustness)
* add a python test checking this

Task-2623482
Part of odoo#78705
See odoo/upgrade#3613

Part-of: odoo/odoo#78705
2023-01-10 18:54:27 +01:00
Florian Charlier 51b4e6d098 [IMP] survey: improve validation parameters UI and logic
Purpose: Showing validation parameters with an arrow on one line (when
possible) is prettier.

Additionally, we now
- Improve data consistency by preventing saving `validation_required` without
  setting validation parameters (also allows to keep arrow invisible when no
  value is set)
- Explicitly add required flags to float values as they cannot be not set (see
  c5ae9b38).

Task-2623482
Part of odoo#78705

Part-of: odoo/odoo#78705
2023-01-10 18:54:27 +01:00
GorashandNicolas Lempereur 772cc29218 [FIX] mail: fix create link wrong escaping of html entities
Issue: `node.data` is an unescaped text content and used as an escaped
content just after (set `innerHTML`) which remove some of the escaping.

Without the fix, the 2 new first assertions would fail:

- first one with 'https://example.com/?¤cy_id' instead of
  'https://example.com/?&amp;currency_id' in the text node

- second one with `&amp;` replaced by & and `&gt;` replaced by >

other assertions ensure that use case before the fix (special char and
URL regex, smileys, ...) still work the same after the fix.

opw-2525028

Fixes #70485

closes odoo/odoo#109357

X-original-commit: 4938af5dd8bfb4ea0722e3de8340ff6437329b48
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2023-01-10 17:51:50 +01:00
Leonardo Pavan Rocha 7f4e00146d [FIX] calendar: fix form view email button giving traceback
After https://github.com/odoo/odoo/pull/99386, clicking on the email button in
calendar.event form view would give a traceback as it tried accessing event_id
on a calendar.event record. This commit fixes this error as the object in the
template already is an instance of calendar.event.

task-3127534

closes odoo/odoo#109549

Signed-off-by: Arnaud Joset <arj@odoo.com>
2023-01-10 16:51:03 +01:00
Thomas Lefebvre (thle) c70e410050 [FIX] web: correct type of defaultPage prop
Steps to reproduce:
- go to "Link Tracker" app;
- go to "Campaigns" tab (UTMs);
- create a new campaign;
- leave and return in this record.

Issue:
A traceback appears.
Error message:
`Invalid props for component 'Notebook': 'defaultPage' is not a string`

Cause:
The `defaultPage` prop must be a string.
When the record is new, it will be `undefined`,
so it will pass props validation because this prop is optional.
But when we try to calculate it and it does not return a value,
the `defaultPage` is null.
The variable is therefore declared but it is empty
(and therefore not a string).
`null` value does not pass the props validation test.
The problem appears in the "Campaigns" tab
because there is a notebook without content.

Solution:
Test if it is possible to have a value.
If not, set the `defaultPage` prop to be `undefined`.

opw-3109327

closes odoo/odoo#109533

X-original-commit: 402b1a822c3983af33aa1d3a3c7e93d8836c60d8
Signed-off-by: Dardenne Florent (dafl) <dafl@odoo.com>
2023-01-10 16:50:58 +01:00