This revision is to make uniform the behavior of the `groups` attribute on the Python model fields and on the node in the view architecture. In both cases, remove the node from the view completely. Before this revision, in a back-end view: - In the Python model, if a field has the `groups` attribute set and the user is not part of the groups, the field is removed, completely, from the view. - In the view architecture, if a node has the `groups` attribute set and the user is not part of the groups, the node is made invisible (not completely removed, just made invisible). in a front-end view: - if a node has a "groups" or "t-groups" set and the user is not part of the groups, the node is removed from the view. So it's 2/3 cases removing nodes restricted to a group. and 1/3 case making invisible nodes restricted to a group. It's simpler to have a uniform behavior for the 3 cases, simpler to understandard for developers. In addition, this will help for the goal to cache back-end views. It makes possible to convert views using the `groups_id` field by moving the content of these views directly in the view to which they add content which is suppose to be completely removed when the user has not the according group. By getting rid of the `groups_id` many2many field on `ir.ui.view`, it makes possible to cache the view architecture without requiring to use the groups in the cache key. Currently, if we want to cache the view architecture, it would be required to use the intersection of the user groups with the `groups_id` groups of the view, making it costly to compute the cache key, therefore altering the performance point to cache the view architectures. closes odoo/odoo#95729 Related: odoo/enterprise#29592 Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
244 lines
14 KiB
XML
244 lines
14 KiB
XML
<?xml version="1.0"?>
|
|
<odoo>
|
|
<record id="mail_activity_type_view_form" model="ir.ui.view">
|
|
<field name="name">mail.activity.type.view.form</field>
|
|
<field name="model">mail.activity.type</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Activities">
|
|
<sheet>
|
|
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
|
<div class="oe_title">
|
|
<label for="name" class="oe_edit_only"/>
|
|
<h1><field name="name" placeholder="e.g. Schedule a meeting"/></h1>
|
|
</div>
|
|
<group>
|
|
<group name="activity_details" string="Activity Settings">
|
|
<field name="active" invisible="1"/>
|
|
<field name="category"/>
|
|
<field name="default_user_id" options="{'no_create': True}" domain="[('share', '=', False)]"/>
|
|
<field name="res_model" groups="base.group_no_one"/>
|
|
<field name="res_model" invisible="1"/>
|
|
<field name="res_model_change" invisible="1"/>
|
|
<field name="initial_res_model" invisible="1"/>
|
|
<field name="summary" placeholder="e.g. "Discuss proposal""/>
|
|
<field name="icon" groups="base.group_no_one"/>
|
|
<field name="decoration_type" groups="base.group_no_one"/>
|
|
</group>
|
|
<group name="activity_planning" string="Next Activity">
|
|
<field name="chaining_type" attrs="{'invisible': [('category', '=', 'upload_file')]}"/>
|
|
<field name="triggered_next_type_id" options="{'no_open': True}" context="{'default_res_model': res_model}"
|
|
attrs="{'required': ['&', ('chaining_type', '=', 'trigger'), ('category', '!=', 'upload_file')],
|
|
'invisible': ['&', ('chaining_type', '=', 'suggest'), ('category', '!=', 'upload_file')]}"/>
|
|
<field name="suggested_next_type_ids" widget="many2many_tags" context="{'default_res_model': res_model}"
|
|
attrs="{'invisible': ['|', ('chaining_type', '=', 'trigger'), ('category', '=', 'upload_file')]}"/>
|
|
<field name="mail_template_ids" widget="many2many_tags"
|
|
domain="[('model_id.model', '=', res_model)]"
|
|
attrs="{'invisible': [('res_model', '=', False)]}"
|
|
context="{'default_model': res_model}"/>
|
|
<label for="delay_count"/>
|
|
<div>
|
|
<div class="o_row">
|
|
<field class="col-1 ps-0 pe-0" name="delay_count"/>
|
|
<field class="col-3 ps-1 pe-1" name="delay_unit"/>
|
|
<field name="delay_from"/>
|
|
</div>
|
|
</div>
|
|
</group>
|
|
</group>
|
|
<label for="default_note" class="fw-bold"/>
|
|
<field nolabel="1" name="default_note" placeholder="e.g. "Go over the offer and discuss details"" class="oe-bordered-editor"/>
|
|
<p class="alert alert-info" role="alert" attrs="{'invisible': [('res_model_change', '=', False)]}">Modifying the model can have an impact on existing activities using this activity type, be careful.</p>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_type_view_search" model="ir.ui.view">
|
|
<field name="name">mail.activity.type.search</field>
|
|
<field name="model">mail.activity.type</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Activities">
|
|
<field name="name"/>
|
|
<filter string="Archived" domain="[('active', '=', False)]" name="archived"/>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_type_view_tree" model="ir.ui.view">
|
|
<field name="name">mail.activity.type.view.tree</field>
|
|
<field name="model">mail.activity.type</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="Activities" sample="1">
|
|
<field name="sequence" widget="handle"/>
|
|
<field name="name"/>
|
|
<field name="summary"/>
|
|
<field name="delay_label" string="Planned in" class="text-end"/>
|
|
<field name="delay_from" string="Type"/>
|
|
<field name="res_model" groups="base.group_no_one"/>
|
|
<field name="icon" groups="base.group_no_one"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_type_action" model="ir.actions.act_window">
|
|
<field name="name">Activity Types</field>
|
|
<field name="res_model">mail.activity.type</field>
|
|
<field name="view_mode">tree,form</field>
|
|
</record>
|
|
|
|
|
|
<record id="mail_activity_action" model="ir.actions.act_window">
|
|
<field name="name">Activities</field>
|
|
<field name="res_model">mail.activity</field>
|
|
<field name="view_mode">tree,form</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_view_form_popup" model="ir.ui.view">
|
|
<field name="name">mail.activity.view.form.popup</field>
|
|
<field name="model">mail.activity</field>
|
|
<field name="priority">20</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Log an Activity" create="false">
|
|
<sheet string="Activity">
|
|
<div class="oe_button_box" name="button_box" invisible="1">
|
|
<button name="action_open_document" string="Open Document"
|
|
type="object" class="oe_link" icon="fa-file-text-o"
|
|
attrs="{'invisible': ['|', ('res_model', '=', False), ('res_id', '=', 0)]}"/>
|
|
</div>
|
|
<group invisible="1">
|
|
<field name="activity_category" invisible="1" />
|
|
<field name="res_model" invisible="1"/>
|
|
<field name="res_model_id" invisible="1"/>
|
|
<field name="res_id" invisible="1"/>
|
|
<field name="chaining_type" invisible="1"/>
|
|
<field name="previous_activity_type_id"/>
|
|
<field name="has_recommended_activities"/>
|
|
</group>
|
|
<group attrs="{'invisible': [('has_recommended_activities','=',False)]}">
|
|
<div class="o_row">
|
|
<strong>Recommended Activities</strong>
|
|
<field name="recommended_activity_type_id" widget="selection_badge"
|
|
domain="[('previous_type_ids', '=', previous_activity_type_id)]"
|
|
nolabel="1"/>
|
|
</div>
|
|
</group>
|
|
<group>
|
|
<group>
|
|
<field name="activity_type_id" required="1" options="{'no_create': True, 'no_open': True}"/>
|
|
<field name="summary" placeholder="e.g. Discuss proposal"/>
|
|
</group>
|
|
<group>
|
|
<field name="date_deadline"/>
|
|
<field name="user_id"/>
|
|
</group>
|
|
</group>
|
|
<field name="note" class="oe-bordered-editor" placeholder="Log a note..."/>
|
|
<footer>
|
|
<field name="id" invisible="1"/>
|
|
<button id="mail_activity_schedule" string="Schedule" name="action_close_dialog" type="object" class="btn-primary"
|
|
attrs="{'invisible': [('id', '!=', False)]}" data-hotkey="q"/>
|
|
<button id="mail_activity_save" string="Save" name="action_close_dialog" type="object" class="btn-primary"
|
|
attrs="{'invisible': [('id', '=', False)]}" data-hotkey="q"/>
|
|
<button attrs="{'invisible': [('chaining_type', '=', 'trigger')]}" string="Mark as Done" name="action_done"
|
|
type="object" class="btn-secondary" data-hotkey="w"
|
|
context="{'mail_activity_quick_update': True}"/>
|
|
<button attrs="{'invisible': [('chaining_type', '=', 'trigger')]}" string="Done & Schedule Next" name="action_done_schedule_next"
|
|
type="object" class="btn-secondary" data-hotkey="x"
|
|
context="{'mail_activity_quick_update': True}"/>
|
|
<button attrs="{'invisible': [('chaining_type', '=', 'suggest')]}" string="Done & Launch Next" name="action_done_schedule_next"
|
|
type="object" class="btn-secondary" data-hotkey="x"
|
|
context="{'mail_activity_quick_update': True}"/>
|
|
<button string="Discard" class="btn-secondary" special="cancel" data-hotkey="z" />
|
|
</footer>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_view_form" model="ir.ui.view">
|
|
<field name="name">mail.activity.view.form</field>
|
|
<field name="model">mail.activity</field>
|
|
<field name="priority">21</field>
|
|
<field name="mode">primary</field>
|
|
<field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>
|
|
<field name="arch" type="xml">
|
|
<field name="activity_type_id" position="before">
|
|
<field name="res_name" readonly="1" string="Document"/>
|
|
</field>
|
|
<footer position="replace"/>
|
|
<xpath expr="//div[hasclass('oe_button_box')]" position="attributes">
|
|
<attribute name="invisible">0</attribute>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_view_search" model="ir.ui.view">
|
|
<field name="name">mail.activity.view.search</field>
|
|
<field name="model">mail.activity</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Activity">
|
|
<field name="res_model"/>
|
|
<field name="summary"/>
|
|
<field name="activity_type_id"/>
|
|
<filter invisible="1" string="Late Activities" name="activities_overdue"
|
|
domain="[('date_deadline', '<', context_today().strftime('%Y-%m-%d'))]"
|
|
help="Show all records which has next action date is before today"/>
|
|
<filter invisible="1" string="Today Activities" name="activities_today"
|
|
domain="[('date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
|
|
<filter invisible="1" string="Future Activities" name="activities_upcoming_all"
|
|
domain="[('date_deadline', '>', context_today().strftime('%Y-%m-%d'))
|
|
]"/>
|
|
<group expand="0" string="Group By">
|
|
<filter string="Deadline" name="date_deadline" context="{'group_by': 'date_deadline'}"/>
|
|
<filter string="Created By" name="createdby" context="{'group_by': 'create_uid'}"/>
|
|
<filter string="Activity Type" name="activittype" context="{'group_by': 'activity_type_id'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_view_tree" model="ir.ui.view">
|
|
<field name="name">mail.activity.view.tree</field>
|
|
<field name="model">mail.activity</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="Next Activities"
|
|
decoration-danger="date_deadline < current_date"
|
|
decoration-success="date_deadline == current_date"
|
|
default_order="date_deadline" create="false">
|
|
<field name="res_name"/>
|
|
<field name="activity_type_id"/>
|
|
<field name="summary"/>
|
|
<field name="date_deadline"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_activity_action_view_tree" model="ir.actions.act_window.view">
|
|
<field name="sequence" eval="1"/>
|
|
<field name="view_mode">tree</field>
|
|
<field name="act_window_id" ref="mail.mail_activity_action"/>
|
|
</record>
|
|
<record id="mail_activity_action_view_form" model="ir.actions.act_window.view">
|
|
<field name="sequence" eval="2"/>
|
|
<field name="view_mode">form</field>
|
|
<field name="view_id" ref="mail.mail_activity_view_form"/>
|
|
<field name="act_window_id" ref="mail.mail_activity_action"/>
|
|
</record>
|
|
|
|
<record id="mail_activity_view_calendar" model="ir.ui.view">
|
|
<field name="name">mail.activity.view.calendar</field>
|
|
<field name="model">mail.activity</field>
|
|
<field name="priority" eval="2"/>
|
|
<field name="arch" type="xml">
|
|
<calendar string="Activity" date_start="date_deadline" color="activity_type_id">
|
|
<field name="user_id" avatar_field="avatar_128"/>
|
|
<field name="res_name"/>
|
|
<field name="date_deadline"/>
|
|
<field name="summary"/>
|
|
<field name="activity_type_id" filters="1" invisible="1"/>
|
|
</calendar>
|
|
</field>
|
|
</record>
|
|
|
|
</odoo>
|