[IMP] website_event_track: improve track management through stage legend
In order to make the kanban view more customizable, we will allow the administrators to give a custom legend on the event track stages. With the custom legends, the employees should be able to find their way more easily especially if the company uses its own internal processes. The custom description of the track stage will appear in a tooltip when the user hovers the corresponding kanban column and does not move for a few seconds. It can help people understand the role of each track stage. In order to ease track management, tags are now searchable directly from track view. task-2504216 COM PR: odoo/odoo#69585 UPG PR: odoo/upgrade#2408
This commit is contained in:
committed by
Thibault Delavallée
parent
c1b7944a67
commit
a4bd3e0db1
@@ -42,15 +42,24 @@ class Track(models.Model):
|
||||
group_expand='_read_group_stage_ids',
|
||||
required=True, tracking=True)
|
||||
is_accepted = fields.Boolean('Is Accepted', related='stage_id.is_accepted', readonly=True)
|
||||
legend_blocked = fields.Char(related='stage_id.legend_blocked',
|
||||
string='Kanban Blocked Explanation', readonly=True)
|
||||
legend_done = fields.Char(related='stage_id.legend_done',
|
||||
string='Kanban Valid Explanation', readonly=True)
|
||||
legend_normal = fields.Char(related='stage_id.legend_normal',
|
||||
string='Kanban Ongoing Explanation', readonly=True)
|
||||
kanban_state = fields.Selection([
|
||||
('normal', 'Grey'),
|
||||
('done', 'Green'),
|
||||
('blocked', 'Red')], string='Kanban State',
|
||||
copy=False, default='normal', required=True, tracking=True,
|
||||
copy=False, default='normal', required=True,
|
||||
help="A track's kanban state indicates special situations affecting it:\n"
|
||||
" * Grey is the default situation\n"
|
||||
" * Red indicates something is preventing the progress of this track\n"
|
||||
" * Green indicates the track is ready to be pulled to the next stage")
|
||||
kanban_state_label = fields.Char(
|
||||
string='Kanban State Label', compute='_compute_kanban_state_label', store=True,
|
||||
tracking=True)
|
||||
partner_id = fields.Many2one('res.partner', 'Contact', help="Contact of the track, may be different from speaker.")
|
||||
# speaker information
|
||||
partner_name = fields.Char(
|
||||
@@ -159,6 +168,18 @@ class Track(models.Model):
|
||||
if track.id:
|
||||
track.website_url = '/event/%s/track/%s' % (slug(track.event_id), slug(track))
|
||||
|
||||
# STAGES
|
||||
|
||||
@api.depends('stage_id', 'kanban_state')
|
||||
def _compute_kanban_state_label(self):
|
||||
for track in self:
|
||||
if track.kanban_state == 'normal':
|
||||
track.kanban_state_label = track.stage_id.legend_normal
|
||||
elif track.kanban_state == 'blocked':
|
||||
track.kanban_state_label = track.stage_id.legend_blocked
|
||||
else:
|
||||
track.kanban_state_label = track.stage_id.legend_done
|
||||
|
||||
# SPEAKER
|
||||
|
||||
@api.depends('partner_id')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import _, fields, models
|
||||
|
||||
|
||||
class TrackStage(models.Model):
|
||||
@@ -15,6 +15,13 @@ class TrackStage(models.Model):
|
||||
'mail.template', string='Email Template',
|
||||
domain=[('model', '=', 'event.track')],
|
||||
help="If set an email will be sent to the customer when the track reaches this step.")
|
||||
# legends
|
||||
color = fields.Integer(string='Color')
|
||||
description = fields.Text(string='Description', translate=True)
|
||||
legend_blocked = fields.Char('Red Kanban Label', default=lambda s: _('Blocked'), translate=True)
|
||||
legend_done = fields.Char('Green Kanban Label', default=lambda s: _('Ready for Next Stage'), translate=True)
|
||||
legend_normal = fields.Char('Grey Kanban Label', default=lambda s: _('In Progress'), translate=True)
|
||||
# pipe
|
||||
fold = fields.Boolean(
|
||||
string='Folded in Kanban',
|
||||
help='This stage is folded in the kanban view when there are no records in that stage to display.')
|
||||
@@ -26,4 +33,3 @@ class TrackStage(models.Model):
|
||||
help='Done tracks are automatically published so that they are available in frontend.')
|
||||
is_cancel = fields.Boolean(string='Canceled Stage')
|
||||
is_done = fields.Boolean()
|
||||
color = fields.Integer(string='Color')
|
||||
|
||||
@@ -32,6 +32,27 @@
|
||||
<field name="color" widget="color_picker"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Stage Description and Tooltips">
|
||||
<p class="text-muted" colspan="2">
|
||||
Define labels explaining kanban state management.
|
||||
</p>
|
||||
<label for="legend_normal" string=" " class="o_status"
|
||||
title="Task in progress. Click to block or set as done."
|
||||
aria-label="Task in progress. Click to block or set as done." role="img"/>
|
||||
<field name="legend_normal" nolabel="1"/>
|
||||
<label for="legend_blocked" string=" " class="o_status o_status_red"
|
||||
title="Task is blocked. Click to unblock or set as done."
|
||||
aria-label="Task is blocked. Click to unblock or set as done." role="img"/>
|
||||
<field name="legend_blocked" nolabel="1"/>
|
||||
<label for="legend_done" string=" " class="o_status o_status_green"
|
||||
title="This step is done. Click to block or set in progress."
|
||||
aria-label="This step is done. Click to block or set in progress." role="img"/>
|
||||
<field name="legend_done" nolabel="1"/>
|
||||
<p class="text-muted" colspan="2">
|
||||
Add a description to help your coworkers understand the meaning and purpose of the stage.
|
||||
</p>
|
||||
<field name="description" placeholder="Add a description..." nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -17,13 +17,16 @@
|
||||
<field name="model">event.track</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban default_group_by="stage_id">
|
||||
<field name="color"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="stage_id" options='{"group_by_tooltip": {"description": "Description"}}'/>
|
||||
<field name="website_url"/>
|
||||
<field name="activity_ids"/>
|
||||
<field name="activity_state"/>
|
||||
<field name="legend_blocked"/>
|
||||
<field name="legend_normal"/>
|
||||
<field name="legend_done"/>
|
||||
<templates>
|
||||
<field name="color"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="stage_id"/>
|
||||
<field name="website_url"/>
|
||||
<field name="activity_ids"/>
|
||||
<field name="activity_state"/>
|
||||
<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger"}'/>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_card oe_kanban_global_click">
|
||||
@@ -87,6 +90,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Event Tracks">
|
||||
<field name="name"/>
|
||||
<field name="tag_ids"/>
|
||||
<field name="event_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="stage_id"/>
|
||||
@@ -139,6 +143,9 @@
|
||||
</button>
|
||||
<field name="is_published" widget="website_redirect_button"/>
|
||||
</div>
|
||||
<field name="legend_blocked" invisible="1"/>
|
||||
<field name="legend_normal" invisible="1"/>
|
||||
<field name="legend_done" invisible="1"/>
|
||||
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="kanban_state" widget="state_selection" class="ml-3 float-right"/>
|
||||
<field name="website_image" widget="image" class="oe_avatar"/>
|
||||
|
||||
Reference in New Issue
Block a user