Kanban first version.

This commit is contained in:
michel 2017-11-09 10:02:21 +01:00
parent 25fadfdb56
commit 7b33b11789
2 changed files with 41 additions and 8 deletions

View File

@ -11,17 +11,18 @@ class Coworker(models.Model):
_description = 'Coworker model definition' _description = 'Coworker model definition'
_order = 'id desc' _order = 'id desc'
full_name = fields.Char(compute='_compute_full_name', store=True, index=True) contact_date = fields.Date(default=fields.Date.context_today)
full_name = fields.Char(compute='_compute_full_name', store=True, index=True)
name = fields.Char(required=True) name = fields.Char(required=True)
firstname = fields.Char('First name', required=True) firstname = fields.Char('First name', required=True)
coworker_type = fields.Selection([('staffer', 'Staffer'), coworker_type = fields.Selection([('staffer', 'Staffer'),
('worker', 'Worker'), ('member', 'Member'), ('worker', 'Worker'), ('member', 'Member'),
('volunteer', 'Volunteer'), ('volunteer', 'Volunteer'),
('visitor', 'Visitor')]) ('visitor', 'Visitor')])
company_name = fields.Char('Company') company_name = fields.Char('Company')
job = fields.Char() job = fields.Char()
contact_date = fields.Date(default=fields.Date.context_today)
#Adress fields #Adress fields
street = fields.Char() street = fields.Char()
@ -35,13 +36,18 @@ class Coworker(models.Model):
url = fields.Char('URL') url = fields.Char('URL')
note = fields.Text() note = fields.Text()
#Images fields #Images fields
contact_image = fields.Binary() contact_image = fields.Binary()
is_done = fields.Boolean('Done?') is_done = fields.Boolean('Done?')
is_active = fields.Boolean('Active?', default=True) is_active = fields.Boolean('Active?', default=True)
# # Kanban
# kanban_state = fields.Selection([('normal', 'In Progress'),
# ('blocked', 'Blocked'),
# ('done', 'Ready for next stage')],
# 'Kanban State', default='normal')
@api.depends('name', 'firstname') @api.depends('name', 'firstname')
def _compute_full_name(self): def _compute_full_name(self):
"""Concaténation du nom et du prénom""" """Concaténation du nom et du prénom"""

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- Form -->
<record id="view_form_coworker" model="ir.ui.view"> <record id="view_form_coworker" model="ir.ui.view">
<field name="name">Coworker Form</field> <field name="name">Coworker Form</field>
<field name="model">coworking.coworker</field> <field name="model">coworking.coworker</field>
@ -46,7 +46,7 @@
</field> </field>
</record> </record>
<!-- Tree -->
<record id="view_tree_coworker" model="ir.ui.view"> <record id="view_tree_coworker" model="ir.ui.view">
<field name="name">Coworker Tree</field> <field name="name">Coworker Tree</field>
<field name="model">coworking.coworker</field> <field name="model">coworking.coworker</field>
@ -61,7 +61,7 @@
</field> </field>
</record> </record>
<!-- Search -->
<record id="view_search_coworker" model="ir.ui.view"> <record id="view_search_coworker" model="ir.ui.view">
<field name="name">Coworker Search</field> <field name="name">Coworker Search</field>
<field name="model">coworking.coworker</field> <field name="model">coworking.coworker</field>
@ -99,6 +99,33 @@
</search> </search>
</field> </field>
</record> </record>
<!-- Kanban -->
<record id="view_kanban_coworker" model="ir.ui.view">
<field name="name">Coworker Kanban</field>
<field name="model">coworking.coworker</field>
<field name="arch" type="xml">
<kanban>
<field name="contact_image" />
<field name="full_name" />
<field name="full_contact_adress" />
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_vignette oe_semantic_html_override">
<div class="o_kanban_image">
<img t-if="record.contact_image.raw_value"
t-att-src="'data:image/png;base64,'+ record.contact_image.raw_value"/>
<t t-if="!record.contact_image.raw_value">
</t>
</div>
<div>
<field name="full_name" />
<field name="full_contact_adress" />
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</odoo> </odoo>