diff --git a/coworking_relation/__init__.py b/coworking_relation/__init__.py index e69de29..cde864b 100644 --- a/coworking_relation/__init__.py +++ b/coworking_relation/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/coworking_relation/__manifest__.py b/coworking_relation/__manifest__.py index e69de29..a181477 100644 --- a/coworking_relation/__manifest__.py +++ b/coworking_relation/__manifest__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 Firstname Lastname +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +{ + 'name': 'Coworking relation', + 'summary': 'yaltik coworking module simplify your coworking gerance', + 'description': """ yaltik coworking module simplify your coworking gerance """, + 'version': '10.0.0.0.1', + 'category': 'Coworking', + 'author': 'Yaltik', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'data': ['security/ir.model.access.csv', + 'views/relation_menu.xml', + 'views/relation_views.xml', + 'views/coworker_views.xml'], + 'depends': ['coworking_coworker'] +} diff --git a/coworking_relation/models/coworker.py b/coworking_relation/models/coworker.py new file mode 100644 index 0000000..f556f3d --- /dev/null +++ b/coworking_relation/models/coworker.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +""" Coworker adaptations """ + +from odoo import models, fields, api + +class Coworker(models.Model): + """ Coworker adaptations """ + _inherit = 'coworking.coworker' + + manager_event_ids = fields.One2many('coworking.event', 'manager_id', + string='Events managed') + event_ids = fields.Many2many('coworking.event', string='Events visited') + + events_coworker_count = fields.Integer('Number of event have participe', + compute='_compute_events_coworker_count') + + @api.depends('event_ids') + def _compute_events_coworker_count(self): + """ Computes number of event coworker """ + for event in self: + event.events_coworker_count = len(event.event_ids) diff --git a/coworking_relation/models/relation.py b/coworking_relation/models/relation.py index e69de29..e3b8666 100644 --- a/coworking_relation/models/relation.py +++ b/coworking_relation/models/relation.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +""" Coworker relation """ + +from odoo import models, fields, api + +class CoworkerRelation(models.Model): + """Coworker relation model """ + _name = 'coworking.relation' + _description = 'relation model definition' + _order = 'id asc' diff --git a/coworking_relation/views/relation_menu.xml b/coworking_relation/views/relation_menu.xml index e69de29..5e83d45 100644 --- a/coworking_relation/views/relation_menu.xml +++ b/coworking_relation/views/relation_menu.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/coworking_relation/views/relation_views.xml b/coworking_relation/views/relation_views.xml index e69de29..6c9e8e3 100644 --- a/coworking_relation/views/relation_views.xml +++ b/coworking_relation/views/relation_views.xml @@ -0,0 +1,13 @@ + + + + + + Relation Form + coworking.relation + +
+
+
+
+