[FIX] web: Make progress bar work with selection fields
Purpose
=======
The progress bar on a kanban column doesn't work with selection fields
Specification
=============
In kanban view, subgroupCounts of progressbar should work if columns are grouped with a selection field
Currently, progressbar's subgroupCounts only worked if column is grouped by a 'Many2one' field. If column
is grouped by a 'selection' field then its not working.
For example,
If column is grouped by a 'Many2one' field then we've tuple,
{'state': (2, 'Signatures in Progress')}
So, here for preparing progressBar values for subgroupCounts we'll get
{Signatures in Progress: {overdue: 0, planned: 0, today: 1}}
But for a selection field, we'll have a string 'sent' i.e a technical value,
{'state': 'sent'}
So here 'group_by_value' as a 'key' will never be matched as we have 'sent' instead
of 'Signatures in Progress'. We've a technical value instead of its UI value and
dict of subgroupCounts would be based on UI values that's why it'll never find values.
To fix this issue we need to set proper 'group_by_value'.
That's why added one condition for 'selection' field to gets its value of specific
state inside 'read_progress_bar' method.
Related to Task: 1862371
This commit is contained in:
committed by
Yannick Tivisse
parent
a4d6bff197
commit
b7e2d47596
@@ -62,6 +62,9 @@ class Base(models.AbstractModel):
|
||||
group_by_value, format=display_date_formats[group_by_modifier],
|
||||
locale=locale)
|
||||
|
||||
if field_type == 'selection':
|
||||
group_by_value = dict(self.fields_get()[group_by]['selection'])[group_by_value]
|
||||
|
||||
if type(group_by_value) == tuple:
|
||||
group_by_value = group_by_value[1] # FIXME should use technical value (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user