mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[ENH]kanban view
This commit is contained in:
committed by
AaronHForgeFlow
parent
0dfa015073
commit
ea7e73d6db
@@ -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
|
||||
|
||||
@@ -9,23 +9,22 @@
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='card_body']">
|
||||
<div>
|
||||
<strong>
|
||||
<field name="partner_id"/>
|
||||
</strong><br/>
|
||||
<div name="main">
|
||||
<strong>Partner</strong>:<field name="partner_id"/>
|
||||
<br/>
|
||||
<t t-if="origin">
|
||||
<br></br>
|
||||
<strong>Origin</strong>: <field name="origin"/>
|
||||
</t>
|
||||
<t t-if="record.create_date.raw_value and record.create_date.raw_value < (new Date())" t-set="red">oe_kanban_text_red</t>
|
||||
<span t-attf-class="#{red || ''}">
|
||||
Date - <field name="create_date"/>
|
||||
<strong>Date</strong>: <field name="create_date"/>
|
||||
</span>
|
||||
<span name="product">
|
||||
<br></br>
|
||||
Product - <field name="product_id"/>
|
||||
<strong>Product</strong>: <field name="product_id"/>
|
||||
<br></br>
|
||||
<field name="product_qty"/> <field name="uom_id"/>
|
||||
<t t-if="origin">
|
||||
<br></br>
|
||||
origin - <field name="origin"/>
|
||||
</t>
|
||||
<strong>QTY</strong>:<field name="product_qty"/> <field name="uom_id"/>
|
||||
</span>
|
||||
<br/>
|
||||
<span style='background-color:#EBEC6D' name="operation">
|
||||
@@ -49,10 +48,12 @@
|
||||
|
||||
<record id="rma.action_rma_customer_lines" model="ir.actions.act_window">
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_id" ref="rma_kanban_stage.rma_order_line_kanban"/>
|
||||
</record>
|
||||
|
||||
<record id="rma.action_rma_supplier_lines" model="ir.actions.act_window">
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_id" ref="rma_kanban_stage.rma_order_line_kanban"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user