Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0][ADD] Add calendar_event_kanban_stage module #964

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 59 additions & 0 deletions calendar_event_kanban_stage/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3

===========================
Calendar Event Kanban Stage
===========================

This module adds Kanban stage functionality to the calendar event.

In addition, the following stages are created:

* To plan
* Planned
* Done

where the first one is set by default.

Usage
=====

* To manage stages, go to Settings > Technical > Kanban > Stages.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback..

Credits
=======

Contributors
------------

* Alex Comba <alex.comba@agilebg.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>


Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
1 change: 1 addition & 0 deletions calendar_event_kanban_stage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions calendar_event_kanban_stage/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Alex Comba - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

{
'name': 'Calendar Event Kanban Stage',
'summary': 'Adds Kanban stage functionality to calendar event',
'version': '10.0.1.0.0',
'author': 'Agile Business Group, '
'Odoo Community Association (OCA)',
'license': 'LGPL-3',
'website': 'https://www.agilebg.com',
'category': 'Tools',
'depends': [
'calendar',
'base_kanban_stage',
],
'data': [
'data/base_kanban_stage_data.xml',
'views/calendar_event_view.xml',
],
'installable': True,
}
28 changes: 28 additions & 0 deletions calendar_event_kanban_stage/data/base_kanban_stage_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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 noupdate="1">

<record id="event_to_plan" model="base.kanban.stage">
<field name="name">To Plan</field>
<field name="res_model_id" ref="model_calendar_event"/>
<field name="sequence" eval="1"/>
<field name="fold" eval="False"/>
</record>

<record id="event_planned" model="base.kanban.stage">
<field name="name">Planned</field>
<field name="res_model_id" ref="model_calendar_event"/>
<field name="sequence" eval="2"/>
<field name="fold" eval="False"/>
</record>

<record id="event_done" model="base.kanban.stage">
<field name="name">Done</field>
<field name="res_model_id" ref="model_calendar_event"/>
<field name="sequence" eval="3"/>
<field name="fold" eval="True"/>
</record>

</odoo>
1 change: 1 addition & 0 deletions calendar_event_kanban_stage/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_event
19 changes: 19 additions & 0 deletions calendar_event_kanban_stage/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Alex Comba - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

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')
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions calendar_event_kanban_stage/views/calendar_event_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?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">
<field name="name">Calendar - Event Form</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}"/>
</header>
</xpath>
<field name="partner_ids" position="after">
<div>
<label string="Priority" for="kanban_priority"/>
<field name="kanban_priority" groups="base.group_user" widget="priority"/>
</div>
</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>

<record id="view_calendar_event_form_popup" model="ir.ui.view">
<field name="name">Meetings Popup</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form_popup" />
<field name="arch" type="xml">
<xpath expr="/form/*" position="before">
<header>
<field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}"/>
</header>
</xpath>
<field name="partner_ids" position="after">
<field name="kanban_priority" string="Priority" groups="base.group_user" widget="priority"/>
</field>
</field>
</record>


<record id="view_calendar_event_search" model="ir.ui.view">
<field name="name">CRM - Meetings Search</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_search" />
<field name="arch" type="xml">
<field name="name" position= "after">
<field name="stage_id"/>
</field>
</field>
</record>

<record id="view_calendar_event_kanban" model="ir.ui.view">
<field name="name">Calendar Event - Kanban View</field>
<field name="model">calendar.event</field>
<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_body']">
<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="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>
</xpath>
</field>
</record>

<record id="calendar.action_calendar_event" model="ir.actions.act_window">
<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">
<field name="act_window_id" ref="calendar.action_calendar_event"/>
<field name="sequence" eval="4"/>
<field name="view_mode">kanban</field>
<field name="view_id" ref="view_calendar_event_kanban"/>
</record>

</odoo>