[ADD]GOLEM Family : add member family names and search on it

This commit is contained in:
Fabien BOURGEOIS 2021-01-14 15:45:58 +01:00
parent 301f88f537
commit c441499d9d
5 changed files with 37 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2020 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2016-2021 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
@ -19,7 +19,7 @@
'name': 'GOLEM families',
'summary': 'GOLEM Members Families',
'description': 'GOLEM Members Families',
'version': '10.0.2.5.1',
'version': '10.0.2.6.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Youssef El Ouahby',
'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-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 17:45+0200\n"
"POT-Creation-Date: 2021-01-14 14:45+0000\n"
"PO-Revision-Date: 2021-01-14 15:45+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -170,8 +170,8 @@ msgid "Family"
msgstr "Famille"
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:49
#: code:addons/golem_family/models/golem_family.py:83
#: code:addons/golem_family/models/golem_family.py:59
#: code:addons/golem_family/models/golem_family.py:93
#, python-format
msgid "Family Members"
msgstr "Membres de la famille"
@ -181,6 +181,13 @@ msgstr "Membres de la famille"
msgid "Family form"
msgstr "Fiche Famille"
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_member_family_member_names
#: model:ir.model.fields,field_description:golem_family.field_res_partner_family_member_names
#: model:ir.model.fields,field_description:golem_family.field_res_users_family_member_names
msgid "Family member names"
msgstr "Noms des membres de la famille"
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Family members"

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-10-26 15:44+0000\n"
"PO-Revision-Date: 2018-10-26 15:44+0000\n"
"POT-Creation-Date: 2021-01-14 14:45+0000\n"
"PO-Revision-Date: 2021-01-14 14:45+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -170,8 +170,8 @@ msgid "Family"
msgstr ""
#. module: golem_family
#: code:addons/golem_family/models/golem_family.py:49
#: code:addons/golem_family/models/golem_family.py:83
#: code:addons/golem_family/models/golem_family.py:59
#: code:addons/golem_family/models/golem_family.py:93
#, python-format
msgid "Family Members"
msgstr ""
@ -181,6 +181,13 @@ msgstr ""
msgid "Family form"
msgstr ""
#. module: golem_family
#: model:ir.model.fields,field_description:golem_family.field_golem_member_family_member_names
#: model:ir.model.fields,field_description:golem_family.field_res_partner_family_member_names
#: model:ir.model.fields,field_description:golem_family.field_res_users_family_member_names
msgid "Family member names"
msgstr ""
#. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Family members"

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2017-2021 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
@ -42,6 +42,16 @@ class ResPartner(models.Model):
index=True)
family_count = fields.Integer(related='family_id.count')
family_member_names = fields.Char(compute='_compute_family_member_names',
index=True, store=True)
@api.depends('family_id', 'family_id.member_ids')
def _compute_family_member_names(self):
""" Computes family member names, for search """
for member in self:
if member.family_id:
member.family_member_names = u', '.join(member.family_id.member_ids.mapped('name'))
@api.multi
def button_family_members(self):
""" Go to family view, from partner """

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
Copyright 2017-2021 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
@ -92,6 +92,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml">
<field name="name" position="after">
<field name="family_id" />
<field name="family_member_names" />
</field>
</field>
</record>