From 7ac77e376206bd523bdb4b579d569d188a43e161 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 15 Nov 2017 15:32:42 +0100 Subject: [PATCH 1/4] [REF]Cleaning title / name tests --- models/event.py | 2 +- views/event_views.xml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/models/event.py b/models/event.py index e928ad3..2e08134 100644 --- a/models/event.py +++ b/models/event.py @@ -10,10 +10,10 @@ class Event(models.Model): """ Event model """ _name = 'coworking.event' _description = 'Event model definition' + _rec_name = 'title' _order = 'id asc' title = fields.Char(required=True) - _rec_name = 'title' manager_id = fields.Many2one('coworking.coworker', 'Manager', index=True, required=True, domain="[('coworker_type', 'in', ['staffer', 'member'])]") diff --git a/views/event_views.xml b/views/event_views.xml index 42f4497..e409b53 100644 --- a/views/event_views.xml +++ b/views/event_views.xml @@ -31,7 +31,7 @@ - event Tree + event Tree coworking.event @@ -46,7 +46,7 @@ - Event Search + Event Search coworking.event @@ -83,11 +83,11 @@ - Event Calendar + Event Calendar coworking.event + display="[title]" > From c8f398e91356e16b302edfeef55c6c1bf4ce2c0d Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 15 Nov 2017 15:38:15 +0100 Subject: [PATCH 2/4] [REF]Double _rec_name after merging --- models/event.py | 1 - 1 file changed, 1 deletion(-) diff --git a/models/event.py b/models/event.py index 7b15dc3..2e08134 100644 --- a/models/event.py +++ b/models/event.py @@ -12,7 +12,6 @@ class Event(models.Model): _description = 'Event model definition' _rec_name = 'title' _order = 'id asc' - _rec_name = 'title' title = fields.Char(required=True) From 6601bed446150fcf17d1768058eeaac518b60431 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 15 Nov 2017 15:42:41 +0100 Subject: [PATCH 3/4] [REF][WIP]Modularisation basic structure --- __init__.py => coworking_app/__init__.py | 0 .../__manifest__.py | 0 coworking_base/__init__.py | 3 ++ coworking_base/__manifest__.py | 31 +++++++++++++++++++ coworking_coworker/__init__.py | 3 ++ coworking_coworker/__manifest__.py | 31 +++++++++++++++++++ .../models}/__init__.py | 0 .../models}/coworker.py | 0 .../security}/ir.model.access.csv | 0 .../views}/coworker_views.xml | 0 .../views}/coworking_menu.xml | 0 coworking_event/__init__.py | 3 ++ coworking_event/__manifest__.py | 31 +++++++++++++++++++ coworking_event/models/__init__.py | 4 +++ {models => coworking_event/models}/event.py | 0 coworking_event/security/ir.model.access.csv | 4 +++ .../views}/event_menu.xml | 0 .../views}/event_views.xml | 0 18 files changed, 110 insertions(+) rename __init__.py => coworking_app/__init__.py (100%) rename __manifest__.py => coworking_app/__manifest__.py (100%) create mode 100644 coworking_base/__init__.py create mode 100644 coworking_base/__manifest__.py create mode 100644 coworking_coworker/__init__.py create mode 100644 coworking_coworker/__manifest__.py rename {models => coworking_coworker/models}/__init__.py (100%) rename {models => coworking_coworker/models}/coworker.py (100%) rename {security => coworking_coworker/security}/ir.model.access.csv (100%) rename {views => coworking_coworker/views}/coworker_views.xml (100%) rename {views => coworking_coworker/views}/coworking_menu.xml (100%) create mode 100644 coworking_event/__init__.py create mode 100644 coworking_event/__manifest__.py create mode 100644 coworking_event/models/__init__.py rename {models => coworking_event/models}/event.py (100%) create mode 100644 coworking_event/security/ir.model.access.csv rename {views => coworking_event/views}/event_menu.xml (100%) rename {views => coworking_event/views}/event_views.xml (100%) diff --git a/__init__.py b/coworking_app/__init__.py similarity index 100% rename from __init__.py rename to coworking_app/__init__.py diff --git a/__manifest__.py b/coworking_app/__manifest__.py similarity index 100% rename from __manifest__.py rename to coworking_app/__manifest__.py diff --git a/coworking_base/__init__.py b/coworking_base/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/coworking_base/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/coworking_base/__manifest__.py b/coworking_base/__manifest__.py new file mode 100644 index 0000000..87c735d --- /dev/null +++ b/coworking_base/__manifest__.py @@ -0,0 +1,31 @@ +# -*- 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', + 'summary': 'yaltik coworking module simplify your coworking gerance', + 'description': """ yaltik coworking module simplify your coworking gerance """, + 'version': '10.0.0.0.1', + 'category': 'Useless', + 'author': 'Yaltik', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', + 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], + 'depends': ['base'] +} diff --git a/coworking_coworker/__init__.py b/coworking_coworker/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/coworking_coworker/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/coworking_coworker/__manifest__.py b/coworking_coworker/__manifest__.py new file mode 100644 index 0000000..87c735d --- /dev/null +++ b/coworking_coworker/__manifest__.py @@ -0,0 +1,31 @@ +# -*- 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', + 'summary': 'yaltik coworking module simplify your coworking gerance', + 'description': """ yaltik coworking module simplify your coworking gerance """, + 'version': '10.0.0.0.1', + 'category': 'Useless', + 'author': 'Yaltik', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', + 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], + 'depends': ['base'] +} diff --git a/models/__init__.py b/coworking_coworker/models/__init__.py similarity index 100% rename from models/__init__.py rename to coworking_coworker/models/__init__.py diff --git a/models/coworker.py b/coworking_coworker/models/coworker.py similarity index 100% rename from models/coworker.py rename to coworking_coworker/models/coworker.py diff --git a/security/ir.model.access.csv b/coworking_coworker/security/ir.model.access.csv similarity index 100% rename from security/ir.model.access.csv rename to coworking_coworker/security/ir.model.access.csv diff --git a/views/coworker_views.xml b/coworking_coworker/views/coworker_views.xml similarity index 100% rename from views/coworker_views.xml rename to coworking_coworker/views/coworker_views.xml diff --git a/views/coworking_menu.xml b/coworking_coworker/views/coworking_menu.xml similarity index 100% rename from views/coworking_menu.xml rename to coworking_coworker/views/coworking_menu.xml diff --git a/coworking_event/__init__.py b/coworking_event/__init__.py new file mode 100644 index 0000000..cde864b --- /dev/null +++ b/coworking_event/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/coworking_event/__manifest__.py b/coworking_event/__manifest__.py new file mode 100644 index 0000000..87c735d --- /dev/null +++ b/coworking_event/__manifest__.py @@ -0,0 +1,31 @@ +# -*- 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', + 'summary': 'yaltik coworking module simplify your coworking gerance', + 'description': """ yaltik coworking module simplify your coworking gerance """, + 'version': '10.0.0.0.1', + 'category': 'Useless', + 'author': 'Yaltik', + 'license': 'AGPL-3', + 'application': False, + 'installable': True, + 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', + 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], + 'depends': ['base'] +} diff --git a/coworking_event/models/__init__.py b/coworking_event/models/__init__.py new file mode 100644 index 0000000..7f37d89 --- /dev/null +++ b/coworking_event/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +"""dd""" +from . import coworker +from . import event diff --git a/models/event.py b/coworking_event/models/event.py similarity index 100% rename from models/event.py rename to coworking_event/models/event.py diff --git a/coworking_event/security/ir.model.access.csv b/coworking_event/security/ir.model.access.csv new file mode 100644 index 0000000..7b1f30b --- /dev/null +++ b/coworking_event/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +acess_coworker_group_user,Access COWORKER Member User,model_coworking_coworker,base.group_user,1,1,1,0 +acess_coworker_group_manager,Access COWORKER Member Manager,model_coworking_coworker,base.group_partner_manager,1,1,1,1 +acess_coworker_group_user,Access COWORKER Member User,model_coworking_event,base.group_user,1,1,1,1 diff --git a/views/event_menu.xml b/coworking_event/views/event_menu.xml similarity index 100% rename from views/event_menu.xml rename to coworking_event/views/event_menu.xml diff --git a/views/event_views.xml b/coworking_event/views/event_views.xml similarity index 100% rename from views/event_views.xml rename to coworking_event/views/event_views.xml From e99374796bfa4a3af5eb0a4ddab1939cbcc3d1f1 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 15 Nov 2017 16:00:24 +0100 Subject: [PATCH 4/4] [REF]Global modularisation refactoring, end --- coworking_app/__init__.py | 2 -- coworking_app/__manifest__.py | 11 ++++----- coworking_base/__init__.py | 2 -- coworking_base/__manifest__.py | 6 ++--- coworking_coworker/__manifest__.py | 11 +++++---- coworking_coworker/models/__init__.py | 2 -- coworking_coworker/models/coworker.py | 16 ------------- .../security/ir.model.access.csv | 1 - coworking_coworker/views/coworker_views.xml | 8 ------- coworking_event/__manifest__.py | 12 ++++++---- coworking_event/models/__init__.py | 3 +-- coworking_event/models/coworker.py | 22 +++++++++++++++++ coworking_event/security/ir.model.access.csv | 2 -- coworking_event/views/coworker_views.xml | 24 +++++++++++++++++++ 14 files changed, 67 insertions(+), 55 deletions(-) create mode 100644 coworking_event/models/coworker.py create mode 100644 coworking_event/views/coworker_views.xml diff --git a/coworking_app/__init__.py b/coworking_app/__init__.py index cde864b..40a96af 100644 --- a/coworking_app/__init__.py +++ b/coworking_app/__init__.py @@ -1,3 +1 @@ # -*- coding: utf-8 -*- - -from . import models diff --git a/coworking_app/__manifest__.py b/coworking_app/__manifest__.py index 87c735d..3a363af 100644 --- a/coworking_app/__manifest__.py +++ b/coworking_app/__manifest__.py @@ -16,16 +16,15 @@ # along with this program. If not, see . { - 'name': 'Coworking', + 'name': 'Coworking whole Application', 'summary': 'yaltik coworking module simplify your coworking gerance', 'description': """ yaltik coworking module simplify your coworking gerance """, 'version': '10.0.0.0.1', - 'category': 'Useless', + 'category': 'Coworking', 'author': 'Yaltik', 'license': 'AGPL-3', - 'application': False, + 'application': True, 'installable': True, - 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', - 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], - 'depends': ['base'] + 'data': [], + 'depends': ['coworking_coworker', 'coworking_event'] } diff --git a/coworking_base/__init__.py b/coworking_base/__init__.py index cde864b..40a96af 100644 --- a/coworking_base/__init__.py +++ b/coworking_base/__init__.py @@ -1,3 +1 @@ # -*- coding: utf-8 -*- - -from . import models diff --git a/coworking_base/__manifest__.py b/coworking_base/__manifest__.py index 87c735d..868b689 100644 --- a/coworking_base/__manifest__.py +++ b/coworking_base/__manifest__.py @@ -16,16 +16,14 @@ # along with this program. If not, see . { - 'name': 'Coworking', + 'name': 'Coworking base', 'summary': 'yaltik coworking module simplify your coworking gerance', 'description': """ yaltik coworking module simplify your coworking gerance """, 'version': '10.0.0.0.1', - 'category': 'Useless', + 'category': 'Coworking', 'author': 'Yaltik', 'license': 'AGPL-3', 'application': False, 'installable': True, - 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', - 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], 'depends': ['base'] } diff --git a/coworking_coworker/__manifest__.py b/coworking_coworker/__manifest__.py index 87c735d..5050e10 100644 --- a/coworking_coworker/__manifest__.py +++ b/coworking_coworker/__manifest__.py @@ -16,16 +16,17 @@ # along with this program. If not, see . { - 'name': 'Coworking', + 'name': 'Coworking coworker', 'summary': 'yaltik coworking module simplify your coworking gerance', 'description': """ yaltik coworking module simplify your coworking gerance """, 'version': '10.0.0.0.1', - 'category': 'Useless', + 'category': 'Coworking', 'author': 'Yaltik', 'license': 'AGPL-3', 'application': False, 'installable': True, - 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', - 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], - 'depends': ['base'] + 'data': ['security/ir.model.access.csv', + 'views/coworking_menu.xml', + 'views/coworker_views.xml'], + 'depends': ['coworking_base'] } diff --git a/coworking_coworker/models/__init__.py b/coworking_coworker/models/__init__.py index 7f37d89..4e351f4 100644 --- a/coworking_coworker/models/__init__.py +++ b/coworking_coworker/models/__init__.py @@ -1,4 +1,2 @@ # -*- coding: utf-8 -*- -"""dd""" from . import coworker -from . import event diff --git a/coworking_coworker/models/coworker.py b/coworking_coworker/models/coworker.py index 87e0b63..7852413 100644 --- a/coworking_coworker/models/coworker.py +++ b/coworking_coworker/models/coworker.py @@ -42,22 +42,6 @@ class Coworker(models.Model): is_done = fields.Boolean('Done?') is_active = fields.Boolean('Active?', default=True) -# Event fields - 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) - - @api.depends('name', 'firstname') def _compute_full_name(self): """Concaténation du nom et du prénom""" diff --git a/coworking_coworker/security/ir.model.access.csv b/coworking_coworker/security/ir.model.access.csv index 7b1f30b..89f9993 100644 --- a/coworking_coworker/security/ir.model.access.csv +++ b/coworking_coworker/security/ir.model.access.csv @@ -1,4 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink acess_coworker_group_user,Access COWORKER Member User,model_coworking_coworker,base.group_user,1,1,1,0 acess_coworker_group_manager,Access COWORKER Member Manager,model_coworking_coworker,base.group_partner_manager,1,1,1,1 -acess_coworker_group_user,Access COWORKER Member User,model_coworking_event,base.group_user,1,1,1,1 diff --git a/coworking_coworker/views/coworker_views.xml b/coworking_coworker/views/coworker_views.xml index 91ff0bd..69024f4 100644 --- a/coworking_coworker/views/coworker_views.xml +++ b/coworking_coworker/views/coworker_views.xml @@ -37,14 +37,6 @@ - - - - - - - diff --git a/coworking_event/__manifest__.py b/coworking_event/__manifest__.py index 87c735d..3d9e548 100644 --- a/coworking_event/__manifest__.py +++ b/coworking_event/__manifest__.py @@ -16,16 +16,18 @@ # along with this program. If not, see . { - 'name': 'Coworking', + 'name': 'Coworking event', 'summary': 'yaltik coworking module simplify your coworking gerance', 'description': """ yaltik coworking module simplify your coworking gerance """, 'version': '10.0.0.0.1', - 'category': 'Useless', + 'category': 'Coworking', 'author': 'Yaltik', 'license': 'AGPL-3', 'application': False, 'installable': True, - 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', - 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'], - 'depends': ['base'] + 'data': ['security/ir.model.access.csv', + 'views/event_menu.xml', + 'views/event_views.xml', + 'views/coworker_views.xml'], + 'depends': ['coworking_coworker'] } diff --git a/coworking_event/models/__init__.py b/coworking_event/models/__init__.py index 7f37d89..e57763e 100644 --- a/coworking_event/models/__init__.py +++ b/coworking_event/models/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- """dd""" -from . import coworker -from . import event +from . import event, coworker diff --git a/coworking_event/models/coworker.py b/coworking_event/models/coworker.py new file mode 100644 index 0000000..f556f3d --- /dev/null +++ b/coworking_event/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_event/security/ir.model.access.csv b/coworking_event/security/ir.model.access.csv index 7b1f30b..8996eec 100644 --- a/coworking_event/security/ir.model.access.csv +++ b/coworking_event/security/ir.model.access.csv @@ -1,4 +1,2 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -acess_coworker_group_user,Access COWORKER Member User,model_coworking_coworker,base.group_user,1,1,1,0 -acess_coworker_group_manager,Access COWORKER Member Manager,model_coworking_coworker,base.group_partner_manager,1,1,1,1 acess_coworker_group_user,Access COWORKER Member User,model_coworking_event,base.group_user,1,1,1,1 diff --git a/coworking_event/views/coworker_views.xml b/coworking_event/views/coworker_views.xml new file mode 100644 index 0000000..68f5668 --- /dev/null +++ b/coworking_event/views/coworker_views.xml @@ -0,0 +1,24 @@ + + + + + + + Coworker Form adaptations + coworking.coworker + + + + + + + + + + + + + + +