[ADD]GOLEM Member creation from res.partner classic view + member visibility

This commit is contained in:
Fabien Bourgeois 2016-07-08 17:15:48 +02:00
parent 36f38ea444
commit 1eedf82ae7
5 changed files with 88 additions and 15 deletions

View File

@ -42,5 +42,6 @@
'web_widget_url_check',
'golem_season'],
'data': ['views/golem_member_view.xml', 'views/members_menu.xml',
'views/number_config.xml', 'data/number_config.xml']
'views/res_partner_view.xml', 'views/number_config.xml',
'data/number_config.xml']
}

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-08 13:59+0000\n"
"PO-Revision-Date: 2016-07-08 13:59+0000\n"
"POT-Creation-Date: 2016-07-08 15:02+0000\n"
"PO-Revision-Date: 2016-07-08 15:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -210,6 +210,11 @@ msgstr "Contrats"
msgid "Country"
msgstr "Pays"
#. module: golem_member
#: view:res.partner:golem_member.member_add
msgid "Create a GOLEM member from this contact"
msgstr "Créer un adhérent GOLEM depuis cette personne"
#. module: golem_member
#: field:golem.member,create_uid:0
#: field:golem.member.number,create_uid:0
@ -343,7 +348,9 @@ msgid "Free Member"
msgstr "Free Member"
#. module: golem_member
#: field:golem.member,member_id:0
#: model:ir.model,name:golem_member.model_golem_member
#: field:res.partner,member_id:0
msgid "GOLEM Member"
msgstr "GOLEM : adhérent"
@ -601,8 +608,8 @@ msgid "Nationality"
msgstr "Nationalité"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:166
#: code:addons/golem_member/models/golem_member.py:169
#: code:addons/golem_member/models/golem_member.py:176
#: code:addons/golem_member/models/golem_member.py:179
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -890,7 +897,7 @@ msgid "This field holds the image used as avatar for this contact, limited to 10
msgstr "This field holds the image used as avatar for this contact, limited to 1024x1024px"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:62
#: code:addons/golem_member/models/golem_member.py:72
#: sql_constraint:golem.member:0
#, python-format
msgid "This member number has already been used."
@ -987,8 +994,8 @@ msgid "Website of Partner or Company"
msgstr "Website of Partner or Company"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:166
#: code:addons/golem_member/models/golem_member.py:169
#: code:addons/golem_member/models/golem_member.py:176
#: code:addons/golem_member/models/golem_member.py:179
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-08 13:59+0000\n"
"PO-Revision-Date: 2016-07-08 13:59+0000\n"
"POT-Creation-Date: 2016-07-08 15:02+0000\n"
"PO-Revision-Date: 2016-07-08 15:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -209,6 +209,11 @@ msgstr ""
msgid "Country"
msgstr ""
#. module: golem_member
#: view:res.partner:golem_member.member_add
msgid "Create a GOLEM member from this contact"
msgstr ""
#. module: golem_member
#: field:golem.member,create_uid:0
#: field:golem.member.number,create_uid:0
@ -342,7 +347,9 @@ msgid "Free Member"
msgstr ""
#. module: golem_member
#: field:golem.member,member_id:0
#: model:ir.model,name:golem_member.model_golem_member
#: field:res.partner,member_id:0
msgid "GOLEM Member"
msgstr ""
@ -592,8 +599,8 @@ msgid "Nationality"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:166
#: code:addons/golem_member/models/golem_member.py:169
#: code:addons/golem_member/models/golem_member.py:176
#: code:addons/golem_member/models/golem_member.py:179
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -879,7 +886,7 @@ msgid "This field holds the image used as avatar for this contact, limited to 10
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:62
#: code:addons/golem_member/models/golem_member.py:72
#: sql_constraint:golem.member:0
#, python-format
msgid "This member number has already been used."
@ -976,8 +983,8 @@ msgid "Website of Partner or Company"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:166
#: code:addons/golem_member/models/golem_member.py:169
#: code:addons/golem_member/models/golem_member.py:176
#: code:addons/golem_member/models/golem_member.py:179
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format

View File

@ -29,6 +29,16 @@ class ResPartner(models.Model):
# Gender overwriting : no need for 'other' choice
gender = fields.Selection([('male', _('Male')), ('female', _('Female'))])
member_id = fields.One2many('golem.member', 'partner_id', 'GOLEM Member',
readonly=True)
@api.multi
def create_golem_member(self):
self.ensure_one()
gm = self.env['golem.member']
gm.create({'partner_id': self.id})
return True
class GolemMember(models.Model):
_name = 'golem.member'

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 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/>.
-->
<openerp>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="member_add">
<field name="name">Add information on linked member or member creation into main form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<h1 position="after">
<label for="member_id"
attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '=', False)]}" />
<field name="member_id" widget="many2one" readonly="True"
attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '=', False)]}" />
<button type="object" name="create_golem_member"
string="Create a GOLEM member from this contact"
attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '!=', False)]}" />
</h1>
</field>
</record>
<!-- Trees -->
<!-- Searches -->
</data>
</openerp>