diff --git a/golem_member_precreation_search/__manifest__.py b/golem_member_precreation_search/__manifest__.py
index e385fe5..492e66d 100644
--- a/golem_member_precreation_search/__manifest__.py
+++ b/golem_member_precreation_search/__manifest__.py
@@ -19,7 +19,7 @@
{
'name': 'GOLEM Pre-creation search member',
'summary': 'Pre-creation search member',
- 'version': '10.0.0.1.0',
+ 'version': '10.0.0.2.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El ouahby',
'license': 'AGPL-3',
@@ -27,6 +27,5 @@
'installable': True,
'depends': ['golem_member'],
'data': ['views/golem_member_precreation_search_menu.xml',
- 'wizard/golem_member_precreation_search_views.xml',
- 'wizard/golem_precreation_member_result_wizard_views.xml']
+ 'wizard/golem_member_precreation_search_views.xml']
}
diff --git a/golem_member_precreation_search/models/__init__.py b/golem_member_precreation_search/models/__init__.py
index 70d4d12..368a20b 100644
--- a/golem_member_precreation_search/models/__init__.py
+++ b/golem_member_precreation_search/models/__init__.py
@@ -16,4 +16,4 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from . import res_partner
+from . import res_partner, golem_member
diff --git a/golem_member_precreation_search/models/golem_member.py b/golem_member_precreation_search/models/golem_member.py
new file mode 100644
index 0000000..760dfcf
--- /dev/null
+++ b/golem_member_precreation_search/models/golem_member.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2018 Youssef El Ouahby
+# Copyright 2018 Fabien Bourgeois
+#
+# 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 .
+
+""" GOLEM Member adaptations """
+
+from odoo import models, api, _
+
+class GolemMember(models.Model):
+ """ GOLEM Member extention """
+ _inherit = 'golem.member'
+
+ @api.multi
+ def navigate_to_contact(self):
+ """ Navigates to member form, in edit mode """
+ self.ensure_one()
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Member',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': self._name,
+ 'res_id': self[0].id,
+ 'flags': {'initial_mode': 'edit'},
+ 'target': 'current'
+ }
diff --git a/golem_member_precreation_search/models/res_partner.py b/golem_member_precreation_search/models/res_partner.py
index 852c03d..161f70e 100644
--- a/golem_member_precreation_search/models/res_partner.py
+++ b/golem_member_precreation_search/models/res_partner.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-""" GOLEM Contact """
+""" Partner adaptations """
from odoo import models, api, _
diff --git a/golem_member_precreation_search/views/golem_member_precreation_search_menu.xml b/golem_member_precreation_search/views/golem_member_precreation_search_menu.xml
index c991059..25e3403 100644
--- a/golem_member_precreation_search/views/golem_member_precreation_search_menu.xml
+++ b/golem_member_precreation_search/views/golem_member_precreation_search_menu.xml
@@ -21,16 +21,16 @@ along with this program. If not, see .
-
-
diff --git a/golem_member_precreation_search/wizard/__init__.py b/golem_member_precreation_search/wizard/__init__.py
index bb98997..5dd0480 100644
--- a/golem_member_precreation_search/wizard/__init__.py
+++ b/golem_member_precreation_search/wizard/__init__.py
@@ -16,4 +16,4 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from . import golem_member_precreation_search, golem_precreation_member_result_wizard
+from . import golem_member_precreation_search
diff --git a/golem_member_precreation_search/wizard/golem_member_precreation_search.py b/golem_member_precreation_search/wizard/golem_member_precreation_search.py
index 8fd1509..d9d0f8f 100644
--- a/golem_member_precreation_search/wizard/golem_member_precreation_search.py
+++ b/golem_member_precreation_search/wizard/golem_member_precreation_search.py
@@ -17,40 +17,50 @@
# along with this program. If not, see .
""" GOLEM Precreation Member Request wizard"""
-from odoo import models, fields, api
+import logging
+from odoo import models, fields, api, _
+_LOGGER = logging.getLogger(__name__)
class GolemPrecreationMemberRequestWizard(models.TransientModel):
"""GOLEM Precreation Request Member Wizard """
- _name = "golem.precreation.member.request.wizard"
+ _name = 'golem.member.precreation.search'
- name = fields.Char()
- is_member = fields.Boolean()
+ state = fields.Selection([('init', 'Init'), ('final', 'Final')],
+ default='init')
+ keyword = fields.Char(required=True)
+ member_ids = fields.Many2many('golem.member', string='Members')
+ contact_ids = fields.Many2many('res.partner', string='Contacts')
@api.multi
- def search_members(self):
- """ Search members """
+ def action(self):
+ """ Return same wizard window """
self.ensure_one()
- model = self._context.get('model')
- domain = ['|',
- ('name', 'ilike', self.name),
- ('email', 'ilike', self.name)]
- members = self.env[model].search(domain)
- ids = []
- if members:
- ids = members.mapped('id')
- title = ""
- context = {}
- if self.is_member:
- title = 'Member search result "{}"'.format(self.name)
- context = {'default_member_ids': ids}
- else:
- title = 'Contact search result "{}"'.format(self.name)
- context = {'default_contact_ids': ids}
-
- return {'name' : (title),
+ _LOGGER.warning(self[0].contact_ids)
+ _LOGGER.warning(self[0].member_ids)
+ return {'name' : _('Search results'),
'type' : 'ir.actions.act_window',
- 'res_model' : 'golem.precreation.member.result.wizard',
- 'context': context,
+ 'res_model' : self._name,
+ 'res_id': self[0].id,
'view_mode': 'form',
- 'flags': {'initial_mode': 'view'},
'target': 'new'}
+
+ @api.multi
+ def new_search(self):
+ """ New search """
+ self[0].write({'member_ids': [(6, False, [])],
+ 'contact_ids': [(6, False, [])],
+ 'state': 'init'})
+ return self[0].action()
+
+ @api.multi
+ def search_partners(self):
+ """ Search partners """
+ self.ensure_one()
+ domain = ['|',
+ ('name', 'ilike', self[0].keyword),
+ ('email', 'ilike', self[0].keyword)]
+ partner_ids = self.env['res.partner'].search(domain)
+ self[0].write({'contact_ids': [(6, False, partner_ids.ids)],
+ 'member_ids': [(6, False, partner_ids.mapped('member_id').ids)],
+ 'state': 'final'})
+ return self[0].action()
diff --git a/golem_member_precreation_search/wizard/golem_member_precreation_search_views.xml b/golem_member_precreation_search/wizard/golem_member_precreation_search_views.xml
index 0cadcd7..2de8318 100644
--- a/golem_member_precreation_search/wizard/golem_member_precreation_search_views.xml
+++ b/golem_member_precreation_search/wizard/golem_member_precreation_search_views.xml
@@ -18,26 +18,57 @@ along with this program. If not, see .
-->
-
- Golem Precreation Member Request Wizard Form
- golem.precreation.member.request.wizard
+
+
+ GOLEM Member Precreation Search Form
+ golem.member.precreation.search
-
+
diff --git a/golem_member_precreation_search/wizard/golem_precreation_member_result_wizard_views.xml b/golem_member_precreation_search/wizard/golem_precreation_member_result_wizard_views.xml
index ffbe4ef..73de5fc 100644
--- a/golem_member_precreation_search/wizard/golem_precreation_member_result_wizard_views.xml
+++ b/golem_member_precreation_search/wizard/golem_precreation_member_result_wizard_views.xml
@@ -18,6 +18,7 @@ along with this program. If not, see .
-->
+
Golem Precreation Member result Wizard Formgolem.precreation.member.result.wizard
@@ -51,5 +52,6 @@ along with this program. If not, see .
+