[REF]GOLEM Member / Custom Price : territories enhancements

Global refactoring : small enhancements from MR code + ACLs + french i18n
This commit is contained in:
Fabien BOURGEOIS 2018-10-22 18:10:44 +02:00
parent a0fbf3ac31
commit 04f383a951
11 changed files with 228 additions and 107 deletions

View File

@ -20,11 +20,11 @@
'summary': 'GOLEM Activity Registration Custom Price',
'description': '''GOLEM Activity Registration Custom Price :
- allow set of 1:n slices based on family quotient ;
- allow set 1:n area data ;
- allow set 1:n root area data ;
- allow set price per area and slice ;
- computes automatically applicable price ;
- anticipate ruleset to be implemented for computing.''',
'version': '10.0.0.1.2',
'version': '10.0.0.2.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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
# it under the terms of the GNU Affero General Public License as

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 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
# it under the terms of the GNU Affero General Public License as

View File

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit members',
'summary': 'Extends Odoo contacts for MJC',
'description': 'Extends Odoo contacts for MJC',
'version': '10.0.2.3.5',
'version': '10.0.2.4.0',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne',
'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-08-27 09:04+0000\n"
"PO-Revision-Date: 2018-08-27 11:21+0200\n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 18:09+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -72,6 +72,18 @@ msgstr "Appliquer pour les nouveaux adhérents"
msgid "Area"
msgstr "Territoire"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_from_street
msgid "Area from street"
msgstr "Territoire automatique depuis la rue"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
msgid "Area id"
msgstr "Territoire"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
#: model:ir.ui.view,arch_db:golem_member.res_partner_form_inherit_golem_member
@ -295,6 +307,7 @@ msgstr "Faire de ce contact un usager"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_uid
msgid "Created by"
msgstr "Créé par"
@ -303,6 +316,7 @@ msgstr "Créé par"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_date
msgid "Created on"
msgstr "Créé le"
@ -381,6 +395,7 @@ msgstr "Département"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_display_name
msgid "Display Name"
msgstr "Nom affiché"
@ -415,7 +430,7 @@ msgid "Fax"
msgstr "Fax"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Female"
msgstr "Féminin"
@ -487,11 +502,16 @@ msgid "GOLEM Members Tags"
msgstr "Catégories d'adhérents"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:360
#: code:addons/golem_member/models/golem_member.py:433
#, 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."
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_partner_area_street
msgid "GOLEM Partner Area Street"
msgstr "GOLEM Partner Area Street"
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_season
msgid "GOLEM Season"
@ -537,6 +557,7 @@ msgstr "A des écritures non lettrées"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_id
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_id
msgid "ID"
msgstr "ID"
@ -677,6 +698,7 @@ msgstr "Langue"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"
@ -684,6 +706,7 @@ msgstr "Dernière Modification le"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
@ -692,6 +715,7 @@ msgstr "Dernière mise à jour par"
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
@ -712,7 +736,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:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Male"
msgstr "Masculin"
@ -740,7 +764,7 @@ msgstr "Image de taille moyenne de ce contact. Elle est automatiquement redimens
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_member_id
msgid "Member"
msgstr "Adhérent"
msgstr "Usager"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name
@ -804,8 +828,9 @@ msgstr "NIC"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4301
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4230
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_name
msgid "Name"
msgstr "Nom"
@ -817,8 +842,8 @@ msgid "Nationality"
msgstr "Nationalité"
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -865,6 +890,16 @@ msgstr "Refuse les SMS ?"
msgid "Out of mailings?"
msgstr "Refuse la réception de mails ?"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Parent"
msgstr "Parent"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_parent_id
msgid "Parent Territory"
msgstr "Territoire parent"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_parent_name
msgid "Parent name"
@ -949,6 +984,16 @@ msgstr "Date d'inscription"
msgid "Related Company"
msgstr "Société liée"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Root Territories"
msgstr "Territoires racines"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_root_id
msgid "Root area"
msgstr "Territoire racine"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_siren
msgid "SIREN"
@ -1084,6 +1129,11 @@ msgstr "État"
msgid "Street"
msgstr "Rue"
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_area_street_ids
msgid "Street list"
msgstr "Liste de rues"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
msgid "Street..."
@ -1092,7 +1142,12 @@ msgstr "Rue..."
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_street2
msgid "Street2"
msgstr "Complément de rue"
msgstr "Rue 2"
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Sub Territories"
msgstr "Sous-territoires"
#. module: golem_member
#: model:ir.actions.act_window,name:golem_member.golem_member_action
@ -1150,6 +1205,12 @@ msgstr "L'utilisateur interne qui est en charge de la communication avec ce cont
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
#, 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."
#. module: golem_member
#: model:ir.model.fields,help:golem_member.field_golem_member_has_unreconciled_entries
msgid "The partner has at least one unreconciled debit and credit since last time the invoices & payments matching was performed."
@ -1186,14 +1247,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:108
#: code:addons/golem_member/models/golem_member.py:168
#: 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:33
#: code:addons/golem_member/models/golem_member.py:47
#: sql_constraint:golem.partner.area:0
#, python-format
msgid "This patner area has already been used."
@ -1260,7 +1321,7 @@ 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:175
#: code:addons/golem_member/models/golem_member.py:235
#, python-format
msgid "Unsupported operator for defautl season search"
msgstr "Opérateur de recherche non supporté pour le filtre de saison par défaut"
@ -1296,8 +1357,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:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: 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 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-27 09:04+0000\n"
"PO-Revision-Date: 2018-08-27 09:04+0000\n"
"POT-Creation-Date: 2018-10-22 16:02+0000\n"
"PO-Revision-Date: 2018-10-22 16:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -72,6 +72,18 @@ msgstr ""
msgid "Area"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_partner_area_from_street
#: model:ir.model.fields,field_description:golem_member.field_res_users_area_from_street
msgid "Area from street"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_area_id
msgid "Area id"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
#: model:ir.ui.view,arch_db:golem_member.res_partner_form_inherit_golem_member
@ -295,6 +307,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_uid
msgid "Created by"
msgstr ""
@ -303,6 +316,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_create_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_create_date
msgid "Created on"
msgstr ""
@ -381,6 +395,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_display_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_display_name
msgid "Display Name"
msgstr ""
@ -415,7 +430,7 @@ msgid "Fax"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Female"
msgstr ""
@ -487,11 +502,16 @@ msgid "GOLEM Members Tags"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:360
#: code:addons/golem_member/models/golem_member.py:433
#, 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 ""
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_partner_area_street
msgid "GOLEM Partner Area Street"
msgstr ""
#. module: golem_member
#: model:ir.model,name:golem_member.model_golem_season
msgid "GOLEM Season"
@ -537,6 +557,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_id
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_id
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_id
msgid "ID"
msgstr ""
@ -671,6 +692,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area___last_update
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street___last_update
msgid "Last Modified on"
msgstr ""
@ -678,6 +700,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_uid
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_uid
msgid "Last Updated by"
msgstr ""
@ -686,6 +709,7 @@ msgstr ""
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_numberconfig_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_member_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_write_date
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_write_date
msgid "Last Updated on"
msgstr ""
@ -706,7 +730,7 @@ msgid "Latest Invoices & Payments Matching Date"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:57
#: code:addons/golem_member/models/golem_member.py:103
#, python-format
msgid "Male"
msgstr ""
@ -798,8 +822,9 @@ msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_name
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4301
#: model:ir.model.fields,field_description:golem_member.field_golem_member_number_name_4230
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_name
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_street_name
msgid "Name"
msgstr ""
@ -811,8 +836,8 @@ msgid "Nationality"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format
@ -859,6 +884,16 @@ msgstr ""
msgid "Out of mailings?"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Parent"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_parent_id
msgid "Parent Territory"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_parent_name
msgid "Parent name"
@ -941,6 +976,16 @@ msgstr ""
msgid "Related Company"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Root Territories"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_root_id
msgid "Root area"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_member_siren
msgid "SIREN"
@ -1076,6 +1121,11 @@ msgstr ""
msgid "Street"
msgstr ""
#. module: golem_member
#: model:ir.model.fields,field_description:golem_member.field_golem_partner_area_area_street_ids
msgid "Street list"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_member_form
msgid "Street..."
@ -1086,6 +1136,11 @@ msgstr ""
msgid "Street2"
msgstr ""
#. module: golem_member
#: model:ir.ui.view,arch_db:golem_member.golem_partner_area_view_search
msgid "Sub Territories"
msgstr ""
#. module: golem_member
#: model:ir.actions.act_window,name:golem_member.golem_member_action
#: model:ir.ui.menu,name:golem_member.golem_members_menu
@ -1142,6 +1197,12 @@ msgstr ""
msgid "The name of official registry where this company was declared."
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:69
#, python-format
msgid "The parent area is a sub area of the current area, please change it."
msgstr ""
#. module: golem_member
#: model:ir.model.fields,help:golem_member.field_golem_member_has_unreconciled_entries
msgid "The partner has at least one unreconciled debit and credit since last time the invoices & payments matching was performed."
@ -1178,14 +1239,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:108
#: code:addons/golem_member/models/golem_member.py:168
#: 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:33
#: code:addons/golem_member/models/golem_member.py:47
#: sql_constraint:golem.partner.area:0
#, python-format
msgid "This patner area has already been used."
@ -1252,7 +1313,7 @@ msgid "Total amount you have to pay to this vendor."
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:175
#: code:addons/golem_member/models/golem_member.py:235
#, python-format
msgid "Unsupported operator for defautl season search"
msgstr ""
@ -1288,8 +1349,8 @@ msgid "Website of Partner or Company"
msgstr ""
#. module: golem_member
#: code:addons/golem_member/models/golem_member.py:300
#: code:addons/golem_member/models/golem_member.py:303
#: code:addons/golem_member/models/golem_member.py:373
#: code:addons/golem_member/models/golem_member.py:376
#: selection:golem.member.numberconfig,is_automatic:0
#: selection:golem.member.numberconfig,is_per_season:0
#, python-format

View File

@ -15,4 +15,4 @@
# 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/>.
from . import golem_member, golem_season, golem_partner_area_street
from . import golem_member, golem_season

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018 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
# it under the terms of the GNU Affero General Public License as
@ -26,17 +27,15 @@ def get_root_area(area_id):
""" Get root area """
if not area_id.parent_id:
return area_id
else:
return get_root_area(area_id.parent_id)
return get_root_area(area_id.parent_id)
def is_sub_area(area_id, parent_id):
""" Check if parent is sub area """
if parent_id.parent_id.id == area_id.id:
return True
elif not parent_id.parent_id:
if not parent_id.parent_id:
return False
else:
return is_sub_area(area_id, parent_id.parent_id)
return is_sub_area(area_id, parent_id.parent_id)
class PartnerArea(models.Model):
""" Partner Area """
@ -50,11 +49,11 @@ class PartnerArea(models.Model):
name = fields.Char(required=True, index=True)
sequence = fields.Integer()
area_street_ids = fields.One2many('golem.partner.area.street', 'area_id',
string="street list")
parent_id = fields.Many2one('golem.partner.area', string="Parent Territory",
string='Street list')
parent_id = fields.Many2one('golem.partner.area', string='Parent Territory',
domain="[('id', '!=', id)]")
root_id = fields.Many2one('golem.partner.area', compute="_compute_root_id",
string="Root area")
root_id = fields.Many2one('golem.partner.area', compute='_compute_root_id',
string='Root area')
@api.depends('parent_id')
def _compute_root_id(self):
@ -67,9 +66,21 @@ class PartnerArea(models.Model):
""" Check if parent is sub area """
for area in self:
if is_sub_area(area, area.parent_id):
err = _("The parent area is a sub area of the current area, please change it")
err = _('The parent area is a sub area of the current area, '
'please change it.')
raise ValidationError(err)
class GolemPartnerAreaStreet(models.Model):
""" GOLEM Partner Area Street Management """
_name = 'golem.partner.area.street'
_description = 'GOLEM Partner Area Street'
name = fields.Char(required=True)
area_id = fields.Many2one('golem.partner.area', required=True, sring='Area',
index=True, auto_join=True, ondelete='set null')
class ResPartner(models.Model):
""" GOLEM Member partner adaptations """
_inherit = 'res.partner'
@ -85,6 +96,7 @@ class ResPartner(models.Model):
'golem.partner.area', index=True, auto_join=True, string='Area',
help="Area, quarter... for statistics and activity price."
)
area_from_street = fields.Boolean(store=False, default=False)
country_id = fields.Many2one(default=_get_default_nationality_id)
# Gender overwriting : no need for 'other' choice
@ -117,17 +129,19 @@ class ResPartner(models.Model):
gm_obj = self.env['golem.member']
gm_obj.create({'partner_id': self[0].id})
@api.multi
@api.constrains('street')
def save_street(self):
""" Save street if no exist """
for member in self:
if member.street:
street = self.env['golem.partner.area.street'].search([
('name', 'ilike', member.street)])
if not street:
self.env['golem.partner.area.street'].create({'name': member.street,
'area_id': member.area_id.id})
if member.street and not member.area_from_street:
mstreet = member.street.strip()
street_id = self.env['golem.partner.area.street'].search(
[('name', 'ilike', mstreet)]
)
if not street_id:
self.env['golem.partner.area.street'].create(
{'name': mstreet, 'area_id': member.area_id.id}
)
class GolemMembershipInvoice(models.TransientModel):
""" GOLEM Membership Invoice adaptations """
@ -228,6 +242,19 @@ class GolemMember(models.Model):
is_num_man = (conf.get_param('golem_numberconfig_isautomatic') == '0')
self.update({'is_number_manual': is_num_man})
@api.onchange('street')
def onchange_street(self):
""" Area auto assignement """
for member in self:
mstreet = member.street.strip() if member.street else False
if mstreet and not member.area_id:
street_id = self.env['golem.partner.area.street'].search(
[('name', 'ilike', mstreet)], limit=1
)
if street_id:
member.area_id = street_id.area_id
member.area_from_street = True
@api.multi
def generate_number_perseason(self):
""" Number generation in case of per season configuration """
@ -296,21 +323,13 @@ class GolemMember(models.Model):
member.number = member.generate_number_global()
@api.multi
def write(self, values):
def write(self, vals):
""" Number generation after updates """
res = super(GolemMember, self).write(values)
if 'season_ids' in values or 'number_manual' in values:
res = super(GolemMember, self).write(vals)
if 'season_ids' in vals or 'number_manual' in vals:
self.generate_number()
return res
@api.onchange('street')
def onchange_street(self):
""" Area auto assignement """
self.ensure_one()
member = self[0]
street = self.env['golem.partner.area.street'].search([('name', 'ilike', member.street)])
if street:
member.area_id = street[0].area_id
class GolemMemberNumber(models.Model):
""" GOLEM Member Numbers """

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 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/>.
""" GOLEM Partner Area Street Management """
from odoo import models, fields, api
class GolemPartnerAreaStreet(models.Model):
""" GOLEM Partner Area Street Management """
_name = 'golem.partner.area.street'
_description = 'GOLEM Partner Area Street'
name = fields.Char(required=True)
area_id = fields.Many2one('golem.partner.area', required=True,
index=True, auto_join=True, ondelete="set null")

View File

@ -1,5 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_golem_member_user,Access GOLEM Member User,model_golem_member,golem_base.group_golem_user,1,1,1,1
access_partner_area_user,Access GOLEM Partner Area User,model_golem_partner_area,golem_base.group_golem_user,1,1,1,1
access_partner_area_street_user,Access GOLEM Partner Area Street User,model_golem_partner_area_street,golem_base.group_golem_user,1,1,1,1
access_golem_member_season_user,Access GOLEM Member Season User,model_golem_member_number,golem_base.group_golem_user,1,1,1,1
access_ir_config_parameter_manager,Access IR Config Parameter Manager,base.model_ir_config_parameter,golem_base.group_golem_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_member_user Access GOLEM Member User model_golem_member golem_base.group_golem_user 1 1 1 1
3 access_partner_area_user Access GOLEM Partner Area User model_golem_partner_area golem_base.group_golem_user 1 1 1 1
4 access_partner_area_street_user Access GOLEM Partner Area Street User model_golem_partner_area_street golem_base.group_golem_user 1 1 1 1
5 access_golem_member_season_user Access GOLEM Member Season User model_golem_member_number golem_base.group_golem_user 1 1 1 1
6 access_ir_config_parameter_manager Access IR Config Parameter Manager base.model_ir_config_parameter golem_base.group_golem_manager 1 1 1 1

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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
it under the terms of the GNU Affero General Public License as published by
@ -39,14 +40,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="parent_id"/>
<field name="root_id"/>
<field name="area_street_ids">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
<group>
<field name="name" />
</group>
<group>
<field name="parent_id" />
<field name="root_id" />
</group>
</group>
<group>
<field name="area_street_ids">
<tree editable="bottom">
<field name="name" />
</tree>
</field>
</group>
</form>
</field>
@ -58,20 +65,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="model">golem.partner.area</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="parent_id"/>
<field name="name" />
<field name="parent_id" />
<filter name="sub_territories" string="Sub Territories"
domain="[('parent_id', '!=', False)]"/>
<filter name="parent_territories" string="Parent Territories"
domain="[('parent_id', '=', False)]"/>
domain="[('parent_id', '!=', False)]" />
<filter name="root_territories" string="Root Territories"
domain="[('parent_id', '=', False)]" />
<filter name="group_parent" string="Parent"
context="{'group_by': 'parent_id'}" />
</search>
</field>
</record>
<!-- Actions -->
<act_window id="golem_partner_area_action"
name="Areas" res_model="golem.partner.area"
view_mode="tree,form" />
<act_window id="golem_partner_area_action" name="Areas"
res_model="golem.partner.area" view_mode="tree,form" />
<!-- Menus -->
<menuitem id="golem_partner_area_menu" name="Areas"