Skip to content

Commit

Permalink
[ADD] event_track_task_code: Auto installable module to display the t…
Browse files Browse the repository at this point in the history
…ask code in the session calendar.
  • Loading branch information
alfredoavanzosc committed Mar 13, 2018
1 parent 583d1f0 commit 2a11832
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 0 deletions.
18 changes: 18 additions & 0 deletions event_track_task_code/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Event track task code
=====================

* Show project task code in event track calendar form.


Credits
=======

Contributors
------------
* Ana Juaristi <[email protected]>
* Alfredo de la Fuente <[email protected]>
4 changes: 4 additions & 0 deletions event_track_task_code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
24 changes: 24 additions & 0 deletions event_track_task_code/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Event Track Task Code",
"version": "8.0.1.0.0",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "http://www.avanzosc.es",
"contributors": [
"Ana Juaristi <[email protected]>",
"Alfredo de la Fuente <[email protected]>",
],
"category": "Event Management",
"depends": [
"sale_order_create_event",
"project_task_code",
],
"data": [
"views/event_track_view.xml",
],
"installable": True,
"auto-install": True,
}
33 changes: 33 additions & 0 deletions event_track_task_code/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_track_task_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-09 09:32+0000\n"
"PO-Revision-Date: 2018-03-09 09:32+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: event_track_task_code
#: model:ir.model,name:event_track_task_code.model_event_track
msgid "Event Tracks"
msgstr "Sesiones del evento"

#. module: event_track_task_code
#: field:event.track,lit_task_code:0
msgid "Task code literal"
msgstr "Literal código tarea"

#. module: event_track_task_code
#: code:addons/event_track_task_code/models/event_track.py:13
#, python-format
msgid "Task code:"
msgstr "Código tarea:"

4 changes: 4 additions & 0 deletions event_track_task_code/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import event_track
18 changes: 18 additions & 0 deletions event_track_task_code/models/event_track.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, _


class EventTrack(models.Model):
_inherit = 'event.track'

@api.depends('task_id', 'task_id.code')
def _compute_lit_task_code(self):
for track in self:
track.lit_task_code = u", {} {} ".format(_('Task code:'),
track.task_id.code)

lit_task_code = fields.Char(
string='Task code literal', compute='_compute_lit_task_code',
store=True)
4 changes: 4 additions & 0 deletions event_track_task_code/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_event_track_task_code
21 changes: 21 additions & 0 deletions event_track_task_code/tests/test_event_track_task_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright © 2018 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common


class TestEventTrackTaskCode(common.TransactionCase):

def setUp(self):
super(TestEventTrackTaskCode, self).setUp()
self.task = self.env['project.task'].create(
{'name': 'Test event track task code',
'code': 'TTTT-000021'})
self.session = self.env['event.track'].search([], limit=1)
self.session.task_id = self.task.id

def test_event_track_task_code(self):
self.session._compute_lit_task_code()
self.assertEqual(
self.session.lit_task_code, ', Task code: TTTT-000021',
'Bad literal for task code in event track')
15 changes: 15 additions & 0 deletions event_track_task_code/views/event_track_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_event_track_calendar_inh_task_code">
<field name="name">view.event.track.calendar.inh.task.code</field>
<field name="model">event.track</field>
<field name="inherit_id" ref="event_track_assistant.view_event_track_calendar_inh_assistant" />
<field name="arch" type="xml">
<field name="lit_presences" position="after">
<field name="lit_task_code" />
</field>
</field>
</record>
</data>
</openerp>

0 comments on commit 2a11832

Please sign in to comment.