[IMP] utm: improve campaign UI

Purpose
=======
Give users a better experience while using the utm campaign module.

Specifications
==============
* Add a filter called "My Campaigns" filtering on the current user_id.
* Add a groupby Tags.
* Always underline the Tags field in the campaign quick create.
* When duplicating a campaign, do not copy the stage and make it
restart the pipe.
* In the list view:
  - Change the column name from "Campaign Name" to "Name".
  - Add bold on the stage field.
  - Add the avatar widget to the Responsible field.
* For the edit stage modal:
  - Make the dialog smaller.
  - Only display the name field.
  - Add a placeholder to the name field.

Task-3240966

Part-of: odoo/odoo#116230
This commit is contained in:
amdi-odoo
2023-04-19 11:00:59 +02:00
parent efac0ab86e
commit d9eea928b3
3 changed files with 26 additions and 5 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class UtmCampaign(models.Model):
stage_id = fields.Many2one(
'utm.stage', string='Stage', ondelete='restrict', required=True,
default=lambda self: self.env['utm.stage'].search([], limit=1),
group_expand='_group_expand_stage_ids')
copy=False, group_expand='_group_expand_stage_ids')
tag_ids = fields.Many2many(
'utm.tag', 'utm_tag_rel',
'tag_id', 'campaign_id', string='Tags')
+9 -4
View File
@@ -9,12 +9,17 @@
<field name="tag_ids"/>
<field name="user_id"/>
<field name="is_auto_campaign"/>
<filter string="My Campaigns" name="filter_assigned_to_me" domain="[('user_id', '=', uid)]"
help="Campaigns that are assigned to me"/>
<separator/>
<filter string="Archived" name="filter_inactive" domain="[('active', '=', False)]"/>
<group expand="0" string="Group By">
<filter string="Stage" name="group_stage_id"
context="{'group_by': 'stage_id'}"/>
<filter string="Responsible" name="group_user_id"
context="{'group_by': 'user_id'}"/>
<filter string="Tags" name="group_tags_id"
context="{'group_by': 'tag_ids'}"/>
</group>
</search>
</field>
@@ -51,10 +56,10 @@
<field name="model">utm.campaign</field>
<field name="arch" type="xml">
<tree string="UTM Campaigns" multi_edit="1" sample="1">
<field name="title" readonly="1"/>
<field name="title" string="Name" readonly="1"/>
<field name="name" invisible="1"/>
<field name="user_id"/>
<field name="stage_id"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="stage_id" decoration-bf="1"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
</tree>
</field>
@@ -70,7 +75,7 @@
<field name="name" invisible="1"/>
<field class="o_text_overflow" name="title" string="Campaign Name" placeholder="e.g. Black Friday"/>
<field name="user_id" widget="many2one_avatar_user" domain="[('share', '=', False)]"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/>
<field name="tag_ids" widget="many2many_tags" class="o_field_highlight" options="{'color_field': 'color', 'no_create_edit': True}"/>
</group>
</form>
</field>
+16
View File
@@ -22,6 +22,22 @@
</field>
</record>
<record id="utm_stage_view_form" model="ir.ui.view">
<field name="name">utm.stage.view.form</field>
<field name="model">utm.stage</field>
<field name="arch" type="xml">
<form string="Stages">
<sheet>
<group>
<group>
<field name="name" placeholder='e.g. "Brainstorming"'/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_view_utm_stage" model="ir.actions.act_window">
<field name="name">UTM Stages</field>
<field name="res_model">utm.stage</field>