[IMP][REF]GOLEM Family : enhancements

* Allow partner selection from family members tab ;
* Allow family linking from new sevrice user, without mandatory save ;
* Fix UI for family tab ;
* Create a family from sevrice user through button on header.
This commit is contained in:
Fabien BOURGEOIS 2018-08-01 12:17:15 +02:00
parent d070acfbe0
commit 893bfcd79b
5 changed files with 89 additions and 81 deletions

View File

@ -19,7 +19,7 @@
'name': 'GOLEM families',
'summary': 'GOLEM Members Families',
'description': 'GOLEM Members Families',
'version': '10.0.2.2.4',
'version': '10.0.2.3.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-18 09:24+0000\n"
"PO-Revision-Date: 2018-03-18 09:24+0000\n"
"POT-Creation-Date: 2018-08-01 10:12+0000\n"
"PO-Revision-Date: 2018-08-01 12:15+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -38,14 +38,9 @@ msgstr "<strong>Pays</strong> :"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_card_template_inherit_golem_family
msgid "<strong>Family :</strong>"
msgid "<strong>Family </strong>"
msgstr "<strong>Famille :</strong>"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_card_template_inherit_golem_family
msgid "<strong>Role :</strong>"
msgstr "<strong>Role :</strong>"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_card_template
msgid "<strong>State</strong> :"
@ -98,9 +93,9 @@ msgid "Country"
msgstr "Pays"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_card_template
msgid "Country :"
msgstr "Pays :"
#: model:ir.ui.view,arch_db:golem_family.golem_member_form_inherit_golem_family
msgid "Create a new family"
msgstr "Créer une nouvelle famille"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_create_uid
@ -150,8 +145,8 @@ msgid "Family"
msgstr "Famille"
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:48
#: code:addons/golem_family/models/golem_family.py:82
#: code:addons/golem_family/models/golem_family.py:50
#: code:addons/golem_family/models/golem_family.py:84
#, python-format
msgid "Family Members"
msgstr "Membres de la famille"
@ -295,11 +290,6 @@ msgstr "Téléphone"
msgid "Phone :"
msgstr "Téléphone :"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_form_inherit_golem_family
msgid "Please save new member before assigning a family."
msgstr "Merci de sauvegarder la fiche du nouveau membre avant de pouvoir lui assigner une famille."
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Put an internal note..."

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-18 09:23+0000\n"
"PO-Revision-Date: 2018-03-18 09:23+0000\n"
"POT-Creation-Date: 2018-08-01 10:12+0000\n"
"PO-Revision-Date: 2018-08-01 10:12+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -38,12 +38,7 @@ msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_card_template_inherit_golem_family
msgid "<strong>Family :</strong>"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_card_template_inherit_golem_family
msgid "<strong>Role :</strong>"
msgid "<strong>Family </strong>"
msgstr ""
#. module: golem_family
@ -97,6 +92,11 @@ msgstr ""
msgid "Country"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_form_inherit_golem_family
msgid "Create a new family"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_family_create_uid
#: model:ir.model.fields,field_description:golem_family.field_golem_family_role_create_uid
@ -145,8 +145,8 @@ msgid "Family"
msgstr ""
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:48
#: code:addons/golem_family/models/golem_family.py:82
#: code:addons/golem_family/models/golem_family.py:50
#: code:addons/golem_family/models/golem_family.py:84
#, python-format
msgid "Family Members"
msgstr ""
@ -290,11 +290,6 @@ msgstr ""
msgid "Phone :"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_member_form_inherit_golem_family
msgid "Please save new member before assigning a family."
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Put an internal note..."

View File

@ -85,6 +85,33 @@ class GolemMember(models.Model):
'view_mode': 'form',
'res_id': member.family_id.id}
@api.multi
def create_family(self):
""" Create family from service user """
self.ensure_one()
member = self[0]
if member.family_id:
member.family_id = False
data = {'name': member.lastname,
'street': member.street,
'street2': member.street2,
'zip': member.zip,
'city': member.city,
'member_ids': [(4, member.partner_id.id, False)]}
self.env['golem.family'].create(data)
# self.family_id = new_family.id
@api.model
def create(self, values):
""" Handles family fields at creation """
family_id = values.get('family_id')
if family_id:
del values['family_id']
members = super(GolemMember, self).create(values)
if family_id:
members.mapped('partner_id').write({'family_id': family_id})
return members
class GolemFamily(models.Model):
""" GOLEM Family Entity """

View File

@ -25,64 +25,60 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="model">golem.member</field>
<field name="inherit_id" ref="golem_member.golem_member_form" />
<field name="arch" type="xml">
<header position="inside">
<button type="object" name="create_family" string="Create a new family"
attrs="{'invisible': ['|', ('id', '=', False), ('family_id', '!=', False)]}" />
</header>
<field name="lastname" position="before">
<field name="id" invisible="1" />
<field name="partner_id" invisible="1" required="0" />
<p class="oe_grey" colspan="2"
attrs="{'invisible': [('id', '!=', False)]}">
Please save new member before assigning a family.
</p>
<field name="family_id"
attrs="{'readonly': [('id', '=', False)]}"
context="{'default_member_ids': [(4, partner_id, False)]}" />
<field name="family_role"
attrs="{'readonly': [('id', '=', False)]}" />
options="{'no_create': True}" />
<field name="family_role" />
</field>
<page name="membership" position="before">
<page string="Family"
attrs="{'invisible': [('family_id', '=', False)]}">
<group>
<group string="Address">
<group>
<field name="family_street" placeholder="Street..." />
<field name="family_street2" />
<field name="family_zip" placeholder="ZIP" />
<field name="family_city" placeholder="City" />
</group>
<group>
<field name="family_state_id" class="oe_no_button"
placeholder="State" />
<field name="family_country_id" placeholder="Country"
class="oe_no_button" />
</group>
attrs="{'invisible': ['|', ('id', '=', False), ('family_id', '=', False)]}">
<group string="Address">
<group>
<field name="family_street" placeholder="Street..." />
<field name="family_street2" />
<field name="family_zip" placeholder="ZIP" />
<field name="family_city" placeholder="City" />
</group>
<group>
<field name="family_state_id" class="oe_no_button"
placeholder="State" />
<field name="family_country_id" placeholder="Country"
class="oe_no_button" />
</group>
</group>
<group string="Communication">
<group>
<field name="family_phone" placeholder="0000000000"
widget="phonefr" />
<field name="family_mobile" placeholder="0000000000"
widget="phonefr" />
</group>
<group>
<field name="family_email" widget="email"
placeholder="name@example.org" />
<field name="family_website" widget="url"
placeholder="e.g. www.odoo.com"/>
</group>
</group>
<group>
<group string="Communication">
<group>
<field name="family_phone" placeholder="0000000000"
widget="phonefr" />
<field name="family_mobile" placeholder="0000000000"
widget="phonefr" />
</group>
<group>
<field name="family_email" widget="email"
placeholder="name@example.org" />
<field name="family_website" widget="url"
placeholder="e.g. www.odoo.com"/>
</group>
</group>
<field name="family_member_ids" widget="many2many"
context="{'default_family_id': active_id}">
<tree delete="false" create="true" edit="true">
<field name="name" />
<field name="family_role" />
<field name="phone" />
<field name="mobile" />
<field name="email" widget="email" />
</tree>
</field>
</group>
<field name="family_member_ids"
context="{'default_family_id': active_id}">
<tree delete="false">
<field name="name" />
<field name="family_role" />
<field name="phone" />
<field name="mobile" />
<field name="email" widget="email" />
</tree>
</field>
</page>
</page>
</field>