Skip to content

Commit

Permalink
Merge pull request #53 from Tecnativa/8.0-event_project-cancel
Browse files Browse the repository at this point in the history
[IMP] event_project: Cancel project when cancelling event
  • Loading branch information
pedrobaeza committed Jun 6, 2016
2 parents e55862b + 3966c3d commit bf6bbdb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
8 changes: 7 additions & 1 deletion event_project/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ It will then create automatically a new project related with the event.
:target: https://runbot.odoo-community.org/runbot/199/8.0


Known issues / Roadmap
======================

* Develop tests for all use cases.


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

Expand Down Expand Up @@ -81,4 +87,4 @@ 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.
To contribute to this module, please visit https://odoo-community.org.
3 changes: 2 additions & 1 deletion event_project/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

{
"name": "Event project",
"version": "8.0.1.1.0",
"version": "8.0.1.1.1",
"author": "Antiun Ingeniería S.L., "
"Tecnativa, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Odoo Community Association (OCA)",
"website": "http://www.antiun.com",
Expand Down
6 changes: 6 additions & 0 deletions event_project/models/event_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ def write(self, vals):
if recalculate and not self.env.context.get('no_recalculate'):
self.project_id.project_recalculate()
return True

@api.multi
def button_cancel(self):
"""Cancel associated project when cancelling event."""
super(EventEvent, self).button_cancel()
self.mapped('project_id').set_cancel()
5 changes: 5 additions & 0 deletions event_project/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_event_project
24 changes: 24 additions & 0 deletions event_project/tests/test_event_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import fields
from openerp.tests import common


class TestEventProject(common.TransactionCase):
def setUp(self):
super(TestEventProject, self).setUp()
self.project = self.env['project.project'].create({
'name': 'Test project',
})
self.event = self.env['event.event'].create({
'name': 'Test event',
'date_begin': fields.Datetime.now(),
'date_end': fields.Datetime.now(),
'project_id': self.project.id,
})

def test_cancel_event(self):
self.event.button_cancel()
self.assertEqual(self.project.state, 'cancelled')

0 comments on commit bf6bbdb

Please sign in to comment.