Skip to content

Commit

Permalink
[IMP] calendar_event_kanban_stage: add attendees_count to calendar.event
Browse files Browse the repository at this point in the history
  • Loading branch information
tafaRU committed Sep 6, 2017
1 parent c3474e0 commit 95865c7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 45 deletions.
4 changes: 2 additions & 2 deletions calendar_event_kanban_stage/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
'name': 'Calendar Event Kanban Stage',
'summary': 'Adds Kanban stage functionality to calendar event',
'version': '10.0.0.1.0',
'version': '10.0.0.1.1',
'author': 'Agile Business Group, '
'Odoo Community Association (OCA)',
'license': 'LGPL-3',
Expand All @@ -16,7 +16,7 @@
'base_kanban_stage',
],
'data': [
'data/calendar_state_data.xml',
'data/base_kanban_stage_data.xml',
'views/calendar_event_view.xml',
],
'installable': True,
Expand Down
26 changes: 0 additions & 26 deletions calendar_event_kanban_stage/data/calendar_state_data.xml

This file was deleted.

9 changes: 8 additions & 1 deletion calendar_event_kanban_stage/models/calendar_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
# Copyright 2017 Alex Comba - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models
from odoo import api, fields, models


class CalendarEvent(models.Model):
_name = 'calendar.event'
_inherit = ['calendar.event', 'base.kanban.abstract']

@api.multi
def _compute_attendees_count(self):
for event in self:
event.attendees_count = len(event.partner_ids)

note = fields.Text("Internal Notes")
attendees_count = fields.Integer(
"Attendees", compute='_compute_attendees_count')
29 changes: 13 additions & 16 deletions calendar_event_kanban_stage/views/calendar_event_view.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2017 Alex Comba - Agile Business Group
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->

<odoo>

<record id="view_calendar_event_form" model="ir.ui.view">
Expand All @@ -17,10 +20,10 @@
<field name="kanban_priority" groups="base.group_user" widget="priority"/>
</div>
</field>
<field name="user_id" position="after">
<label for="note" string="Internal Notes"/>
<field name="note" nolabel="1"/>
</field>
<xpath expr="//notebook/page/label[@for='description']" position="before">
<label for="note"/>
<field name="note" placeholder="Add an internal note here..."/>
</xpath>
</field>
</record>

Expand Down Expand Up @@ -58,30 +61,24 @@
<field name="mode">primary</field>
<field name="inherit_id" ref="base_kanban_stage.base_kanban_abstract_view_kanban"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='card_header']">
<!-- Add header content here -->
</xpath>
<xpath expr="//div[@name='card_body']">
<!-- Add body content here -->
<field name="kanban_status"/>
<div class="oe_kanban_content">
<div>
<t t-if="record.start_datetime.raw_value and record.start_datetime.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
<span t-attf-class="#{red || ''}"><i><field name="start_datetime"/></i></span>
</div>
<div class="oe_kanban_bottom_right">
<i class="fa fa-users"></i> Attendees
</div>
<!-- <div class="oe_kanban_bottom_right">
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar pull-right"/>
<div class="o_stat_info">
<field name="attendees_count" class="o_stat_value"/>
<span class="o_stat_text" attrs="{'invisible': [('attendees_count', '&lt;', 2)]}"> <i class="fa fa-users"/> Attendees</span>
<span class="o_stat_text" attrs="{'invisible': [('attendees_count', '&gt;', 1)]}"> <i class="fa fa-users"/> Attendee</span>
</div>
--> </div>
</div>
</xpath>
</field>
</record>

<record id="calendar.action_calendar_event" model="ir.actions.act_window">
<field name="context" eval="{'default_stage_id':ref('calendar_event_state.event_to_plan')}" />
<field name="context" eval="{'default_stage_id':ref('calendar_event_kanban_stage.event_to_plan')}" />
</record>

<record id="action_view_calendar_event_kanban" model="ir.actions.act_window.view">
Expand Down

0 comments on commit 95865c7

Please sign in to comment.