This commit fixes ACLs for slide resources:
* Access to resources should be blocked for non-members (except publishers
for the course: responsible and managers)
* Tests are included
NB: As links are resources from this minor version on, their access
is protected as for files.
Task-2818136
Part of Task-2663320
FwdPort of odoo/odoo#88454
X-original-commit: 075a647d58dc7e817b31a80c2ac804b06c8492bb
Part-of: odoo/odoo#92104
Purpose
=======
Change all masculine nouns in Odoo's code to neutral nouns (when
possible), making sure that demo data is correctly handled. This is
particularly important since our code is open source, and nowadays lots
of machine learning models are trained on open source repositories.
With this small change we contribute to training more "fair" models, and
teaching models that "employee" or "user" != "he".
This also affects some text visible by the user, hence making it more
inclusive for Odoo users.
Task-2853046
closesodoo/odoo#91292
Related: odoo/enterprise#27302
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
PURPOSE
Have user groups specific to eLearning to separate them from generic website
editors. Indeed this is a specific work area and require more than pure design
skills.
SPECIFICATIONS
Two user groups are added in this commit
* group_website_slides_officer
+ can read any course/slide
+ can create a course (will be responsible)
+ can write on its courses
+ can upload slides to the courses he is responsible
+ can publish slides to the courses he is responsible
- cannot unlink courses/slides (you should archive them)
* implies group_website_publisher in order to see the top navbar in
frontend with the publish toggle button and the new content button;
* group_website_slides_manager: has full rights
+ can read any course/slide;
+ can create a course;
+ can add slide to any courses;
+ can publish any courses/slides;
+ can unlink any courses/slides;
+ has access to reporting menu entries;
Rights for other groups are untouched for courses / slides. As a reminder
we still support responsibles being outside of eLearning groups, for example
if an employee is a teacher that handles a course:
* people in upload_group_ids of a channel can upload slides, even if they
don't belong to any eLearning group;
* people responsible of a course can upload and publish slides even if they
don't belong to any eLearning group (done through controller as they
don't have real rights on underlying models);
We choose to keep the survey rights separated from eLearning ones. Indeed
it is easy in odoo to update the imply_ids field of groups if necessary
to link survey / eLearning groups; default user template can also be updated
easily. Standard Odoo should therefore correctly separate those groups. The
only specific rights is that eLearning officers can read all surveys, allowing
to choose them for certification-based courses.
LINKS
Task ID 2062462
PR #39485
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This branch is the combination of several optimizations in the ORM:
* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;
* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;
* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);
* make method `modified` take advantage of inverse fields to inverse
dependencies;
* filter records by evaluating a domain on records in Python;
* a computed field with `readonly=False` behaves like a normal field
with an onchange method;
* computed fields are computed in superuser mode by default.
Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.
closesodoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
PURPOSE
Improve attendees management by adding a button to remove them in backend
of eLearning.
SPECIFCIATIONS
In order to easily remove a attendee from a channel, we add a button in
the slide_channel_partner tree view, accessible from channels (attendees).
Remove a slide_channel_partner implies to remove the related slide_slide_partner.
Also code backtracking for the view of attendees of a course: we redirect
to the slide.channel.partner model instead of res.parter because
we want the possibility to create/remove/edit attendees for a
course and not making action on res.partner model itself.
Task ID 2045620
PURPOSE
Like already done for sale order, invoice of survey, purpose of this commit
is to remove category model and replace by a flagged line (slide). It allows
to easily reorder slides in an embedded list view.
SPECIFICATIONS
Instead of having a fully fledged slide.category model, slide.slide will serve
that purpose with a is_category flag. This will allow to drag and drop slides
and sections in the channel form view.
This change had an impact on the way slides were added/sorted on the front-end.
In fact, whenever a slide is added from the front-end, a resequencing of all
the slides in the course has to be triggered.
Category of a slide is now a computed field based on the sequence. Order
of slides is based on sequence, with categories splitting the slide list based
on is_category flag.
In this commit tests are added. Some cleaning in tests is also performed to
speedup a bit tests (savepointcase) and some cleaning / renaming to ease
their understanding.
Future commit will add JS necessary to manage slides in the section list view.
LINKS
TaskID: 1978731
PR: #33255
The `website_published` field from the website's mixins is basically a readonly
from `is_published` field.
On read, this field will simply read `is_published` and check if the record's
website_id is accessible (only for the multi mixin).
On write, it will always write on `is_published`.
This commit improves a few things:
- A lot of code was writting on website_published which was just then writting
on is_published. Writting directly on is_published makes more sense.
- Some backend fields would still reference `website_published` instead of
`is_published` which would just go through the related for no reason.
Plus, using `is_published` will make the field tooltip more accurate as we
are not in a website context ('Visible on current website' to 'Is Published')
- Filter and search on tree view were still using the `website_published`
related field, which is just a readonly when we are not in a frontend
context.
- Some create and write function would have security check on
`website_published` value but that was wrong as the user could bypass that by
simply writting on `is_published`. For the write method, check `is_published`
is more accurate as it will cover both case since `website_published` will
then call the write method on `is_published`
Purpose is to ensure more advanced use cases are still supported in new
elearning platform in addition to more public use cases. Fields controlling
access are now
* enroll: who can enroll on course: public (everyone, simply click on join
button), invite (added by already members) and payment (in bridge with
website_sale, if SO with product is confirmed);
* enroll_group_ids: automatically add members of those groups to the channel
to ease having groups for a given subset of users;
* visibility: who can see a channel and its slides: public (everyone, it means
channel is visible on website for example), members (hidden for non members)
* website_published on channels and slides; non publishers cannot see what
is not published, whatever other parameters;
* upload_group_ids: who can upload on a channel;
* download_security on a slide is completely removed as it makes no sense
for most slide types;
To ensure a better user experience responsible of a channel is added in its
members. People uploading a slide are now also allowed to read it to avoid
having inconsistency behavior between upload_group_ids and access rules.
Some tests are added.
This commit is linked to task ID 1942836 and PR #31239.
Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
New rules are
* on channel type documentation: can upload like before (employee or upload
groups specified); can publish like before (can upload and publisher)
* on channel type training: can upload like before (employee or upload
groups specified); can publish restricted to channel responsible
Tests are added.
This commit is a sub-part of task ID 1902304 (main eLearning task).
closesodoo/odoo#31082
Purpose
=======
A slide's 'Embedded views' are reworked as 'Public views' to simplify
the model and be more compliant with the new 'is_preview' field.
The rule is now the following:
A slide is a preview or the view is done as public user (once per session)
-> increment public_views
A slide is viewed as a logged in user that has access to the content
-> increment slide_views
Technically slide_views is a compute of the slide_slide_partner count.
Tests are also added to ensure it is effectively working.
This commit is a sub-part of task ID 1940360 (eLearning integration with
survey) and task ID 1902304 (main eLearning task).
Purpose
=======
The 'state' field for a member of a channel did not imply anything functionally
so we decided to remove it. It allows to remove an unnecessary computed fields.
ACLs are updated accordingly.
If needed, we will soon be able to check partner_ids that have ordered but
not paid a channel / course product by searching the related 'sale.order' model
for such products.
Currently website_slides module lacks tests. This commit adds base for tests
and add some tests related to recently cleaned access rules and rights.
Future commits will gradually add more tests to the module as it evolves
towards a more broad and up-to-date application.
This commit is linked to task ID 1937411 and PR #30847.