Files
odoo_source/addons/mail/views/mail_activity_views.xml
T
Damien Abeloos 8aa1d6ff02 [IMP] mail: revamp the activity type form view
* Reorganize and reword some of the fields for the activity form type view

* The fields `force_next` from `mail.activity.type` and its related
  field from `mail.activity` are removed.
  Instead, a new field `chaining_type`, which is a `selection` will
  improve the readability of the activity_type form. (It is made more
  obvious that the user has to choose between 2 modes :
    - 'Trigger Next Activity': used when the user wants to specify the type of the
      next activity, which will be triggered once the current activity is done
    - 'Suggest Next Activity': used when the user wants to recommend the
      next activity for the user to schedule once the current activity is done

* To be consistent with this change :
    - The field `default_next_type_id` is renamed `triggered_next_type_id`
    - The field `next_type_ids` is renamed `suggested_next_type_ids`

* The field `default_description` is renamed `default_note` to better match the
  `note` field from `mail.activity`

* About the specific case of activity_type.category = 'upload_file' :
    An activity which has this type's category is automatically marked as done as soon as
    the file is uploaded. This prevents the user from choosing a "next activity type".

    As such, an activity_type with this category can only make use of the
    chaining_type = "trigger", to be part of an automated process.

    An activity_type with this chaining_type should have the
    triggered_next_type_id set (usually required in the Form).
    But, since it does not make sense to set suggested_next_type_ids in this case :
      - chaining_type will stay hidden in the Form
      - triggered_next_type_id will always be shown and is not marked as required in the Form
      - if triggered_next_type_id is not set, chaining_type will be "suggest"

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
UPGRADE : https://github.com/odoo/upgrade/pull/2167
2021-03-03 12:12:52 +00:00

235 lines
13 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, 'no_edit': True}" domain="[('share', '=', False)]"/>
<field name="res_model_id" groups="base.group_no_one"/>
<field name="res_model_change" invisible="1"/>
<field name="initial_res_model_id" invisible="1"/>
<field name="summary"/>
<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_id': res_model_id}"
attrs="{'required': ['&amp;', ('chaining_type', '=', 'trigger'), ('category', '!=', 'upload_file')],
'invisible': ['&amp;', ('chaining_type', '=', 'suggest'), ('category', '!=', 'upload_file')]}"/>
<field name="suggested_next_type_ids" widget="many2many_tags" context="{'default_res_model_id': res_model_id}"
attrs="{'invisible': ['|', ('chaining_type', '=', 'trigger'), ('category', '=', 'upload_file')]}"/>
<field name="mail_template_ids" widget="many2many_tags"
domain="[('model_id', '=', res_model_id)]"
attrs="{'invisible': [('res_model_id', '=', False)]}"
context="{'default_model_id': res_model_id}"/>
<label for="delay_count"/>
<div>
<div class="o_row">
<field class="col-1 pl-0 pr-0" name="delay_count"/>
<field class="col-3 pl-1 pr-1" name="delay_unit"/>
<field name="delay_from"/>
</div>
</div>
</group>
</group>
<label for="default_note"/>
<field name="default_note"/>
<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-right"/>
<field name="delay_from" string="Type"/>
<field name="res_model_id" 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">
<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" widget="integer"/>
<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" placeholder="Log a note..."/>
<footer>
<field name="id" invisible="1"/>
<button string="Schedule" name="action_close_dialog" type="object" class="btn-primary"
attrs="{'invisible': [('id', '!=', False)]}"/>
<button string="Save" name="action_close_dialog" type="object" class="btn-primary"
attrs="{'invisible': [('id', '=', False)]}"/>
<button attrs="{'invisible': [('chaining_type', '=', 'trigger')]}" string="Mark as Done" name="action_done"
type="object" class="btn-secondary"
context="{'mail_activity_quick_update': True}"/>
<button attrs="{'invisible': [('chaining_type', '=', 'trigger')]}" string="Done &amp; Schedule Next" name="action_done_schedule_next"
type="object" class="btn-secondary"
context="{'mail_activity_quick_update': True}"/>
<button attrs="{'invisible': [('chaining_type', '=', 'suggest')]}" string="Done &amp; Launch Next" name="action_done_schedule_next"
type="object" class="btn-secondary"
context="{'mail_activity_quick_update': True}"/>
<button string="Discard" class="btn-secondary" special="cancel" />
</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"/>
</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_id"/>
<field name="summary"/>
<field name="activity_type_id"/>
<filter invisible="1" string="Late Activities" name="activities_overdue"
domain="[('date_deadline', '&lt;', 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', '&gt;', 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 &lt; 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="image_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>