As all the templates are now imported in the owl app, the templates must
comply to owl.
range is not in the rendering context on owl, so instead of using it, we
use Array.
Part of task~3443861
Part-of: odoo/odoo#130467
This commit removes the qweb.render method, instead it will use the owl
render engine (renderToString or renderToElement).
Part of task~3443861
Part-of: odoo/odoo#130467
As all the templates are now imported in the owl app, the templates must
comply to owl.
t-key is mandatory when using a t-foreach
Part of task~3443861
Part-of: odoo/odoo#130467
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.
task-3292454
closesodoo/odoo#130865
Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Underscore.js has been removed from legacy qweb engine
and from web manifest.py
range and uniqueId functions has been added to qweb
engine to replace usages of them in xml templates.
Underscore usages has been remove from xml templates.
taskId : 3246238
closesodoo/odoo#123018
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.
This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).
closesodoo/odoo#121629
Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Current rule to edit publisher fields (comment, ...) is to have the editor
group. However when having only portal, this group does not exist. The
feature should work as a standalone feature without depending on website.
The rule is then updated as follow: either the current user belongs to the
editor group (if it exists), either it can write on the related record
(given res_model / res_id).
Currently no crash in standard addons occur because its main usage is in
eLearning application, where editor can answer and update publisher comment
from the frontend (course review).
Task-3322905
Part-of: odoo/odoo#121104
Currently when modifying publisher comment, publisher partner id and date are
synchronized if not given in order to always have coherent values. In this
commit we do the same at create. Even if won't happen frequently better ensure
values coherency. Moreover it helps writing tests.
Task-3322905
Part-of: odoo/odoo#121104
RATIONALE
Purpose of this change to rewrite the formatting done on messages displayed
on simple frontend i.e. portal chatter widget and project chatter.
We stop calling 'message_format' which computes a lot of unnecessary data
and sends too much information to frontend. We choose to instead manually
handcraft the returned data, already tailored for frontend widget.
SPECIFICATIONS
Remove call to '_message_format' in 'portal_message_format'. Instead have
a list of properties (fields or computation based on fields e.g. rating publisher
information) that can be overridden in sub-addons. Use those to generate
the data used by frontend chatter widget.
Remove extra formatting or data computation done in JS files. Do it directly
in 'portal_message_format' in order to have clean information sent.
This change targets mainly portal and portal_rating. Making those modules
Independent from backend message formatting allows to save queries and
also to avoid sending useless information to the frontend.
Task-3322905
Part-of: odoo/odoo#121104
Before this commit : The library underscore.js and
underscore.string.js were used in the ODOO solution.
After this commit : Every usages of a function from
underscore.js lib has been replaced with native javascript.
The goal is to remove all usages of underscore.js and to
not use anymore this library in ODOO.
---
TaskId : 3246238
closesodoo/odoo#120437
Signed-off-by: Géry Debongnie <ged@odoo.com>
*: l10n_fr_pos_cert,portal_rating,pos_adyen,pos_epson_printer,pos_loyalty,
pos_mercury,pos_restaurant,pos_restaurant_adyen,pos_restaurant_stripe,
pos_sale,pos_six,pos_stripe,web
This is part of the continuous effort of refactoring pos addons towards using
more modern modules and programming patterns (such as services). After this
commit, point_of_sale addons are now left with the use of the legacy
`web.concurrency` module because of the `MutexedDropPrevious`. It's okay to keep
it because it's relatively an independent module compared to other legacy web
module.
The following summarizes the changes in this commit.
- import `_t` from `@web/core/l10n/translation`.
- convert `PosDB` to js native class
- remove use of `format` in `TicketScreen`
- To determine the cached orders are up-to-date, we now deserialize the dates
coming from the server using web's `deserializeDateTime` function. Then,
instead of initiating `cacheDate` as native js Date, we use the luxon's
`DateTime` which is supported by the web date utility methods.
- There is no need for the `format` function from `web.utils` legacy module.
- convert `PaymentInterface` to native class
- remove use of `web.config` module
- remove use of `web.time` module
- use `serializeDateTime` from web.
- remove use of `web.rpc`
- remove use of `web.utils` module
- introduce simple check for email address input
- Replace use of `web.utils.Markup` with `@odoo/owl.markup`.
- 'web.utils'.{round_decimals,round_precision,float_is_zero} copied to
'@web/core/utils/numbers'.{roundDecimals,roundPrecision,floatIsZero}.
- These helper functions are not removed from the web addon because they
are also used from other addons that are not linked to pos.
- `floatIsZero` is now computed by directly comparing the result of
`roundDecimals` to zero. This works because rounding a decimal number
which will result to zero will exactly give zero.
- remove use of `web.field_utils`
- Replace `web.field_utils.parse.float` with
`@web/views/fields/parsers.parseFloat`.
- Replace `web.field_utils.format.float` with
`@web/views/fields/formatters.formatFloat`.
- Replace `web.field_utils.format.date` with
`@web/core/l10n/dates.formatDate`.
- Replace `web.field_utils.format.datetime` with
`@web/core/l10n/dates.formatDateTime`.
- convert `PrinterMixin` and dependents to native class
- `PrinterMixin` is converted to `BasePrinter`.
- `Printer` is converted to `HWPrinter` (extending `BasePrinter`).
- `EpsonPrinter` retained its name and is converted to extend `BasePrinter`.
- Moreover, we also removed the convoluted `PrintResultGenerator`, replaced by
simply creating object with the following signature:
```js
{ successful: boolean; message?: { title: string, body?: string } }
```
- remove use of `web.Session`
- replace use of `qweb.render`
- We use `renderToElement` as replacement to templates that produces valid
html.
- Note that `renderToElement` is introduced in `@web/core/utils/render` module
which is extracted from the original `renderToString` method.
- For the epson printer template, we kept the xml layout and manually add
required xml element to contruct the xml that will be sent to the epson in
making print requests.
- use `Mutex` from `@web/core/utils/concurrency`
- remove use of `Markup` when rendering receipt info (`ticket`) in order to
render new lines.
- Remove use of `jquery` in `htmlToImg`.
closesodoo/odoo#117231
Related: odoo/enterprise#39078
Signed-off-by: Samuel Degueldre <sad@odoo.com>
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
closesodoo/odoo#118565
Signed-off-by: Georis François (fge) <fge@odoo.com>
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
closesodoo/odoo#117305
Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
Commit https://github.com/odoo/odoo/commit/22baab2d0ec2c076a4c769f6c594062c0cea5f90 introduced changes to make sure that
footer is not visibly moving when user moved from course to rating tab
on website slides. However, that issue was already solved in the same
commit, with style changes on o_wslides_course_main. Thus, we were left
with big empty space underneath comments section on not only website slides,
but also on any other place where comments section(portal.chatter_messages)
was present.
This commit removes redundant code in order to correct style in pages where
comments section is present.
Task-3203106
closesodoo/odoo#115431
X-original-commit: a58123c1faf888c561e41fd5716be25a44973d6c
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
PURPOSE
Added some light wording improvements to various screens.
SPECIFICATION
- There was a strange flicker of 'Add a review' and 'Write a review
while loading the course player because we have different strings
in XML and js due to which while loading it appears like flickering
of 'Add a review' and 'Modify Your Review' so, we modified the string
to 'Review' and also moved the share button from left to right to improve
the view.
- This commit will rename the 'New Post' button to 'Forum' and add
tooltip 'Forum' to it.
task- 2627364
closesodoo/odoo#78139
Related: odoo/upgrade#3444
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
* portal, web_unsplash, website_*
This commit renames the `website.group_website_publisher` into
`website.group_website_restricted_editor`.
While the change in itself might look unuseful, it will help the dev and
tech community figuring which group is related to which feature.
Even internally when we discuss specs, we always have to remind which
group is the restricted editor: the publisher one or the designer one?
While it is probably, after all those years, now anchored in some dev
mind, there is no easy way to directly figure which of those 2 groups is
the restricted editor one.
Note that I myself always got confused about it.
Now, the "Restricted Editor" right will be reflected in its technical
name `group_website_restricted_editor`.
Same as for the "Editor & Designer" which technical name is
`group_website_designer`.
As we would like to have a fully working and ready system in v17 for the
community to be able to build themes easily, removing that dubious part
is a nice to have.
Part-of: odoo/odoo#98200
Just doing the summer file cleaning. Move rating code into files named based on
their model, easing maintenance and searching for those data.
Spotted during Task-2207626 (Rating: Delay rating notification to ease feedback)
Part-of: odoo/odoo#98661
The logic not identical in BS4 -> BS5
The color contrast system in BS5 relies on WCAG 2.0 contrast algo.
So color-yiq is converted to color-contrast.
Note that there are some "texts/buttons/other visuals" elements
which will not have the same contrast as before.
$yiq-text-dark and $yiq-text-light are respectively replaced with
$color-contrast-dark and $color-contrast-light.
Note that we had to use '$min-contrast-ratio: 2.2' for .o_tag_color_X badge.
Task ID: 2766483
Part-of: odoo/odoo#95450
Co-authored-by: Stefano Rigano <sri@odoo.com>
PURPOSE
This commit slightly changes the wording and improves the website editor
integration.
SPECS
Reword "slide" to "content"
As slide is a technical term that does not mean much to end-users.
Make some elements not editable by adding "o_not_editable", or non visible
in edit mode by adding "css_editable_mode_hidden".
The e-learning website interface allows the course editors to modify the course
content using various buttons ("Add Quiz", "Add Content", ...).
Those buttons should not be edited by the web-editor, as it could mess up the
display and break potential future changes to the module / features.
Task-2727654
Part-of: odoo/odoo#86721
The implementation seemed buggy as you had to click twice on a rating to
activate the filter; this fixes the problem.
It also improves a bit the interface:
- by allowing to click on another rating directly without having to deactivate
first the current filter
- by replacing "Remove Selection" by a red fa-times
- by adding a spinner on the messages zone while the messages are loading when
the connection is slow (the spinner appears only after half a second if the
server doesn't response in the meantime)
- by setting some minimal heights to avoid seeing the footer moving when
switching from course to review and when changing the star filter (which change
the number of message displayed)
Technical notes:
The double click problem was caused by an update of the view when the rating
filter is changed. When re-clicking on the same rating the view was not
re-rendered and the change (selection) in the view were kept.
To solve that problem we have implemented the selection directly in the view
and the css. As it doesn't rely anymore on changes performed in javascript
in the dom, the re-render of the view after fetching the data from the server
reflect the selection done by the user.
Task-2754954
closesodoo/odoo#85757
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose
=======
Fix bug introduced in efd178daee689192d4e930a075475587038b3e0d
that created a new review instead of modifying your old one in
website_slides.
Task-2723643
closesodoo/odoo#85184
X-original-commit: f939260f9e90b58ea79197939d9644160c84a0a9
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is the 14th commit of a comprehensive refactor of our HTTP
framework. See odoo/odoo#78857 for complete historic, discussions and
rationnals.
* `request.uid = x` => `request.update_env(user=x)`.
* `request.context = x` => `request.update_env(context=x)`.
* `request.context = dict(request.context, x=y)`
=> `request.update_context(x=y)`.
* `request.cr = None` => `request.cr.close()`.
* `http.mono_db()` => `request.db`.
* `http.dispatch_rpc()` => `service.dispatch_rpc()`.
* `@service.model.check` => `service.model.retrying()`.
* `request.endpoint`
=> `env['ir.http']._match(request.httprequest.path)[0].endpoint`.
* `request.routing_iteration `=> `removed`.
* `request.jsonrequest` => `request.dispatcher.jsonrequest`.
Note that `request.params` is now set much later in the process. If you
are in a situation where you values from the query string or the
http body you can use `request.get_http_params()`.
Note that using the new `request.future_response`, it is possible to
add headers and cookies on the response object before the response
object is initialized. Please note that headers/cookies saved on
the future response will NOT be injected in case of error.
PR: odoo#78857
Task: 2571224
When hovering a star, a title is disturbing since a description is already
displayed to the user. "One star" is therefore confusing since it will appear
on every star, even for the fourth one out of five, for instance. Therefore,
all titles are removed from stars. Also, to avoid this confusion in aria label,
we do not use numbers in cleaned labels.
Task-2728564
Part-of: odoo/odoo#82792
Before, the inline-block style created some small unbreakable whitespace between
the stars in the review/rating composer. It meant that when the user hovered
their mouse in that space, they left the star element, but not the stars area,
hence displaying the message of the default (current) rating instead of the one
that corresponds to the closest star. It is repaired using an inline-flex for
the stars area. The stars are also centered in their element, with a small
horizontal padding.
Task-2728564
Part-of: odoo/odoo#82792
In order to reduce friction and ease the rating process for attendees,
we do not force the constraint stating that the message must contain a
message or an attachment onto the users. Instead, we allow ratings and
replace the empty message by a blank space to avoid triggering the error
message. If no stars are selected, an error message is now displayed to
the user, asking to select a rating before submission, preventing them
to post their review until then.
Since we do not really support 0 stars ratings, and do not want the user
to see that error message in case of the course, we set the default rating
to 4.0 instead of 0.0.
-> Therefore, we also remove the grey star contrast coloring on first review
since we do not want the user to have the impression a choice has already
be made beforehand. In that case, everything will be yellow.
Void content detection is done by extracting it in both python (portal
chatter post controller) and frontend (submission check) and relaxing it
in slides modules.
Task-2728564
Part-of: odoo/odoo#82792
When hovering the number of stars of a course in front-end, for instance,
one can see "4,16666666666667 stars on 5". This is not very convenient.
The number is rounded up to two decimals instead. -> "4,17 stars on 5".
Same fix is done in backend in slides-specific kanban view of ratings. Value
is now rounded.
Finally _rating_get_repartition is fixed round values to the nearest half
value. We generally receive integer values between 0 and 5 but other values
may exist. Getting a repartition rounded at nearest half integer is sufficient
notably when looking at star-based display which covers only complete or half
complete stars.
Task-2728564
Part-of: odoo/odoo#82792
Co-authored-by: Noé Antoine <nan@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
When answering to a comment, or editing such an answer, the form shows
a "Published on" which is supposed to be followed by the date the comment
has been published. However, since when using the form we are editing or
creating an answer comment, it remains empty and useless. Therefore, we
remove it. It is still on comments once set, but not while editing them.
Task-2728564
Part-of: odoo/odoo#82792
This commit adds a feature where users can reply to messages of other
users, doing this will show a reduced version of the message that has
been replied to above the message once posted, clicking on this reduced
version will scroll to the original message and highlight it if that
message is already loaded.
task-2362251
closesodoo/odoo#77941
X-original-commit: cec2e69e832072dd699274187ddfa122e29d03f3
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
This commit adds a new template called "Rating: static star compressed
widget".
Instead, having 5 stars, it returns an empty/half/full star with the
average rating. This smaller layout is used in the dynamic snippets
product.
Adapts the style of empty stars (it uses the outline star icon instead grey
background) to work well on light and dark backgrounds.
Part of https://github.com/odoo/odoo/pull/75623
task-2602978
X-original-commit: 0690e187ebb7e67694c8236f420213beed29993d
Part-of: odoo/odoo#77153
The license is missing in most enterprise manifest so
the decision was taken to make it explicit in all cases.
When not defined, a warning will be triggered starting from
14.0 when falling back on the default LGPL-3.
closesodoo/odoo#74245
Related: odoo/design-themes#48
Related: odoo/enterprise#19862
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Replace t-raw by t-out when outputting the chatter message.
Mark message body as safe during preprocessing: messages from the
portal chatter are automatically escaped when
posted (`/mail/chatter_post` assumes the message body is plaintext,
and escapes it before formatting it based on newlines, maybe one day
it'll accept markdown) while messages from the backend chatter are
"HTML-light" and should be sanitized.
Add HTML fields support to kanban view (currently bespoke but maybe it
should be done via `format`), and remove t-raw for HTML fields there.
Also just strip some t-raws which were completely unnecessary to start with
Purpose
=======
Remove the flicker of the "portal rating" widget when we load the page.
Specifications
==============
Currently, the portal rating widget is composed of 2 parts
- A Python template
- A JS template
There's also 2 widget, one widget who is linked to the Python template
and which instantiate another widget (which will render the JS template).
That's why we have a flicker, the button of the widget is rendered in
Javascript.
The purpose of this commit is to simplify that, to have only 1 widget
and to have as munch as possible in the Python template.
Technical
=========
We still need 2 different template (Python / JS) because in the
non-fullscreen view, after editing our review, we do not want to refresh
the page, but we want the average rating to be updated.
Task 2322583
Purpose
=======
Add a new option on the portal rating composer, "hide_rating_avg" in
order to hide the global rating on the button and allow to fully
customize the button. Also allow to customize the text style and to
add an icon on the button.
Add the dependency "portal_chatter.xml" from portal rating on the portal
composer Widget. It already has the dependency "portal_chatter.xml"
from the simple portal module, but because the second file was not in
the dependency, the view was not inherited if we add the widget in a
fullscreen view.
Task 2322583