[REF][IMP]GOLEM PreCreation : now from submenu on member module

This commit is contained in:
Fabien BOURGEOIS 2018-03-27 16:00:07 +02:00
parent 671cb68b86
commit f3e45b885d
7 changed files with 27 additions and 119 deletions

View File

@ -19,15 +19,14 @@
{
'name': 'GOLEM Pre-creation search member',
'summary': 'Pre-creation search member',
'version': '10.0.0.0.0',
'version': '10.0.0.1.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El ouahby',
'license': 'AGPL-3',
'application': True,
'application': False,
'installable': True,
'depends': ['golem_member', 'golem_family'],
'data': ['views/golem_member_views.xml',
'views/partner_views.xml',
'depends': ['golem_member'],
'data': ['views/golem_precreation_partner_menu.xml',
'wizard/golem_precreation_member_request_wizard_views.xml',
'wizard/golem_precreation_member_result_wizard_views.xml']
}

View File

@ -16,4 +16,4 @@
# 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/>.
from . import golem_member, res_partner
from . import res_partner

View File

@ -1,55 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.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/>.
""" GOLEM Members """
from odoo import models, api, _
class GolemMember(models.Model):
""" GOLEM Member model """
_inherit = 'golem.member'
@api.multi
def precreation_search(self):
""" Precreation member search """
self.ensure_one()
return {
'name' : _('Please enter member searched'),
'type' : 'ir.actions.act_window',
'res_model' : 'golem.precreation.member.request.wizard',
'context' : {'default_is_member' : True},
'view_mode': 'form',
'target': 'new'
}
@api.multi
def open_line(self):
""" open member form """
self.ensure_one()
return {
'type': 'ir.actions.act_window',
'name': 'Member',
'view_type': 'form',
'view_mode': 'form',
'res_model': self._name,
'res_id': self.id,
'flags': {'initial_mode': 'edit'},
'target': 'current',
}

View File

@ -18,11 +18,9 @@
""" GOLEM Contact """
from odoo import models, api, _
class GolemMember(models.Model):
class ResPartner(models.Model):
""" Res Partner extention """
_inherit = 'res.partner'
@ -37,9 +35,10 @@ class GolemMember(models.Model):
'view_mode': 'form',
'target': 'new'
}
@api.multi
def open_line(self):
""" open contact form """
def navigate_to_contact(self):
""" Navigates to contact form, in edit mode """
self.ensure_one()
return {
'type': 'ir.actions.act_window',
@ -47,7 +46,7 @@ class GolemMember(models.Model):
'view_type': 'form',
'view_mode': 'form',
'res_model': self._name,
'res_id': self.id,
'res_id': self[0].id,
'flags': {'initial_mode': 'edit'},
'target': 'current',
'target': 'current'
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
Copyright 2018 Fabien Bourgeois <fabien@yaltik.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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record id="golem_member_precreation_extention_form" model="ir.ui.view">
<field name="name">GOLEM Member Precreation extention Form</field>
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<button name="precreation_search" type="object" string="Pre-creation search" class="oe_highlight"/>
</header>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@ -19,18 +19,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<odoo>
<data>
<!-- Forms -->
<record id="res_partner_precreation_extention_form" model="ir.ui.view">
<field name="name">Res Partner Precreation extention Form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<button name="precreation_search" type="object" string="Pre-creation search" class="oe_highlight"/>
</header>
</xpath>
</field>
</record>
<!-- Actions -->
<act_window id="golem_precreation_member_request_action"
name="Pre-creation contact search"
res_model="golem.precreation.member.request.wizard"
view_mode="form" target="new" />
<!-- Menus -->
<menuitem id="golem_precreation_member_request_menu"
name="Pre-creation contact search"
parent="golem_member.golem_member_tool_menu" sequence="10"
action="golem_precreation_member_request_action"
groups="golem_base.group_golem_user" />
</data>
</odoo>

View File

@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="firstname"/>
<field name="lastname"/>
<field name="email"/>
<button name="open_line" type="object" icon="fa fa-external-link" />
<button name="navigate_to_contact" type="object" icon="fa fa-external-link" />
</tree>
</field>
<field name="contact_ids" readonly="1"
@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="firstname"/>
<field name="lastname"/>
<field name="email"/>
<button name="open_line" type="object" icon="fa fa-external-link" />
<button name="navigate_to_contact" type="object" icon="fa fa-external-link" />
</tree>
</field>
<footer>