Files
odoo_source/addons/website_slides/views/slide_slide_views.xml
T
Thibault DelavalléeandAurélien Warnon 18f917fe3b [REF] website_slides: improve and make access options clearer
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>
2019-02-19 16:52:07 +00:00

223 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- SLIDE.TAG -->
<record id="view_slide_tag_form" model="ir.ui.view">
<field name="name">slide.tag.form</field>
<field name="model">slide.tag</field>
<field name="arch" type="xml">
<form string="Tag">
<field name="name"/>
</form>
</field>
</record>
<record id="view_slide_tag_tree" model="ir.ui.view">
<field name="name">slide.tag.tree</field>
<field name="model">slide.tag</field>
<field name="arch" type="xml">
<tree string="Tags">
<field name="name"/>
</tree>
</field>
</record>
<record id="action_slide_tag" model="ir.actions.act_window">
<field name="name">Tags</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">slide.tag</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- SLIDE.SLIDE -->
<record id="view_slide_slide_form" model="ir.ui.view">
<field name="name">slide.slide.form</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<form string="Slide">
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe">
<field name="is_published" widget="website_button"/>
</button>
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
</button>
</div>
<field name="image" widget="image" class="oe_avatar" options='{"preview_image": "image_large"}'
attrs="{'readonly': [('slide_type', 'in', ('document', 'presentation', 'video'))]}"
/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" string="Name"/>
</div>
<h1>
<field name="name" default_focus="1" placeholder="Name"/>
</h1>
<field name="tag_ids" widget="many2many_tags" placeholder="Tags..."/>
</div>
<group>
<field name="user_id"/>
<field name="channel_id"/>
<field name="category_id" context="{'default_channel_id': channel_id}"/>
<field name="website_id" groups="website.group_multi_website"/>
<field name="website_url"/>
</group>
<notebook>
<page string="Description">
<field name="description"/>
</page>
<page string="Document">
<group>
<field name="slide_type" readonly="1"/>
<field name="url"
attrs="{'required': [('slide_type', 'in', ('video'))], 'readonly': [('slide_type', 'in', ('document', 'video'))], 'invisible': [('slide_type', 'not in', ('document', 'presentation', 'video'))]}" />
<field name="document_id" readonly="1" attrs="{'invisible': [('document_id', '=', False)]}"/>
<field name="mime_type" readonly="1"
attrs="{'invisible': [('slide_type', 'not in', ('document', 'presentation', 'infographic', 'webpage'))]}"/>
<field name="datas" readonly="1"
attrs="{'invisible': [('slide_type', 'not in', ('document', 'presentation', 'infographic', 'webpage'))]}"/>
</group>
</page>
<page string="Website">
<group>
<group>
<field name="is_preview"/>
<field name="date_published"/>
<field name="likes"/>
<field name="dislikes"/>
</group>
<group>
<field name="slide_views"/>
<field name="public_views"/>
<field name="total_views"/>
</group>
</group>
<label for="index_content"/>
<field name="index_content"/>
</page>
<page string="External Links">
<group>
<field name="link_ids" widget="one2many" nolabel="1">
<tree editable="top">
<field name="name"/>
<field name="link" widget="url"/>
</tree>
</field>
</group>
</page>
<page string="Quiz">
<group name="container_row_2">
<group string="Earnings">
<group>
<field name="quiz_first_attempt_reward"/>
<field name="quiz_second_attempt_reward"/>
<field name="quiz_third_attempt_reward"/>
<field name="quiz_fourth_attempt_reward"/>
</group>
</group>
<group string="Questions">
<field name="question_ids" nolabel="1">
<tree>
<field name="sequence" widget="handle"/>
<field name="question"/>
</tree>
</field>
</group>
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="view_slide_question_form" model="ir.ui.view">
<field name="name">slide.question.form</field>
<field name="model">slide.question</field>
<field name="arch" type="xml">
<form string="Slide">
<sheet>
<div class="oe_edit_only">
<label for="question" string="Question Name"/>
</div>
<h1>
<field name="question" default_focus="1" placeholder="Name"/>
</h1>
<field name="answer_ids">
<tree editable="bottom" create="true" delete="true">
<field name="text_value"/>
<field name="is_correct"/>
</tree>
</field>
</sheet>
</form>
</field>
</record>
<record id="view_slide_slide_tree" model="ir.ui.view">
<field name="name">slide.slide.tree</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<tree string="Slides">
<field name="name"/>
<field name="website_id" groups="website.group_multi_website"/>
<field name="active" invisible="1"/>
<field name="slide_type"/>
<field name="channel_id"/>
<field name="category_id"/>
<field name="date_published"/>
</tree>
</field>
</record>
<record id="view_slide_slide_search" model="ir.ui.view">
<field name="name">slide.slide.filter</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<search string="Search Slides">
<field name="name"/>
<filter name="published" string="Published" domain="[('website_published', '=', True)]"/>
<filter name="not_published" string="Waiting for validation" domain="[('website_published', '=', False)]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group expand="0" string="Group By">
<filter string="Channel" name="channel" domain="[]" context="{'group_by': 'channel_id'}"/>
<filter string="Category" name="category" domain="[]" context="{'group_by': 'category_id'}"/>
<filter string="Type" name="type" domain="[]" context="{'group_by': 'slide_type'}"/>
</group>
</search>
</field>
</record>
<record id="view_slide_slide_graph" model="ir.ui.view">
<field name="name">slide.slide.graph</field>
<field name="model">slide.slide</field>
<field name="arch" type="xml">
<graph string="Graph of Slides">
<field name="date_published" interval="month" type="col"/>
<field name="channel_id" type="row"/>
</graph>
</field>
</record>
<record id="action_slides_slides" model="ir.actions.act_window">
<field name="name">Slides</field>
<field name="res_model">slide.slide</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_channel': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Add a new slide
</p>
</field>
</record>
</data>
</odoo>