From ea7e73d6db361c0489bb4ed7f6c60863e9afb4e4 Mon Sep 17 00:00:00 2001 From: ahenriquez Date: Tue, 8 Oct 2019 10:16:32 +0200 Subject: [PATCH] [ENH]kanban view --- rma_kanban_stage/models/rma_order_line.py | 18 ++++++++++++++- .../views/rma_order_line_view.xml | 23 ++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/rma_kanban_stage/models/rma_order_line.py b/rma_kanban_stage/models/rma_order_line.py index a7e8e22b..400de19c 100644 --- a/rma_kanban_stage/models/rma_order_line.py +++ b/rma_kanban_stage/models/rma_order_line.py @@ -1,6 +1,6 @@ # Copyright 2019 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) -from odoo import api, fields, models +from odoo import _, api, fields, models class RmaOrderLine(models.Model): @@ -10,6 +10,10 @@ class RmaOrderLine(models.Model): user_id = fields.Many2one( comodel_name='res.users', related='assigned_to' ) + kanban_color = fields.Integer( + compute='compute_color', + string='Base - Background Color', + help='Default color for the background.') @api.multi def copy(self, default=None): @@ -18,3 +22,15 @@ class RmaOrderLine(models.Model): stage = self.stage_id.search([], order="sequence asc", limit=1) default.update({'stage_id': stage.id}) return super(RmaOrderLine, self).copy(default=default) + + @api.depends('state') + @api.multi + def compute_color(self): + for rec in self.filtered(lambda l: l.state == 'draft'): + rec.kanban_color = 1 + for rec in self.filtered(lambda l: l.state == 'approved'): + rec.kanban_color = 2 + for rec in self.filtered(lambda l: l.state == 'to_approve'): + rec.kanban_color = 5 + for rec in self.filtered(lambda l: l.state == 'done'): + rec.kanban_color = 7 diff --git a/rma_kanban_stage/views/rma_order_line_view.xml b/rma_kanban_stage/views/rma_order_line_view.xml index 369e8d86..c68d98b6 100644 --- a/rma_kanban_stage/views/rma_order_line_view.xml +++ b/rma_kanban_stage/views/rma_order_line_view.xml @@ -9,23 +9,22 @@ primary -
- - -
+
+ Partner: +
+ +

+ Origin: +
oe_kanban_text_red - Date - + Date:

- Product - + Product:

- - -

- origin - -
+ QTY:

@@ -49,10 +48,12 @@ kanban,tree,form + kanban,tree,form +