[REF][FIX]GOLEM Member : filters and age
* Age : do not use compute, as it evole from time to time ; * Fix area_id group by ; * Better places for new filters and searches.
This commit is contained in:
parent
9390ad88ce
commit
92370db734
@ -2,6 +2,7 @@
|
||||
|
||||
# Copyright 2016-2018 Fabien Bourgeois <fabien@yaltik.com>
|
||||
# Copyright 2018 Michel Dessenne <michel@yaltik.com>
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@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
|
||||
@ -20,7 +21,7 @@
|
||||
'name': 'GOLEM non-profit members',
|
||||
'summary': 'Extends Odoo contacts for MJC',
|
||||
'description': 'Extends Odoo contacts for MJC',
|
||||
'version': '10.0.2.4.0',
|
||||
'version': '10.0.2.5.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois, Michel Dessenne',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -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:43+0000\n"
|
||||
"PO-Revision-Date: 2018-10-26 17:47+0200\n"
|
||||
"POT-Creation-Date: 2018-11-01 15:15+0000\n"
|
||||
"PO-Revision-Date: 2018-11-01 16:21+0100\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -55,6 +55,18 @@ msgstr "Adresse"
|
||||
msgid "Address Type"
|
||||
msgstr "Type d'adresse"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_age
|
||||
#: model:ir.model.fields,field_description:golem_member.field_res_partner_age
|
||||
#: model:ir.model.fields,field_description:golem_member.field_res_users_age
|
||||
msgid "Age"
|
||||
msgstr "Age"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_animator_activity_ids
|
||||
msgid "Animated activities"
|
||||
msgstr "Animated activities"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.golem_member_numberconfig_form
|
||||
msgid "Apply and recompute all member numbers"
|
||||
@ -135,6 +147,11 @@ msgstr "Rebond"
|
||||
msgid "Buy Membership"
|
||||
msgstr "Payer une adhésion"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.l10n_fr_department_filter_inherit_golem_member
|
||||
msgid "By Area"
|
||||
msgstr "Par territoire"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.golem_member_search
|
||||
msgid "By age"
|
||||
@ -339,7 +356,7 @@ msgstr "Conditions de Paiement Client"
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_date
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
msgstr "Date "
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.golem_member_card_template
|
||||
@ -426,7 +443,7 @@ msgid "Fax"
|
||||
msgstr "Fax"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#: code:addons/golem_member/models/golem_member.py:127
|
||||
#, python-format
|
||||
msgid "Female"
|
||||
msgstr "Féminin"
|
||||
@ -498,7 +515,7 @@ msgid "GOLEM Members Tags"
|
||||
msgstr "Catégories d'adhérents"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:433
|
||||
#: code:addons/golem_member/models/golem_member.py:459
|
||||
#, python-format
|
||||
msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging."
|
||||
msgstr "La fusion d'adhérents n'a pas encore été implémentée. Merci de ne fusionner que des contacts non adhérents, ou bien de supprimer les adhérents manuellement en premier lieu."
|
||||
@ -597,6 +614,11 @@ msgstr "Facture"
|
||||
msgid "Invoices"
|
||||
msgstr "Factures"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.res_partner_search_inherit_golem_member
|
||||
msgid "Is Animator"
|
||||
msgstr "Intervenant"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.res_partner_search_inherit_golem_member
|
||||
msgid "Is Free Member"
|
||||
@ -732,7 +754,7 @@ msgid "Latest Invoices & Payments Matching Date"
|
||||
msgstr "Date de dernière correspondance des factures et paiements"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#: code:addons/golem_member/models/golem_member.py:126
|
||||
#, python-format
|
||||
msgid "Male"
|
||||
msgstr "Masculin"
|
||||
@ -838,14 +860,20 @@ msgid "Nationality"
|
||||
msgstr "Nationalité"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:373
|
||||
#: code:addons/golem_member/models/golem_member.py:376
|
||||
#: code:addons/golem_member/models/golem_member.py:399
|
||||
#: code:addons/golem_member/models/golem_member.py:402
|
||||
#: selection:golem.member.numberconfig,is_automatic:0
|
||||
#: selection:golem.member.numberconfig,is_per_season:0
|
||||
#, python-format
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:128
|
||||
#, python-format
|
||||
msgid "Not Disclosed"
|
||||
msgstr "Non communiqué"
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_comment
|
||||
msgid "Notes"
|
||||
@ -1202,7 +1230,7 @@ msgid "The name of official registry where this company was declared."
|
||||
msgstr "Nom de la ville du tribunal de commerce dans laquelle la société est enregistrée."
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:69
|
||||
#: code:addons/golem_member/models/golem_member.py:71
|
||||
#, python-format
|
||||
msgid "The parent area is a sub area of the current area, please change it."
|
||||
msgstr "Le territoire parent est un sous-territoire du territoire courant, merci de modifier vos saisies."
|
||||
@ -1243,14 +1271,14 @@ msgid "This field holds the image used as avatar for this contact, limited to 10
|
||||
msgstr "Ce champ contient l'image utilisée comme photo d'identité pour ce contact, limitée à 1024x1024px."
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:168
|
||||
#: code:addons/golem_member/models/golem_member.py:194
|
||||
#: sql_constraint:golem.member:0
|
||||
#, python-format
|
||||
msgid "This member number has already been used."
|
||||
msgstr "Ce numéro d'adhérent a été déjà utilisé."
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:47
|
||||
#: code:addons/golem_member/models/golem_member.py:49
|
||||
#: sql_constraint:golem.partner.area:0
|
||||
#, python-format
|
||||
msgid "This patner area has already been used."
|
||||
@ -1317,7 +1345,13 @@ msgid "Total amount you have to pay to this vendor."
|
||||
msgstr "Montant total à payer au fournisseur."
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:235
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#, python-format
|
||||
msgid "Unsupported operator for age search"
|
||||
msgstr "Opérateur de recherche non supporté pour l'âge"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:261
|
||||
#, python-format
|
||||
msgid "Unsupported operator for defautl season search"
|
||||
msgstr "Opérateur de recherche non supporté pour le filtre de saison par défaut"
|
||||
@ -1353,8 +1387,8 @@ msgid "Website of Partner or Company"
|
||||
msgstr "Site Web pour les Partenaires ou les Sociétés"
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:373
|
||||
#: code:addons/golem_member/models/golem_member.py:376
|
||||
#: code:addons/golem_member/models/golem_member.py:399
|
||||
#: code:addons/golem_member/models/golem_member.py:402
|
||||
#: selection:golem.member.numberconfig,is_automatic:0
|
||||
#: selection:golem.member.numberconfig,is_per_season:0
|
||||
#, python-format
|
||||
|
@ -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:43+0000\n"
|
||||
"PO-Revision-Date: 2018-10-26 15:43+0000\n"
|
||||
"POT-Creation-Date: 2018-11-01 15:15+0000\n"
|
||||
"PO-Revision-Date: 2018-11-01 15:15+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -55,6 +55,18 @@ msgstr ""
|
||||
msgid "Address Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_age
|
||||
#: model:ir.model.fields,field_description:golem_member.field_res_partner_age
|
||||
#: model:ir.model.fields,field_description:golem_member.field_res_users_age
|
||||
msgid "Age"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_animator_activity_ids
|
||||
msgid "Animated activities"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.golem_member_numberconfig_form
|
||||
msgid "Apply and recompute all member numbers"
|
||||
@ -135,6 +147,11 @@ msgstr ""
|
||||
msgid "Buy Membership"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.l10n_fr_department_filter_inherit_golem_member
|
||||
msgid "By Area"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.golem_member_search
|
||||
msgid "By age"
|
||||
@ -426,7 +443,7 @@ msgid "Fax"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#: code:addons/golem_member/models/golem_member.py:127
|
||||
#, python-format
|
||||
msgid "Female"
|
||||
msgstr ""
|
||||
@ -498,7 +515,7 @@ msgid "GOLEM Members Tags"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:433
|
||||
#: code:addons/golem_member/models/golem_member.py:459
|
||||
#, python-format
|
||||
msgid "GOLEM Members merge has not been implemented yet. Please only merge partners, not members, or delete GOLEM Members manually before merging."
|
||||
msgstr ""
|
||||
@ -597,6 +614,11 @@ msgstr ""
|
||||
msgid "Invoices"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.res_partner_search_inherit_golem_member
|
||||
msgid "Is Animator"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.ui.view,arch_db:golem_member.res_partner_search_inherit_golem_member
|
||||
msgid "Is Free Member"
|
||||
@ -726,7 +748,7 @@ msgid "Latest Invoices & Payments Matching Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#: code:addons/golem_member/models/golem_member.py:126
|
||||
#, python-format
|
||||
msgid "Male"
|
||||
msgstr ""
|
||||
@ -832,14 +854,20 @@ msgid "Nationality"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:373
|
||||
#: code:addons/golem_member/models/golem_member.py:376
|
||||
#: code:addons/golem_member/models/golem_member.py:399
|
||||
#: code:addons/golem_member/models/golem_member.py:402
|
||||
#: selection:golem.member.numberconfig,is_automatic:0
|
||||
#: selection:golem.member.numberconfig,is_per_season:0
|
||||
#, python-format
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:128
|
||||
#, python-format
|
||||
msgid "Not Disclosed"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: model:ir.model.fields,field_description:golem_member.field_golem_member_comment
|
||||
msgid "Notes"
|
||||
@ -1194,7 +1222,7 @@ msgid "The name of official registry where this company was declared."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:69
|
||||
#: code:addons/golem_member/models/golem_member.py:71
|
||||
#, python-format
|
||||
msgid "The parent area is a sub area of the current area, please change it."
|
||||
msgstr ""
|
||||
@ -1235,14 +1263,14 @@ 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:168
|
||||
#: code:addons/golem_member/models/golem_member.py:194
|
||||
#: sql_constraint:golem.member:0
|
||||
#, python-format
|
||||
msgid "This member number has already been used."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:47
|
||||
#: code:addons/golem_member/models/golem_member.py:49
|
||||
#: sql_constraint:golem.partner.area:0
|
||||
#, python-format
|
||||
msgid "This patner area has already been used."
|
||||
@ -1309,7 +1337,13 @@ msgid "Total amount you have to pay to this vendor."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:235
|
||||
#: code:addons/golem_member/models/golem_member.py:103
|
||||
#, python-format
|
||||
msgid "Unsupported operator for age search"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:261
|
||||
#, python-format
|
||||
msgid "Unsupported operator for defautl season search"
|
||||
msgstr ""
|
||||
@ -1345,8 +1379,8 @@ msgid "Website of Partner or Company"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_member
|
||||
#: code:addons/golem_member/models/golem_member.py:373
|
||||
#: code:addons/golem_member/models/golem_member.py:376
|
||||
#: code:addons/golem_member/models/golem_member.py:399
|
||||
#: code:addons/golem_member/models/golem_member.py:402
|
||||
#: selection:golem.member.numberconfig,is_automatic:0
|
||||
#: selection:golem.member.numberconfig,is_per_season:0
|
||||
#, python-format
|
||||
|
@ -87,15 +87,27 @@ class ResPartner(models.Model):
|
||||
""" GOLEM Member partner adaptations """
|
||||
_inherit = 'res.partner'
|
||||
|
||||
age = fields.Integer(compute='_compute_age', store=True)
|
||||
age = fields.Integer(compute='_compute_age', search='_search_age')
|
||||
|
||||
@api.depends('birthdate_date')
|
||||
def _compute_age(self):
|
||||
for contact in self:
|
||||
if contact.birthdate_date:
|
||||
age = relativedelta(date.today(), fields.Date.from_string(contact.birthdate_date))
|
||||
age = relativedelta(date.today(),
|
||||
fields.Date.from_string(contact.birthdate_date))
|
||||
contact.age = age.years
|
||||
|
||||
def _search_age(self, operator, value):
|
||||
""" Age search function """
|
||||
if operator != '=':
|
||||
err = _('Unsupported operator for age search')
|
||||
raise NotImplementedError(err)
|
||||
today = date.today()
|
||||
min_birthdate_date = today - timedelta(days=365.25 * value)
|
||||
max_birthdate_date = today - timedelta(days=365.25 * (value + 1))
|
||||
return ['&', ('birthdate_date', '>', max_birthdate_date),
|
||||
('birthdate_date', '<=', min_birthdate_date)]
|
||||
|
||||
@api.model
|
||||
def _get_default_nationality_id(self):
|
||||
return self.env.ref('base.main_company').country_id
|
||||
|
@ -91,8 +91,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="member_number" />
|
||||
<field name="area_id"/>
|
||||
<field name="age"/>
|
||||
<field name="age" />
|
||||
<field name="area_id" />
|
||||
</field>
|
||||
<filter name="filter_my_partners" position="before">
|
||||
<filter name="is_subscriber" string="Is Subscriber"
|
||||
@ -106,12 +106,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<separator />
|
||||
<filter name="is_service_user" string="Is Service User"
|
||||
domain="[('member_id', '!=', False)]" />
|
||||
<filter name="by_are_id" string="By Area"
|
||||
context="{'group_by': area_id}"/>
|
||||
<filter name="is_animator" string="Is Animator"
|
||||
domain="[('animator_activity_ids', '!=', False)]" />
|
||||
<separator />
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="l10n_fr_department_filter_inherit_golem_member">
|
||||
<field name="name">Partner search adaptations</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="l10n_fr_department.view_res_partner_filter" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="department_groupby" position="before">
|
||||
<filter name="group_area" string="By Area"
|
||||
context="{'group_by': 'area_id'}" />
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
Loading…
x
Reference in New Issue
Block a user