Commit Graph
278 Commits
Author SHA1 Message Date
Michael (mcm) 517d3258f2 [REF] web,*: add dependencies param to odoo.define
This commit makes the `dependencies` param of
`odoo.define` mandatory. It was optional and when
omitted, a regexp read the function to find the
dependencies. We can simplify it now almost all js
modules have been converted to esm.
The transpiler already adds the param for the es
modules except if the module has an alias.

task id: 3271352

closes odoo/odoo#119145

Related: odoo/enterprise#40040
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-05-03 12:39:30 +02:00
Mohit Beniwal aeb199d77f [FIX] web: prevent missing 'data' argument error while uploading empty file
DataURL returns 'data:' in Chrome for empty files which is not valid dataURLas
it expects 'data:<mimetype>;base64' . This DataURL method is used to obtain
base64 representation of the file data,. That's why the 'data' argument is
missing and error is being generated.

Steps to reproduce:
1) Open Notes and create a new Note in Chrome.
2) Add a new attachment using /image command.
3) Add an empty file.

By applying this,it will return proper format for empty file.

sentry - 3749971166

closes odoo/odoo#120060

X-original-commit: fd6b904a97e7dab6e720675d9c805ed45eacef1e
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-28 13:33:25 +02:00
Pulinckx Pierre (PIPU) 608e90e998 [REF] *: Replace underscore functions by native JS
Replace _.map(), _.flatten(), _.delay(), _.contains(), _.pluck(), _.isUndefined(), _.isEmpty(), _.isString(), _.isEqual(), _.isBoolean(), _.memoize(), _.invoke(), _.bind(), _.escape(), _.debounce(),
_.str.sprintf(), _.str.repeat(), _.str.startswith(), _.str.trim(),
_.str.escapeHTML(), _.str.escapeRegExp(), _.str.startsWith(), _.str.include()

closes odoo/odoo#118012

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-04-20 11:57:29 +02:00
Pulinckx Pierre (PIPU) 800223ae7c [REF] *: Replace underscore _.each() by native JS
Replaced _.each() functions (average 235 occurences)

Description of the refactoring this PR addresses:

Current behavior before PR:

There are underscore.js function enumerated above used in odoo.

Desired behavior after PR is merged:

These functions has been replaced by native javascript
prototypes/methods/functions.

TaskId : 3246238

closes odoo/odoo#118565

Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-04-18 15:38:54 +02:00
Hubert Van de Walle (huvw) 27c90b95ff [FIX] web: allow to unregister multiple listener from the same target
Steps to reproduce
==================

- Register two events listener on the same target
- Unregister them

Only the first one is unregistered

Cause of the issue
==================

`cbs` is used instead of `listeners`. This means that after any `.off`
call, the target is removed from the Map and it is not possible anymore
to unregister any events for it

closes odoo/odoo#118739

X-original-commit: 345dd30fdc627ada212a8eaa6f9817bbdaf5d3a3
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-04-17 13:09:42 +02:00
Pulinckx Pierre (PIPU) 614de86989 [REF] *: Replace underscore function by native JS
Replace _.isNumber(), _.filter(), _.reject(), _.unique(), _.indexOf(), _.lastIndexOf(), _.findIndex(), _.range()
_.keys(), _.values(), _.str.sprintf() and some _.each()

closes odoo/odoo#118003

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-13 16:40:11 +02:00
Pulinckx Pierre (PIPU) 29d55e4403 [REF] *: Replace underscore functions by native JS
Replace _.last, _find, _.extend, _.some, _.every

Taskid 3246238

closes odoo/odoo#117319

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-05 12:50:43 +02:00
Michael (mcm) 77e825cab2 [REF] web: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117456

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-04 16:01:57 +02:00
Géry Debongnie 94d7b2a773 [FIX] web: ComponentAdapter: detach it after unmounting
Before this commit, the ComponentAdapter would detach its dom before
calling the on_detach callback. This is not correct (even though it is
usually ok): we want the "unmount" code to be executed while the widget
is in the DOM, not after it has been detached. It is even more
problematic if the sub widget contains itself some owl components, since
this behaviour break Owl assumption that owl components are in the DOM
before being unmounted (so, for example, since owl 2.0.9, references
are null even if component is not in the DOM, even if the component is
still mounted).

The fix is quite simple: simply do the DOM removal after calling the
callback.

closes odoo/odoo#116752

X-original-commit: c56795d8715c9f1c85dec88d1c39e8becb4b1e62
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-28 00:05:49 +02:00
FrancoisGe 2ecfed335d [REF] *: extractProps receive dynamicInfo
Before this commit, the use of multiple <field> with the same name in a
view was not well supported.

Why was this?
Some Field components need to know information related to the <field>
such as context, domain, required and readonly. The solution used before
this commit to access this information is to use the getFieldContext,
getFieldDomain, isReadonly, isRequired functions of the model.
Unfortunately, these only take into account the last occurrence of the
<field> because the model is not aware that the same field is present
several times on the view. The information must therefore not come from
the model. For example, it was not possible to have the same field
twice with 2 different domains. It will use the domain of the last
field for both.

Solution:
We will add the object "dynamicInfo" to the fieldInfo passed to the Fields
extractProps function. This object will contain a getter to get the value
of required, readonly, domain and context for the current <field>.
If a Field needs one of its information, it will just have to get it
from extractProps.

Part of Task: 3179751

closes odoo/odoo#115197

Related: odoo/enterprise#38151
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-24 01:24:48 +01:00
Aaron Bohy 8fc4c6f2d8 [REF] *: remove legacy views support
The last view in the odoo codebase has just been converted to owl,
meaning that we no longer have legacy views. This allows us to
remove a lot of legacy view related code: the abstract elements on
which the legacy views were built, the compatibility layers that
allowed to deal with both owl and legacy views uniformly, legacy
widgets that were only used in those legacy views...

closes odoo/odoo#114893

Related: odoo/upgrade#4420
Related: odoo/enterprise#38005
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-10 13:33:04 +01:00
Mathieu Duckerts-Antoine 965fed0cd6 [REF] *: add dialogService in setupControlPanelServiceRegistry
From a practical point of view, it seems better to also add the
dialog service in the service registry when calling
setupControlPanelServiceRegistry.

closes odoo/odoo#113610

Related: odoo/enterprise#37510
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-24 14:20:30 +01:00
Aaron Bohy 952ab83c90 [FIX] web: fix sample data test failing randomly
In the sample server, we generate random float values between 0
and 100. The faulty assertion expected the value to be strictly
less than 100, however, it sometimes failed: when Math.random()
generated a value >= 0.99995, it produced 100 as float value.

Runbot error 15206

closes odoo/odoo#113181

X-original-commit: 4abfb9553559080d53bc5a8ba521eec000c56a26
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-20 21:23:48 +01:00
Aaron Bohy cfc5da5b30 [REF] web: remove unused legacy stuff
This commit removes the legacy CustomCheckbox and the backward
compatibility layer for the systray items. Both of them are no
longer used.

closes odoo/odoo#112718

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-15 13:36:51 +01:00
Aaron Bohy 49297bc7bb [REM] *: remove legacy basic views + some fields/widgets
This commit removes the legacy implementation of the form, kanban
and list views. It also removes the legacy view widget registry,
and all legacy widgets it contained. The legacy field registry
couldn't be removed yet as some fields are still used (e.g. in
client actions: FieldMany2One, FieldMany2ManyTags...), and
sometimes accessed from that registry (e.g. uom service). More
clean up will come later. Note that all tests using legacy views
have thus been removed, even though the tested feature might still
remain (e.g. FieldMany2One tests have been removed, but that field
is still there). However, those features are deprecated and
unlikely to evolve. They should be removed in the next saas, or the
one after.

Finally, this commit also removes the legacy view dialogs.

Task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Aaron Bohy b2e267872f [REM] web: remove legacy views benchmark page
Those views are no longer used and about to be removed. This
commit also removes the benchmark lib as it is no longer used.

Part of task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:57 +01:00
Samuel Degueldre ae1cd3d5bb [FIX] web: update jQuery to 3.6.3
This version of jQuery fixes a number of bugs in jQuery compared to
3.3.1

Some legacy list tests related to the handle widget have been skipped,
we consider this acceptable because:
- there are no remaining uses of the handle widget in a legacy list view
in the code base. The only remaining usage of the legacy list view is in
the SelectCreateDialog legacy, which is only used in our code base by
the very few legacy client actions that will be converted before v17
- the tests are only broken in enterprise, and the widget appears to
work fine in practice, suggesting a problem with the way tests drag and
drop rather than an actual problem with the code
- spending time to debug tests that will be obsolete within the next few
months and also appear to not correlate to an actual breakage of the
functionality is not worth it.

task-2291793

closes odoo/odoo#106960

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-23 16:01:21 +01:00
Ivan Yelizariev c37c9850fe [FIX] web: convert python/js bool values in read_progress_bar
Because of an issue with converting bool values, read_progress_bar didn't work
on grouping by bool fields (e.g. Active).

Related tests worked fine because mocked server responses were different from
real server responses. So, we need to adjust mocked server too.

opw-2870937

closes odoo/odoo#103926

closes odoo/odoo#104613

X-original-commit: e6ca3ef1b38dec964dab416c6058d4c1b7161614
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-01-13 16:27:08 +01:00
Mathieu Duckerts-Antoine 050f258bca [IMP] web: search bar: name_search context
The keys from the action context were not available in the context of
a name_search done when a user expand a one2many field in the search
bar. We add them.

closes odoo/odoo#107660

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-12 13:19:10 +01:00
Vincent Schippefilt 25c6c15a06 [IMP] base,*: remove __last_update from all models
The main goal of this commit is to reduce the size of the registry by
removing the (almost) useless __last_update field.

Statistics # of fields with all modules installed:
before 30184 fields, 1299x last_update (4.30%)

Before this commit, the computed field __last_update was added on every model.
The idea behind this field was to have a computed field that had either
the write_date or the create_date if the write_date was empty. However,
the write_date is always written, even on creation, making it useless
to have the computed field __last_update

After this update, we completely remove from BaseModel:
* __last_update
* CONCURRENCY_CHECK_FIELD that was always defined as "__last_update"
* _compute_concurrency_field that was the compute function for __last_update

closes odoo/odoo#105739

Task-id: 3062140 (part of 3062137 improve registry load time)
Related: odoo/upgrade#4038
Related: odoo/enterprise#33939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-12-07 18:29:01 +01:00
Hubert Van de Walle (huvw) 355b004775 [FIX] web: many2one field autocomplete not cleared on blur
Steps to reproduce
==================

- Create an invoice
- Add a line
- Type storage in the product field
- Ctrl+A then press backspace
- Press escape to close the autocomplete dropdown
- Click elsewhere
-> The first suggestion is now selected

opw-3055185

closes odoo/odoo#107302

X-original-commit: e0613bc06ba9f2653dd0cfc4057ba93abf8513f7
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-12-07 10:02:17 +01:00
Chong Wang (cwg) 75c72735fa [FIX] core: fix translation dialog
The fix in #106174 was not good.
The translation dialog cannot update not translated terms

the initial term value may be empty "" when the source and the translation are
the same at first. So, the source to for update_field_translations should be
  const source = term.value ? term.value : term.source;

closes odoo/odoo#106528

X-original-commit: 1ed5ce6f16d32efc0c5ec4cead67b2d8a57f6c41
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-25 17:56:40 +01:00
Bruno BoiandLuis González 29ca002ee5 [FIX] web: menus missing aria attributes
Some missing aria attributes from 14.0 are reintroduced.

They are required for screen reader users to be able to know if menus
are opened and if menuitems are checked (e.g. if a filter is applied).

closes odoo/odoo#106277

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Luis González <lgonzalez@vauxoo.com>
2022-11-23 13:24:51 +01:00
Chong Wang (cwg) 0e3d496936 [FIX] web: fix translation dialog for model terms
Before this commit, new model term translations cannot be saved if it has been
translated before.
The reason is while translating fr_FR
the backend needs the mapping {old_term_fr: new_term_fr} to update old_value_fr
However the UI sent {old_term_en: new_term_fr} which was wrong

This commit fixes the bug by changing the key of the mapping from the
old_term_en to the old_term_fr

opw-3074712

closes odoo/odoo#106257

X-original-commit: f28c11917e093d0d3f5d18f0b377cfb24a7dbd92
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Wang Chong (cwg) <cwg@odoo.com>
2022-11-22 17:09:24 +01:00
fdardenne 4edbe54456 [REM] web: qweb views
QWeb views allowed to render QWeb templates rendered by the server in
a view.

Today, QWeb views are only used in website to see the hierarchy of
their views. The use case of website has now more sense in a client
action rather than an extension of a QWeb view.

This commit removes this view because it is not used anymore and will
probably not find any useful use case in the future.

closes odoo/odoo#103477

Related: odoo/upgrade#4016
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-15 18:25:12 +01:00
FrancoisGe f3fc533401 [FIX] web: search in a m2o block the ui
Before this commit, performing a search in a m2o can block your ui
despite the result already being displayed.

Why?
When you perform your search in a m2o, a set of RPC queries are made
with the different search values (name_search). If the last search value
(the one that will be used by the m2o in its autocomplete) has already
been resolved, but one of the other RPCs has still not been resolved,
then the screen will remain blocked until all the rpc's have been resolved.

Solution:
Since we are only interested in the last rpc, we will cancel all the
others. So with each new rpc, we will cancel the previous one.

How to reproduce:
- Go to a form view with a m2o field
- Edit this field +- slowly (several rpc will be done with different values)
- Receive the result of the search. (The autocomplete is displayed with
     the right values)

Before this commit:
If one of the other rpc's is not yet resolved, the ui will block
until all rpc's are resolved.

After this commit:
The ui will not block.

closes odoo/odoo#105286

X-original-commit: 1700416551725a70eca5597b6e106b43282c00d2
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-11-14 14:20:45 +01:00
Jorge Pinna Puissant 4f24e34b39 [IMP] test_lint, *: eslint remove caughtErrorsIgnorePattern from no-unused-vars
Unused catch block arguments are now forbidden even when prefixed with an
underscore:  if the argument on the catch block is not needed, the use of the
optional catch binding is enforced.

Part-of: odoo/odoo#105433
2022-11-09 16:08:07 +01:00
qsm-odoo 9cfdffdee3 [FIX] web: restore dialog callback calls (e.g. cloning a website page)
Commit [1] broke some confirm dialogs because the confirm and cancel
callbacks are not called with the same `this` anymore. Note that [1] was
actually not forward-ported here in 16.0 but now is via this fix.

E.g.:
- Install website
- Go to the page manager (/website/pages)
- Clone a page (choose a name and confirm)
=> Crash (this.$ does not exist).

Note that this flow was quickly fixed with [2] by changing the local
code instead of fixing the root cause (this commit here actually
technically reverts that change so it keeps working). This flow was
also not broken in 16.0 as the code was rewritten differently.

The work done at [1] actually needed some more rework than that to
handle two other potential usecases:

- If the confirm dialog handlers' promises are rejected, the dialog is
  not closed (rightfully, like for example allowing to fill an empty
  required input)... but [1] prevented to click on the button again
  forever. With the same example as above, it can be reproduced: if the
  RPC to clone the page fails, I cannot retry.

- If not both confirm_callback and cancel_callback were given, [1] only
  prevented to multi-click on the related button (e.g. if you click on
  "Ok", a RPC which takes 10 seconds is made, you click on cancel
  immediately afterwards -> the dialog is closed while it should be
  prevented (and would be if cancel_callback was given, following [1])).
  That may not be entirely stable to make this change though but it
  seems to make sense and be better (just keeping what [1] wanted here).

Note: this adds some more tests to check all of this + some more things
that were found during development. For example: [1] relied on the fact
that callbacks returned a Promise or nothing... while developers
actually were returning random things (for no reason as no way to get
the result anyway). Adding a test for this prevents to break that in
stable (the first iteration here crashed in such cases).

[1]: https://github.com/odoo/odoo/commit/4b8b079a7d9991a8dc481fe71a45185d672135c9
[2]: https://github.com/odoo/odoo/commit/8216341f5ad8d82ad0bcb0d1f01d874477d2de7b

Closes https://github.com/odoo/odoo/pull/103712
opw-3033878
opw-3043224
opw-3046485
opw-3042542

closes odoo/odoo#105081

X-original-commit: 90b280c221f3c0819cb0b291e102f161fc47507a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-05 17:30:42 +01:00
Joseph Caburnay c144ac4cf0 [FIX] web: un-stored m2m field is not valid custom groupby
Even if a many2many field is forcely set to be sortable, it should
not be included in the list of custom groupby options if it's
an un-stored field.

closes odoo/odoo#104978

X-original-commit: 9ba52387481bb0720c5d4f5d8a86c3ad6e801137
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-04 11:59:08 +01:00
Joseph Caburnay c412f11c02 [REF] web,web_*: import owl features using "@odoo/owl" module
In @odoo-module files, we do the following conversion:

`const { ... } = owl;` -> `import { ... } from "@odoo/owl"`.

While in legacy odoo module (odoo.define):

`const { ... } = owl;` -> `const { ... } = require("@odoo/owl");`.

closes odoo/odoo#104260

Task-id: 3032274
Related: odoo/enterprise#33298
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-27 14:41:17 +02:00
Mathieu Duckerts-Antoine 6aac153473 [FIX] web: py.js: offset in to_utc
Take a (py.extras) datetime representing the moment "2022-10-17 00:00:00"
in the timezone of Brussels. Trying to get the related utc moment through
to_utc gives wrongly "2022-10-16 23:00:00". This happens because the
months are not numbered in the same way in Date or datetime, so that in
October for example, the offset applied was that of November which is
-60 instead of -120 (summer/winter change). We fix that problem.

closes odoo/odoo#103579

X-original-commit: ee1a8d26f241f2f7bea6880afcc946119b0e6bd8
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-19 20:47:54 +02:00
Renaud Thiry 96c8dd3ca8 [FIX] web_editor: onAttachmentChange only composer
Due to a previous fix, attachments uploaded through media dialog would appear in the attachments of mail marketting.
That fix prevents attachments from 'dangling' and being garbage collected later.

That fix is now limited to the mail composer in this commit as attachments are only garbage collected for that model, for now.

related commit: c112361bf9e2f5e7b087c5e5b9a31879856b1da4

task 3003939

closes odoo/odoo#103038

X-original-commit: 69fdca133b06eb66443635bc52d380233580ef51
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-11 14:10:25 +02:00
stefanorigano (SRI) 5234fad374 [IMP] web, base: adapt for dark-mode
This commit adapts several components in order to correctly handle
color-scheme variations.

It also allows user_menu to handle switch entries 

task-2710677

Part-of: odoo/odoo#102868
2022-10-11 13:15:53 +02:00
Aaron Bohy 40df434b2d [REF] web: remove legacy calendar view
The calendar view and all its extensions have been converted to
owl, so it's time to get rid of the legacy implementation.

closes odoo/odoo#101816

X-original-commit: 681a6a98c9919021c2f688609e5e4263a9cf4d14
Related: odoo/enterprise#32130
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-01 14:52:16 +02:00
Aaron Bohy 96c590504b [REF] web: remove toggle_button field from registry
This field widget is no longer used in form, list or kanban views,
so it hasn't been converted to owl. This commit removes its legacy
implementation from the registry, s.t. we ensure nobody use it
again. Moreover, we adapted a new view test using it to use another
field widget instead, to remove the dependency and ease the removal
that should happen soon.

closes odoo/odoo#101787

X-original-commit: 68cfd4b08bc9ab0305ae9033e42820370b52bdf3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-30 18:42:37 +02:00
Aaron Bohy 23e93f9341 [FIX] web: Mutex: do not fork rejected promise
Have a many2one field in a form view, and try to quick create a
record. If the name_create returns an error (e.g. ValidationError
in the model), the many2one field opens a form in a dialog (aka the
slow create). It thus properly handle the error.

However, before this commit, the error returned by the RPC was also
displayed in its own dialog (behind the form dialog).

This was due to a mistake in the Mutex, which forks the promise
returned by the registered action. When that promise was rejected,
the forked one was thus rejected as well, and it wasn't caught.
That later promise is only used to unlock the mutex, so we can
safely catch it.

closes odoo/odoo#101549

X-original-commit: fe9e044b9e03ac7fff5d314e6e207921a15c8965
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-29 12:17:09 +02:00
Julien Mougenot 05d361d383 [REF] web: Rename legacy sample view class
This commit renames the 'o_view_sample_data' class to
'o_legacy_view_sample_data' in legacy views to allow new views to use
different sets of rules.

X-original-commit: 05ae053dc94f9ce91c099d74f6740604e3e376c3
Part-of: odoo/odoo#101485
2022-09-28 21:26:32 +02:00
Renaud Thiry 0553e16dbd [FIX] mail, web_editor: dialog file update event
An event was not called on uploading files in a media dialog.
This meant the parent of html field didn't know of the new attachments
which resulted in attachments being linked to no record at all
and  not being garbage collected later.

This adds a reference inside the media dialog file input so that it can
trigger that event on behalf of the html field.

The attachments newly uploaded in media dialog are uneditable
to prevent users from unlinking attachments
that are still used in the body of the composer (causing the same issue)

Task-2860761

closes odoo/odoo#101405

X-original-commit: f4dd1eb3f25672e7309759c347e2b552c5652b2f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-28 14:19:11 +02:00
Aaron Bohy a076fc14e2 [REM] web: remove two unused field widgets
closes odoo/odoo#101351

X-original-commit: 577e9898029b84a70c85f2eefa68d02e265dd4fd
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-27 22:03:00 +02:00
Bruno BoiandJorge Pinna Puissant ed9a9d024a [REF] *: calendar view in owl
This commit introduces the new calendar view written in owl.

closes odoo/odoo#101185

X-original-commit: e88988f58582d5b49a32d7102a74a176f40c4c69
Related: odoo/enterprise#31808
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2022-09-26 22:48:44 +02:00
Yolann Sabaux fc594c6b50 [FIX] web: numpad decimal with number type
Steps to reproduce:
- in Barcode > Inventory Adjustment
In the quantities add a decimal numpad

Issue:
Traceback

Cause:
The field is from type=number. This kind of field does not accept methods such `selectionStart()` or `selectionEnd` which causes an error: https://html.spec.whatwg.org/multipage/input.html#do-not-apply

Solution:
When of type=number, just return.
On Chrome, numpad won't be possible for regions such as Portugese - BR. They would have to use the keyboard key `period`, code '.' in order to be able to put a decimal via the keyboard.
In Firefox, HTML is parsing the input correctly if the browser settings are set to the right localization. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#localization

opw-2956481

closes odoo/odoo#100953

X-original-commit: d95fbd80f63efbb47c9635e299f6ac417c5cb4c2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
2022-09-23 11:22:35 +02:00
FrancoisGe c82fdaa538 [REF] web: convert signature field/widget to owl
closes odoo/odoo#100865

X-original-commit: f13e4c486b9d0bf5828f83425b21d11388e45bdb
Related: odoo/enterprise#31653
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-23 08:25:58 +02:00
gawa-odooandHabib 7e3403068f [REF] *: Analytic Apocalypse
The goal of this commit is to get rid of the analytic tags as they were confusing, serving tag purposes as well as distribution on analytic accounts.

Everywhere analytic tags were used as a distribution have been replaced with a new widget that will dispatch distribution on analytic accounts. If there was an analytic account field next to the tags, it has been included in the distribution.

Analytic tags that were used simply as information tags have been removed.

To fill the new widget, there are now 2 kind of rules that will help fill and prefill it.
The first are applicability: previous groups have been removed, and have by replaced by plans. Each account is required to have a plan. These plans define when they are available in the widget: a default applicability per plan and applicability lines that can specify rules following the context of the widget.

The second one are distribution models, that will replace previous default rules but follow the same principles. The accounts (and so the plans) that will be given by the distribution model can override the applicability rules from before.

closes odoo/odoo#98914

Related: odoo/upgrade#3885
Related: odoo/enterprise#30743
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: Habib (ayh) <ayh@odoo.com>
2022-09-20 12:36:01 +02:00
Chong Wang (cwg) b43d117e0e [IMP] web, web_editor: translation dialog for new translate api 2022-09-15 22:37:50 +02:00
Mathieu Duckerts-Antoine 774aaa4984 [REF] *: remove legacy graph and pivot views
Now that web_studio no longer uses the legacy graph and pivot views and
that all their extensions have been converted, we can finally remove
them from the code base.

closes odoo/odoo#99734

Related: odoo/enterprise#31112
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-15 19:20:53 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Gorash 5410b7c238 [IMP] base/web: XML templates are added into the asset bundles.
XML files are now declared in python module manifests. During the qweb
't-call-asset' directive, assetbundle will fetch the declared xml files,
apply the inheritance (t-inherit) and create a javascript service (for
eg: 'web.assets_backend.bundle.xml') which is added at the end of the
*.js mimifier file.

When the debug mode is activated, comments are added in the template
indicating which file the template comes from as well as the
inheritances applied to it.

****

JavaScript:

assets.js (module @web/core/assets) takes care of loading libraries,
javascripts and styles.
`loadJS(url)` (loads the javascript and returns a resolved promise when
the templates are also loaded via the '*.bundle.xml' service)
`loadCSS(url)` (loads the style a resolved promise when the file is
loaded)
`loadXML(xml, app=assets.defaultApp)` (load template into
application/owl, used by the `*.bundle.xml` services)
`getBundle(bundleName)` (get the bundle descriptor)
`loadBundle(desc)` (load the files and bundle from a descriptor)

templates (XML element content all owl templates)

A new `ready(serviceName)` method on boot.js lets you know when a
service is loaded are the require.

The xmlDependencies attribute no longer exists.

Python:

The xmls taken into account by assetbundle.py, applying `t-inherit`
inheritances and adding an `name_of_the_bundle.bundle.xml` service in
the generated JavaScript file.

****

Every manifest changes is into the next commit, except 'web_tour' in
this current commit as example.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Florian Damhaut b3489af4c1 [FIX] web: basic_model: save a paged nested o2m
In a form view, have a o2m field (A), with a nested o2m field (B).
The A field should have multiple pages, with each record having at least one record
in their B field.

Have a (C) field that will modify a record in the nested o2m when changed.

Change the C field, and save.

Before this commit, the record's nested o2m from the other page had a wrong value
(a mere 4 command).

After this commit, their value is a command 4 and a command 1, with the right values.

closes odoo/odoo#99986

X-original-commit: e45e3b83f0f3116cc983c6bd8a9212e815b4d4f5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 13:49:31 +02:00
Denis Ledoux 43953c2a4d [IMP] web: allow to have nested buttons in form header
Before this revision,
it wasn't possible, in the form header,
to organize buttons in nodes.
If you attempted to do so, the buttons were not appearing.

e.g. for the below form
```xml
<form>
  <header>
    <button name="0"/>
    <button name="1"/>
    <div id="special_buttons">
      <button name="2"/>
      <button name="3"/>
    </div>
  </header>
</form>
```
Before this revision, the buttons 2 and 3 were not appearing.

Adding this possibility can allow simpler inheritage,
for instance by organizing buttons in sections and then
the inherited view can add buttons directly within the right section,
using a selector targetting the section.

It also allows to restrict a button to users having 2 groups.
e.g.
```xml
<button name="action_draft" position="after">
    <div groups="sale.group_auto_done_setting">
        <button name="action_done" type="object" string="Lock"
            states="sale"
            help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver." groups="sales_team.group_sale_manager"/>
        <button name="action_unlock" type="object" string="Unlock"
            states="done"
            groups="sales_team.group_sale_manager"/>
    </div>
</button>
```
If you want to restrict the button `action_done` to users
having both `sale.group_auto_done_setting` and `sales_team.group_sale_manager`,
you cannot put both groups on the same node,
because otherwise it's an OR connection, not an AND.
`groups="sale.group_auto_done_setting,sales_team.group_sale_manager"`
means
"users has `sale.group_auto_done_setting` or `sales_team.group_sale_manager`",
not AND.
So, the only possibility to restrict a button to two groups with an AND
connection is to restrict the button to a group and nest the button
inside a block restricted to the second group.

The above example is an actual example/need from the existing code.
But, as this possibility wasn't there before this revision,
they achieved the goal by using the `groups_id` feature:
```xml
<record id="view_sales_order_auto_done_setting" model="ir.ui.view">
    <field name="name">sale.order.form</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="groups_id" eval="[(4, ref('sale.group_auto_done_setting'))]"/>
    <field name="arch" type="xml">
        <button name="action_draft" position="after">
            <button name="action_done" type="object" string="Lock"
                states="sale"
                help="If the sale is locked, you can not modify it anymore. However, you will still be able to invoice or deliver." groups="sales_team.group_sale_manager"/>
            <button name="action_unlock" type="object" string="Unlock"
                states="done"
                groups="sales_team.group_sale_manager"/>
        </button>
    </field>
</record>
```
So they had to use an inerited view for that purpose only to restrict
the button to two groups. It's a work-around.

It is much simpler to allow to have nested buttons in the header of the
form.

closes odoo/odoo#98551

Related: odoo/enterprise#30643
Related: odoo/upgrade#3812
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-29 22:42:56 +02:00
Sébastien Geelen (sge) d32a8c53c2 [IMP] web,web_editor,mass_mailing,sms: new dynamic placeholder
Introduce a new Dynamic Placeholder Generator
in mass mailing and SMS creation.

Using a specific character (#) in subject or via the PowerBox in body
we open a field selector popup, which can be use to select
the wanted field and enter a default value. on validation, the dynamic
placeholder will be inserted in the corresponding input/editable.

task-2154624

closes odoo/odoo#71878

Related: odoo/enterprise#30333
Related: odoo/upgrade#3766
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-08-26 17:16:10 +02:00