Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
8033 Widoki

Hi, I want to change the color of the kanban view based on the expiration date  

Awatar
Odrzuć

a nice idea, did you find a solution?

Najlepsza odpowiedź

Hi

You can use the below XML code to set the color of a kanban view.

<kanban>
<!-- Other fileds-->
<field name="color"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="{{'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) }} oe_kanban_card oe_kanban_global_click oe_semantic_html_override">
<!-- Define view-->
</div>
</t>
</templates>
</kanban>

And inside your model define a color field and compute its value according to the expiration date.

color = fields.Integer('Color', compute='_get_color')

def _get_color(self):
"""Compute Color value according to the conditions"""
for rec in self:
if rec.expiry_date:
rec.color = 1
else:
rec.color = 2

Hope it helps

Awatar
Odrzuć
Najlepsza odpowiedź

try this

decoration-danger="condition"

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 15
4994
2
maj 25
1340
1
sie 21
3493
1
mar 19
13374
2
paź 16
5176