This commit is contained in:
michel 2017-11-16 15:47:18 +01:00
parent 640ac54867
commit 3ec1260069
6 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Firstname Lastname <firstname.lastname@company.com>
#
# 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 <http://www.gnu.org/licenses/>.
{
'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']
}

View File

@ -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)

View File

@ -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'

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Action to open Coworkers list -->
<act_window id="event_action" name="Relation"
res_model="coworking.relation" view_mode="tree,form,calendar" />
<!-- Menu item to open Event list -->
<menuitem id="relation_menu" name="Relation" action="relation_action" />
</odoo>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form -->
<record id="view_form_relation" model="ir.ui.view">
<field name="name">Relation Form</field>
<field name="model">coworking.relation</field>
<field name="arch" type="xml">
<form string="relation">
</form>
</field>
</record>
</odoo>