Files
odoo_source/addons/website_slides/security/website_slides_security.xml
T
qmo-odoo b180c66a80 [REF] website_slides: replace slide.category by slide with is_category flag
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
2019-08-08 08:29:34 +00:00

52 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<!-- CHANNEL -->
<record id="rule_slide_channel_global" model="ir.rule">
<field name="name">Channel: always visible (sub rules exist)</field>
<field name="model_id" ref="model_slide_channel"/>
<field name="global" eval="True"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<record id="rule_slide_channel_not_website" model="ir.rule">
<field name="name">Channel: public/portal/user: restricted to published and visible or member only</field>
<field name="model_id" ref="model_slide_channel"/>
<field name="groups" eval="[(4, ref('base.group_public')), (4, ref('base.group_portal')), (4, ref('base.group_user'))]"/>
<field name="domain_force">['&amp;', ('website_published', '=', True), '|', ('visibility', '=', 'public'), ('partner_ids', '=', user.partner_id.id)]</field>
</record>
<record id="rule_slide_channel_website" model="ir.rule">
<field name="name">Channel: website group: access all</field>
<field name="model_id" ref="model_slide_channel"/>
<field name="groups" eval="[(4, ref('website.group_website_publisher'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<!-- SLIDE -->
<record id="rule_slide_slide_global" model="ir.rule">
<field name="name">Slide: always visible (sub rules exist)</field>
<field name="model_id" ref="model_slide_slide"/>
<field name="global" eval="True"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<record id="rule_slide_slide_not_website" model="ir.rule">
<field name="name">Slide: public/portal/user: restricted to published or uploaded by user, and either channel member or public channel &amp; (category or previewable)</field>
<field name="model_id" ref="model_slide_slide"/>
<field name="groups" eval="[(4, ref('base.group_public')), (4, ref('base.group_portal')), (4, ref('base.group_user'))]"/>
<field name="domain_force">['&amp;',
'|',
'&amp;', ('channel_id.visibility', '=', 'public'), '|', ('is_category','=', True), ('is_preview', '=', True),
('channel_id.partner_ids', '=', user.partner_id.id),
'&amp;', ('channel_id.website_published', '=', True), '|', ('user_id', '=', user.id), ('website_published', '=', True)]</field>
</record>
<record id="rule_slide_slide_website" model="ir.rule">
<field name="name">Slide: website group: access all</field>
<field name="model_id" ref="model_slide_slide"/>
<field name="groups" eval="[(4, ref('website.group_website_publisher'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
</data>
</odoo>