diff --git a/event_track_task_code/README.rst b/event_track_task_code/README.rst new file mode 100644 index 0000000..a3623cb --- /dev/null +++ b/event_track_task_code/README.rst @@ -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 +* Alfredo de la Fuente diff --git a/event_track_task_code/__init__.py b/event_track_task_code/__init__.py new file mode 100644 index 0000000..3cc622a --- /dev/null +++ b/event_track_task_code/__init__.py @@ -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 diff --git a/event_track_task_code/__openerp__.py b/event_track_task_code/__openerp__.py new file mode 100644 index 0000000..a24d6db --- /dev/null +++ b/event_track_task_code/__openerp__.py @@ -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 ", + "Alfredo de la Fuente ", + ], + "category": "Event Management", + "depends": [ + "sale_order_create_event", + "project_task_code", + ], + "data": [ + "views/event_track_view.xml", + ], + "installable": True, + "auto-install": True, +} diff --git a/event_track_task_code/i18n/es.po b/event_track_task_code/i18n/es.po new file mode 100644 index 0000000..52f794b --- /dev/null +++ b/event_track_task_code/i18n/es.po @@ -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:" + diff --git a/event_track_task_code/models/__init__.py b/event_track_task_code/models/__init__.py new file mode 100644 index 0000000..ef10d9e --- /dev/null +++ b/event_track_task_code/models/__init__.py @@ -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 diff --git a/event_track_task_code/models/event_track.py b/event_track_task_code/models/event_track.py new file mode 100644 index 0000000..4be98a8 --- /dev/null +++ b/event_track_task_code/models/event_track.py @@ -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) diff --git a/event_track_task_code/tests/__init__.py b/event_track_task_code/tests/__init__.py new file mode 100644 index 0000000..e99cced --- /dev/null +++ b/event_track_task_code/tests/__init__.py @@ -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 diff --git a/event_track_task_code/tests/test_event_track_task_code.py b/event_track_task_code/tests/test_event_track_task_code.py new file mode 100644 index 0000000..13e55d8 --- /dev/null +++ b/event_track_task_code/tests/test_event_track_task_code.py @@ -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') diff --git a/event_track_task_code/views/event_track_view.xml b/event_track_task_code/views/event_track_view.xml new file mode 100644 index 0000000..29e10c0 --- /dev/null +++ b/event_track_task_code/views/event_track_view.xml @@ -0,0 +1,15 @@ + + + + + view.event.track.calendar.inh.task.code + event.track + + + + + + + + +