Commit Graph
148754 Commits
Author SHA1 Message Date
Julien Mougenot 424e46bcfe [FIX] web: Force proper numbering system for server dates
Before this commit, the numbering system used by luxon to parse and
format dates was the one set by the current locale. This means that
any date sent to and received from the server would also be expected
to use the current locale and numbering system. The consequence of
this behavior is that any domain generated by arbitrary dates would
trigger a server error.

This commit forces the numbering system to 'latn' (browser default) for
dates used by the server.

closes odoo/odoo#85487

X-original-commit: c8ef1fcb2277993f90a8e237dbd415de7d1b88bc
Related: odoo/enterprise#24822
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-02-28 14:47:03 +00:00
Victor Feyens 2ac7e228f9 [IMP] portal: clean & document core controllers logic
closes odoo/odoo#84644

Related: odoo/enterprise#24379
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-28 14:46:56 +00:00
Victor Feyens 36d7f38e42 [IMP] portal,*: clean chatter setup
* Consistent use of _get_page_view_values
* specify object rendering value as well in the method
* docstring improvements

Part-of: odoo/odoo#84644
2022-02-28 14:46:56 +00:00
Victor Feyens 213e0ba734 [IMP] sale: clean sale order portal page rendering
* Remove old unused parameters
* Move `backend_url` logic from qweb to python
* add comments, clean and simplify some code/logic related to portal
page of sale orders

Part-of: odoo/odoo#84644
2022-02-28 14:46:56 +00:00
Victor Feyens 248e9d8d67 [IMP] sale: factorize shared portal code
Part-of: odoo/odoo#84644
2022-02-28 14:46:55 +00:00
Victor Feyens a414a0908d [IMP] sale: portal improvements
* Rename decline route to make sure there won't be any conflict with 
another controller method

* Use new translation API (pass string format params to the translation 
method)

* always pass token param to _message_post_helper, it should correctly 
manage any falsy value as parameter

* code cleanup

Part-of: odoo/odoo#84644
2022-02-28 14:46:55 +00:00
Abdelouahab (abla) a0af92fee3 [FIX] hr: Fix timezone issue on last_activity_time computation
Purpose
=======

for example: in Europe/Brussels timezone, the presence
hour of an employee using this timezone is up with one hour.

The issue is that we give a localized time to format_time pretending
it's not (removing the tzinfo), so it's converted twice.

Specification
=============
To solve the issue, just give the time in UTC to format_time.

opw-2741634

closes odoo/odoo#85510

X-original-commit: 8953eb2e387bd046c586e815c10c1e30b00db13d
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-28 13:53:39 +00:00
Touati Djamel (otd) a1945fea71 [FIX] mrp: assign backorders according to the reservation method
Steps to reproduce the bug:
- Go to inventory > configuration > Operation types > Manufacturing
- Set "Reservation Method" to "Manually”
- Create a storable product “A”:
    - Update on-hand quantity to 10
- Create a storable product “B”:
    - Create a bill of materials and add the product B as component
- Create and confirm a MO with 2 * product B
- Product A is not reserved for this MO (works as expected)
- Validate the production of 1 unit and create a backorder

Problem:
product A is reserved for the backorder because there is no verification of the reservation method before assigning it.

Solution:
No need to assign here, because when an MO is confirmed, move_raw/move_finished are confirmed too: https://github.com/odoo/odoo/blob/89ddaa49b901787f58a3fa9efb4115d5f2038611/addons/mrp/models/mrp_production.py#L1172

And when a stock_move is confirmed, it is assigned or not by checking the reservation_method:
https://github.com/odoo/odoo/blob/dda9700d8236091626cbd78efc0ca4116e1e1acd/addons/stock/models/stock_move.py#L1239-L1245

opw-2744513

closes odoo/odoo#85508

X-original-commit: 5926bb178236a74999a7868f0acf4ee86b61d7b8
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-02-28 13:53:36 +00:00
Thibault Libioulle 1d85cabb50 [FIX] product,website_sale: fix contextual price on eCommerce
Prior to this commit the price in the product dynamic filter was not
correctly computed since the pricelist was not available in the context.

This commit provides a fallback on request website pricelist in order to
display a non-zero price if it exists.

task-2765828

closes odoo/odoo#85507

X-original-commit: 88bfd8a60cefac45e73cd032204c9b90a862ee6c
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-28 13:53:32 +00:00
Victor Feyens c9ab9e0a43 [REV] sale: keep show_update_pricelist logic in onchange
Recently, onchanges have been converted to computed fields
in sale scope (See #79093).

But we noticed the conversion of the logic allowing users to update
the prices of existing lines if the pricelist was modified didn't behave
correctly as a precomputed computed field.

This commit reverts this change and brings back the behavior of
show_update_pricelist as a field update through onchange.

Fixes two problem:
* Show_update_pricelist value on new sales orders was not saved
* SO created programmatically (not through the interface) always
had show_update_pricelist set as True, even if the pricelist wasn't
modified.
This meant that orders created by a connector (ebay, amazon, ...) showed
the "Update Prices" button even when it made no sence because the prices
were specified by the connector.

closes odoo/odoo#85506

X-original-commit: 99313bcff9f99215fda176f3e92516b1da16e579
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-02-28 13:53:28 +00:00
Victor Feyens 4f7d833cf0 [FIX] core: http documentation
* http.py:docstring of odoo.http.route:19: WARNING: Unexpected
indentation.
* http.py:docstring of odoo.http.route:20: WARNING: Block quote ends
without a blank line; unexpected unindent.
* http.py:docstring of odoo.http.route:30: WARNING: undefined label:
csrf
-> No section in the doc exists with reference csrf

* Add docstring for the default_lang method.

closes odoo/odoo#85505

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-02-28 13:53:24 +00:00
Romain Derie 826c0a9119 [IMP] website: fetch all pages and views at once
When serving a page, fetch the requested page and the menu's pages in
one go.

This will only impact pages that do not have a menu entry, which is the
most common form of pages.

So, instead of:
- read page
- read page's view
and later:
- read menu pages
- read menu pages' views

Fetch everything together:
- read served page + menu pages
- read served page's menu + menu pages' views

task-2774979

closes odoo/odoo#85456

X-original-commit: 16bf7cca8e8d452ce9131d9d86ff5b23789da4e1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-28 13:53:20 +00:00
Romain Derie a61ba018a7 [IMP] website: avoid query on website table when serving empty page
Getting the `res.company` record by browsing the `company_id` cached
value from `website` instead of reading it directly on the website
record will avoid a read on the website table.

While this might seems unusual and not elegant, since this is a very
low level method used to render every view, it seems fine.

task-2774979

X-original-commit: bc643a573a7339c82661cbcff2cc59bdd0eec3e3
Part-of: odoo/odoo#85456
2022-02-28 13:53:19 +00:00
Romain Derie 28b9a6490c [IMP] website: don't query website table when serving homepage
We can easily avoid a read on the website table when serving the
homepage by simply caching the website.homepage_id value and then
browsing the record (no query needed) instead of reading it on the
website record.

While this code is not really elegant, it seems like a good tradeoff to
gain a query on this particular homepage serve controller, which is the
main entry point of a website and generally the page the more often
served.

task-2774979

X-original-commit: 69b443b85656c895c66a1f83b235f5d1e53727d4
Part-of: odoo/odoo#85456
2022-02-28 13:53:19 +00:00
Romain Derie 3e2d30fdbd [IMP] models.py, *: don't read ir_translation table if empty source
* website, website_blog (perf)

If the source values is only composed of empty elements (list of `None`
values), don't try to translate it, as there is nothing to translate
anyway.

While the translation method being called (xml_translate,
html_translate) won't be costly as they will return instantly if the
provided value is falsy, there is still an SQL Query made to get the
callable translation method, which we won't actually use.

This commit avoids that query if we already know we won't do anything
with the translation method.

task-2774979

X-original-commit: e1eb5a6e1610a9550a59ba229a83b9e70e10aa88
Part-of: odoo/odoo#85456
2022-02-28 13:53:18 +00:00
Julien Castiaux 8639f9b257 [FIX] website: restore debug mode in website pages
Install website, create a custom web page, we'll call it page_1. Ensure
you are not in debug mode (go to /web/health?debug=0 to disable it).
Open the web page enabling the debug-mode /page_1?debug=1, the page
opens but the debug mode is disabled.

Because web pages are served using another routing mechanism than
controlers we have to ensure we load the debug query-string in those
mechanisms too.

closes odoo/odoo#85340

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-28 13:53:09 +00:00
Romain Derie b0285d0e88 [IMP] website, test_website: add tests for broken flows in httpocalypse
Some flows were broken in httpocalypse, sadly those were not tested.

X-original-commit: 6161987c94544162de16eb2544295d152f123d17
Part-of: odoo/odoo#85340
2022-02-28 13:53:08 +00:00
Julien Castiaux 2e9c6f22d5 [FIX] website: nonexisting record id in URL =>404
Install the website_sale and open '/shop/whatever-9999' in your browser,
the response is a 500 Internal Error instead of a 404 Page not Found.

Because `request.endpoint` has been murdered by the httpocalypse, we
must re-match to get the endpoint later used to re-build the URL. When
an URL contains a record-id but that record does not exists, matching
the URL will raise a `odoo.exceptions.MissingError`.

Part-of: odoo/odoo#85340
2022-02-28 13:53:08 +00:00
Victor Feyens 740a507de6 [REF] *sale*: clean inheritance/setup of sale report
* remove unused delay column (there was no field using the value server
side)
* remove unused joins in the FROM part of the table definition (join on
pricelists)
* fix broken inheritance API

pos_sale inheritance adds a null value for fields not available added in
sub modules (website, invoice_status, ...).  But this was only working
because the default value of the fields parameter of the _query method
was overridden to a dict in all overrides, filling the record while
climbing the inheritance chain.
This was clearly too magic, using information provided higher in the
inheritance chain, assuming you were calling the super before generating
the pos part of the query.

This commit cleans the methods and API of the model, providing clean
hooks and reducing the mess of values given in overrides of _query.

closes odoo/odoo#85125

Related: odoo/enterprise#24626
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-28 13:52:57 +00:00
Victor Feyens a7f15cb590 [FIX] sale: do not allow creation/update of sale report records
Part-of: odoo/odoo#85125
2022-02-28 13:52:56 +00:00
Jacky (trj) 0e7fdbe06c [REF] point_of_sale, *pos*: renaming cashier, partner and customer
Multiple refactors
- The module pos_hr had two attributes `cashier` and `employee` referencing to the same actual person. The `employee` attribute was removed for the sake of `cashier`.
- Refactor of the `useSelectEmployee` which returned functions that where used in two components. Instead, a mixin class was implemented and inherited from both components.
- Renaming of the substring `client` and `customer` to `partner` (css included) when it was referencing to the actual `res.partner` object. This way, developers will always know that the object used in the UI is coming from `res.partner`.
- Renaming of the substring `client` to `customer`(css included) when it was referencing to a real life person. This avoid having ambiguity since the term `client` can refers to multiple things (hardware, browser, person, ...)

closes odoo/odoo#83983

Related: odoo/enterprise#24477
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-02-28 13:52:51 +00:00
Vincent Larcin d161d28782 [IMP] sale_timesheet: link milestones to SOLs
Currently, a service can be configured to be invoiced on milestones.
This means that the user has to manually update the delivered quantity on the SO in order to invoice it.

We now also have the notion of milestones in the project module.
It would be nice to have a link in between the milestone and the corresponding SOL, so that the delivered quantity is automatically updated when the milestone is reached.
This would help the users save time, limit the risk of error and reduce the confusion of having unrelated milestones at two different places.

To this end, this commit adds a new "milestones" invoice policy that computes the delivered quantity of a SOL based on the milestones that have been reached, and renames the previous "milestones" policy into "manual".

Task-2558889

Closes https://github.com/odoo/odoo/pull/81684

closes odoo/odoo#81684

Related: odoo/upgrade#3265
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-28 13:52:41 +00:00
Vincent Larcin 8c07249ffa [MOV] sale_timesheet: move project, product.template fields to sale_project
The `product.template` service policies that do not involve timesheets should be available with `sale_project` and without `sale_timesheet`.
This commit adds the `service_policy` field and moves those policies to `sale_project`.

It also moves the `allow_billable` field on project.project to `sale_project`.

Task-2558889

Closes https://github.com/odoo/odoo/pull/81684

Part-of: odoo/odoo#81684
2022-02-28 13:52:41 +00:00
Antoine Vandevenne (anv) cd57330eb8 [IMP] payment_stripe: improve proxy requests' error handling
- Log the traceback when a proxy request raises an exception.
- Don't log the traceback returned by the proxy when an exception is
  raised on IAP.

closes odoo/odoo#85503

X-original-commit: 529608eb12082463648ded5b46e40d8ce03aab53
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-28 12:56:13 +00:00
roen-odoo f0c27d0556 [FIX] sale: All salespersons appearing in sale order
Current behavior:
In a multicompany environement when you create a sale order and go into other info tab
you could see all the salesperson in the Saleperson field even if they were not part of the selected company.

Steps to reproduce:
-Get in a multicompany environement
-Create a saleorder
-Go in other info tab

opw-2714085

closes odoo/odoo#85498

X-original-commit: 07ef7cc0a35313f98336f6b1d28fc9424c937c33
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-02-28 12:56:09 +00:00
qsm-odoo 1ab7210ae3 [REF] web_editor, website: review the web_editor.assets model
- Three controllers were actually useless as the relevant public methods
  of the web_editor.assets can be called directly via RPC in the related
  usecases.

- Review the web_editor.assets model methods organization in the model
  declaration.

closes odoo/odoo#85392

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-28 12:56:05 +00:00
qsm-odoo aec6925b17 [MOV] web_editor: move web_editor.assets main methods at the top
Part-of: odoo/odoo#85392
2022-02-28 12:56:04 +00:00
pedrambiria 2a13a4088b [FIX] microsoft_calendar: add 'none' state to attendee state convertor
Before this commit, the 'none' state was not considered as a possible
attendee state for the microsoft, and it created an empty field in
Odoo.

This commit maps the 'none' state to the 'needsAction', based on the
microsoft documentation.

opw-2694644

closes odoo/odoo#85367

X-original-commit: 1fbd14728980bfabc466efeb437f9f7ce105dfac
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-28 12:55:59 +00:00
Adrien Minet cf8cc3b47f [FIX] base: sum of company-dependent fields in partner merge wizard
How to reproduce the bug:

- Install POS and data_cleaning
- Create 2 customers and set loyalty points
- Select both customers and merge them
- Once the merge is done, the loyalty points have not been summed

Bug:

When you merge 2 contacts that have both loyalty points, the resulting
contact won't have the sum of the 2 source contacts. Instead of that,
the resulting contact will only have the points of one of of the
contact.

closes odoo/odoo#84739

Opw: 2686208
X-original-commit: 56efd70e5c0e10302990d14730d801d3720f630e
Related: odoo/enterprise#24445
Signed-off-by: Simon Goffin <sig@odoo.com>
Signed-off-by: Minet Adrien (admi) <admi@odoo.com>
2022-02-28 12:55:52 +00:00
Horacio Tellez bc9536ebe9 [IMP] payment_*: set password widget on sensible fields
When setting up an acquirer there is sensible information to
be supplied.
There was inconsistency on what was obfuscated and what not.
Now sensible information as passwords and keys is obfuscated
and public information as names and addresses is visible.

Task - 2694139

closes odoo/odoo#81211

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-28 12:55:47 +00:00
Florian Damhaut 9e5588581d [FIX]hr_holidays: leave request traceback in arabic
Step to reproduce:
- Switch language to arabic
- Go to Time off
- Click on 'New TIme Off'

Current behaviour:
- Traceback
Default date_from and date_to are given in arabic which cannot be parsed by the field

Behaviour after PR:
- Default date_from and date_to are given in english and then translated via the field

opw-2755258

closes odoo/odoo#85495

X-original-commit: f0c457607521bc6a8b8a682bd4851029e63249b8
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-02-28 12:01:56 +00:00
Jinjiu Liu bef898e1ea [FIX] event_sale: Added a domain condition on attendee_count in SO
Reproduction:
1. Start the process to buy (register) 2 tickets for an event
2. Go back to “review order” and reduce the quantity to 1
3. Sign up with a new portal user and create an account
4. Change the number of tickets to 2

Reason: the seats_expected in event.event has a different computation
logic from the attendee_count in sale.order. In event.event, the
seats_expected does not count canceled registrations. In sale.order, the
attendee_count counts the canceled registrations. But they are both
shown as "Attendees" in the statinfo widget of form views

Fix: Added a domain condition to filter out canceled registrations when
computing attendee_count in SO

opw-2739310

closes odoo/odoo#85491

X-original-commit: 88fecdc4966dfba2a3f65bc2a8f139e7ee025d15
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-02-28 12:01:52 +00:00
Horacio Tellez 3db051e7f5 [FIX] payment: link tokens to refund transactions
Whenever making a refund for a transaction with a saved token
the token will appear also on the refund transaction.
It is useful to keep track of which token was used in each
transaction, this remains true for refunds.
The token will also appear on the payments.

Task - 2694760

closes odoo/odoo#85484

X-original-commit: 351812a81ec29fe96bf3766c45ea3b51f4055066
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-28 12:01:48 +00:00
Thomas Beckers 6168590525 [FIX] point_of_sale: generate tax line for 0% tax
The generic tax report in V15 need the tax line for each tax to be computed correctly.
Currently the tax line for 0% tax will not be generated for a journal entry generated
from the point of sale and will not be taken into account in the tax report.

Now we will generate this tax line. This is basically a reverse of 0ddfbab90f
removing generation of 0% tax line because it could cause issue if no account is set on
the tax. This case is now handeld by 4f7061dcb402ed56d56c51de35edf747d0684a8d.

opw-2754107

closes odoo/odoo#85454

X-original-commit: 1e846844348107d5d0d1e46b5911b883bd088b4e
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-02-28 11:08:07 +00:00
Kevin Baptiste f9252de355 [IMP] hr_contract: add CSS class on notebook page
Adds a class on the notebook page in order to create a JS tour for
`hr_payroll`.

closes odoo/odoo#85471

Taskid: 2661217
Related: odoo/enterprise#21559
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-02-28 11:07:45 +00:00
Odoo's Mergebot 86f387b603 [MERGE] website_slides: improve lesson / slide display and usage
PURPOSE

Improve documentation design in eLearning frontend. Fix and improve
publisher tour(s).
Prepare attendees status improvements.

SPECIFICATIONS: LAYOUT

Currently, in the documentation type of courses, card layout for the lessons
is broken because there isn't enough space to display everything.

To fix this, this commit moves the 'Completed' badge (which is in the card
footer) and other tags at the end of the card-body. It formats likes and
dislikes using a decimalized formatting (ex, 10000 will be displayed
as 10k).

But that improvement leads to another trouble. Say there are '1k' likes and
user upvotes the lesson. There is no indication whether or not the vote was
recorded. To fix this, we will now use different icons based on the user vote

  - The thumbs-up icon will be filled if user has liked the lesson and it will
    be hollow otherwise;
  - Likewise, the thumbs-down icon will be filled if user has disliked the
    lesson, and it will be hollow otherwise;

Clicking on either of the button, if the vote is recorded successfully, icon
and user vote will be toggled for better indication. Note that before this
commit, if user was performing the same action (for example upvoting again)
a warning popover used to appear, which isn't the case anymore because now
the vote will simply be toggled. The mechanism is somewhat similar to youtube
(you can also directly dislike the already liked content and visa-versa).

The same mechanism is also applied for likes/dislikes in the footer of each
lesson's page. And, on the same page under 'Statistics' tab, they are simply
formatted like everywhere else.

Apart from that, this commit makes other small UI changes listed
as below:

  - We now display three slides per category instead of four, giving the
    cards a bit more space;
  - On the lessons' page, we move the likes/dislikes right after description
    which previously was at bottom right of the page;
  - Likes / Rating is now always displayed the same in lessen view whatever
    the channel type (displaying ratings / comments / likes);

SPECIFICATIONS: CONSTRAINTS

Before completion could hold about any value, even if it is generally correctly
computed as a percentage. To be sure we don't have incoherent values in db
a constraint is added to ensure completion is contained between 0 and 100.

Before, a partner could be present several times in the list of attendees
(slide_channel_partner model). To avoid noise and confusion, a sql constraint
is added to the model to make the couple (partner, channel) unique in db.

If several exist, we only keep the most advanced one in terms of
completion (see UPG script).

Same move is done for slide activity tracking (slide_slide_partner model).
Certification or completion is considered as more advanced.

Demo data is updated as we try to create a membership that already exists
due to auto subscription of channel responsible. We also make some channel
memberships explicit as some demo data about slide completion exists.

SPECIFICATIONS: SLIDE ATTENDEE VIEWS

Purpose of this spec is to have access to slide.slide.partner model that
holds member progress on specific slide. It is used notably to build completion
on slide.channel.partner or to store vote data. It is interesting to have
access to it to have some detailed informations.

It is now reachable through the "attendees" smart button that replaces the
'views' button. Public / other views are moved in slide details as those
buttons do not add much to the slide usability.

SPECIFICATIONS: OTHER

Fix publisher tour and add a standard tour (not using video / youtube to be
reproducible). Provide various fixes and improvements.

LINKS

Task-2777216
Prepares Task-2508019 (Slides membership refactoring)

closes odoo/odoo#74171

Related: odoo/upgrade#2854
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-02-28 12:07:42 +01:00
Thibault Delavallée 1af6dfe47b [IMP] website_slides: add a standard publisher tour
Purpose of this commit is to add a publisher tour in standard that is not
only run using external tags. Indeed external tours are not monitored and
previous commits show that they can be broken since a long time.

In this commit we somehow copy the publisher tour with an article-based
slide instead of a video slide. That way it can be launched with other
standard tours.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:41 +00:00
Thibault Delavallée 7a5e81f9e1 [FIX] website_slides: fix publisher tour
Not sure how it was working before anyway.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:41 +00:00
Thibault Delavallée 3ccd903b5f [FIX] website_slides: fix tour using image selector
Since "I don't know" image selection tour is broken as the current image
selector is quite different from the time this tour was run. Update it to
use an external URL as it seems we don't have any default image anymore.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:40 +00:00
Thibault Delavallée fb83d30290 [FIX] website_slides: fix tour with video URLs
Followup of odoo/odoo@7b5427f6d6 where a frontend form was updated but
not the tour using it.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:40 +00:00
Thibault Delavallée 7cc7800e78 [FIX] website_slides: fix new content used in tour
Followup of odoo/odoo@60fadfeaf6 where navbar was updated to be responsive.
However that broke eLearning tours. Youpie.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:40 +00:00
Thibault Delavallée c1ab7ae88a [FIX] website_slides: fix youtube video usage
Linked video is not reachable anymore on youtube. Let us replace it by
another great video.

Task-2780920 (eLearning: fix publisher tour)

Part-of: odoo/odoo#74171
2022-02-28 11:07:40 +00:00
Munaf KhanandThibault Delavallée fa7451544d [IMP] website_slides: improve lesson design in documentation
Currently, in the documentation type of courses, card layout for the lessons
is broken because there isn't enough space to display everything.

To fix this, this commit moves the 'Completed' badge (which is in the card
footer) and other tags at the end of the card-body. It formats likes and
dislikes using a decimalized formatting (ex, 10000 will be displayed
as 10k).

But that improvement leads to another trouble. Say there are '1k' likes and
user upvotes the lesson. There is no indication whether or not the vote was
recorded. To fix this, we will now use different icons based on the user vote

  - The thumbs-up icon will be filled if user has liked the lesson and it will
    be hollow otherwise;
  - Likewise, the thumbs-down icon will be filled if user has disliked the
    lesson, and it will be hollow otherwise;

Clicking on either of the button, if the vote is recorded successfully, icon
and user vote will be toggled for better indication. Note that before this
commit, if user was performing the same action (for example upvoting again)
a warning popover used to appear, which isn't the case anymore because now
the vote will simply be toggled. The mechanism is somewhat similar to youtube
(you can also directly dislike the already liked content and visa-versa).

The same mechanism is also applied for likes/dislikes in the footer of each
lesson's page. And, on the same page under 'Statistics' tab, they are simply
formatted like everywhere else.

Apart from that, this commit makes other small UI changes listed
as below:

  - We now display three slides per category instead of four, giving the
    cards a bit more space;
  - On the lessons' page, we move the likes/dislikes right after description
    which previously was at bottom right of the page;
  - Likes / Rating is now always displayed the same in lessen view whatever
    the channel type (displaying ratings / comments / likes);

Also see odoo/upgrade#2854

Task-2607416

Part-of: odoo/odoo#74171
Co-authored-by: Munaf Bahelim <mub@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2022-02-28 11:07:39 +00:00
Thibault Delavallée e50bc749f6 [IMP] base: support decimalized in integer qweb formatting
Purpose of this commit is to allow decimalized formatting of numbers when
rendering integer fields in qweb. This is done through an option and will
be used notably in elearning.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:39 +00:00
Thibault Delavallée 2a3d8dd1c2 [MOV] various: move ir.qweb.fields code into right files
When working on qweb fields it is difficult to find some custom override as
they are never in the right file. Finding them is always a bit of random pick.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:39 +00:00
Thibault Delavallée 924ca810ef [IMP] website_slides: add views and access for slide progress
Purpose of this commit is to have access to slide.slide.partner model that
holds member progress on specific slide. It is used notably to build completion
on slide.channel.partner or to store vote data. It is interesting to have
access to it to have some detailed informations.

It is now reachable through the "attendees" smart button that replaces the
'views' button. Public / other views are moved in slide details as those
buttons do not add much to the slide usability.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:38 +00:00
Noé Antoine ffa2ed0e75 [IMP] website_slides: add constraint completion to be a percentage
Before completion could hold about any value, even if it is generally correctly
computed as a percentage. To be sure we don't have incoherent values in db
a constraint is added to ensure completion is contained between 0 and 100.

--- Links ---

Task-2777216
Prepares Task-2508019 (Slides membership refactoring)

Also see UPG PR - odoo/upgrade#2854

Part-of: odoo/odoo#74171
2022-02-28 11:07:38 +00:00
Noe Antoine 57be5167a9 [IMP] website_slides: add constraints to make membership unique
Before, a partner could be present several times in the list of attendees
(slide_channel_partner model). To avoid noise and confusion, a sql constraint
is added to the model to make the couple (partner, channel) unique in db.

If several exist, we only keep the most advanced one in terms of
completion (see UPG script).

Same move is done for slide activity tracking (slide_slide_partner model).
Certification or completion is considered as more advanced.

Demo data is updated as we try to create a membership that already exists
due to auto subscription of channel responsible. We also make some channel
memberships explicit as some demo data about slide completion exists.

--- Links ---

Task-2777216
Prepares Task-2508019 (Slides membership refactoring)

Also soo UPG PR - odoo/upgrade#2854

Part-of: odoo/odoo#74171
2022-02-28 11:07:38 +00:00
Thibault Delavallée 1bcd34ea6b [REF] website_slides: cleanup membership fields
Purpose of this commit is to finalize the cleanup of current user's membership
on a given slide.

As a followup of odoo/odoo@8b2f887c29 we remove now dead ``_compute_user_info``
method. We also introduce a shortcut to ``user_membership_id.sudo().completed``
by adding its computation directly while computing user_membership_id as well
as user_vote. It allows to remove some sudo on user_membership_id.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:37 +00:00
Thibault Delavallée c0d56da9b0 [IMP] website_slides: quickly lint tests
Purpose is to make a quick reordering / linting of tests while passing by.

Task-2607416

Part-of: odoo/odoo#74171
2022-02-28 11:07:37 +00:00