[FIX]GOLEM Member : better naming and res.partner form fix

This commit is contained in:
Fabien BOURGEOIS 2018-07-18 11:18:28 +02:00
parent fa94b26859
commit 81f2b0d03b
3 changed files with 11 additions and 8 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit members', 'name': 'GOLEM non-profit members',
'summary': 'Extends Odoo contacts for MJC', 'summary': 'Extends Odoo contacts for MJC',
'description': 'Extends Odoo contacts for MJC', 'description': 'Extends Odoo contacts for MJC',
'version': '10.0.1.2.1', 'version': '10.0.1.2.2',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -118,10 +118,12 @@ class GolemMember(models.Model):
def _compute_number_name(self): def _compute_number_name(self):
""" Computes a name composed with number and name """ """ Computes a name composed with number and name """
for member in self: for member in self:
vals = []
if member.number:
vals.append(member.number)
if member.name: if member.name:
member.number_name = u'{} - {}'.format(member.number, member.name) vals.append(member.name)
else: member.number_name = u' - '.join(vals)
member.number_name = u''
@api.depends('season_ids') @api.depends('season_ids')
def _compute_is_current(self): def _compute_is_current(self):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com> Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Affero General Public License as published by
@ -31,18 +31,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
style="background-color: #ccc; color: #fff; font-size: 150%; font-weight: bold; padding: 0.5%; text-align: center; margin-bottom: 1%;">Contact form</div> style="background-color: #ccc; color: #fff; font-size: 150%; font-weight: bold; padding: 0.5%; text-align: center; margin-bottom: 1%;">Contact form</div>
</div> </div>
<h1 position="after"> <h1 position="after">
<field name="is_member" invisible="1" />
<label for="member_id" <label for="member_id"
attrs="{'invisible': ['|', ('is_company', '=', True), attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '=', False)]}" /> ('is_member', '=', False)]}" />
<field name="member_id" invisible="1" /> <field name="member_id" invisible="1" />
<button name="view_member" string="Go to member form" type="object" <button name="view_member" string="Go to member form" type="object"
class="oe_link" class="oe_link"
attrs="{'invisible': ['|', ('is_company', '=', True), attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '=', False)]}" /> ('is_member', '=', False)]}" />
<button type="object" name="create_golem_member" <button type="object" name="create_golem_member"
string="Create a GOLEM member from this contact" string="Create a GOLEM member from this contact"
attrs="{'invisible': ['|', ('is_company', '=', True), attrs="{'invisible': ['|', ('is_company', '=', True),
('member_id', '!=', False)]}" /> ('is_member', '!=', False)]}" />
</h1> </h1>
</field> </field>
</record> </record>