Browse Source
Merge pull request #20 from savoirfairelinux/partner_contact_management
Merge pull request #20 from savoirfairelinux/partner_contact_management
Base contact by functionpull/70/head
Nicolas Bessi (nbessi)
10 years ago
23 changed files with 2236 additions and 0 deletions
-
28base_contact_function/__init__.py
-
73base_contact_function/__openerp__.py
-
265base_contact_function/i18n/base_contact_function.pot
-
290base_contact_function/i18n/fr.po
-
97base_contact_function/res_partner.py
-
59base_contact_function/res_partner_category.py
-
47base_contact_function/res_partner_category_function.py
-
54base_contact_function/res_partner_category_view.xml
-
51base_contact_function/res_partner_function.py
-
43base_contact_function/res_partner_function_view.xml
-
527base_contact_function/res_partner_view.xml
-
3base_contact_function/security/ir.model.access.csv
-
31base_contact_function/tests/__init__.py
-
105base_contact_function/tests/test_functions.py
-
193base_contact_function/tests/test_partner_category.py
-
23base_contact_function_partner_firstname/__init__.py
-
51base_contact_function_partner_firstname/__openerp__.py
-
27base_contact_function_partner_firstname/i18n/base_contact_function_partner_firstname.pot
-
27base_contact_function_partner_firstname/i18n/fr.po
-
82base_contact_function_partner_firstname/res_partner.py
-
76base_contact_function_partner_firstname/res_partner_view.xml
-
27base_contact_function_partner_firstname/tests/__init__.py
-
57base_contact_function_partner_firstname/tests/test_partner.py
@ -0,0 +1,28 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from . import ( |
|||
res_partner, |
|||
res_partner_function, |
|||
res_partner_category, |
|||
res_partner_category_function, |
|||
) |
@ -0,0 +1,73 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
'name': 'Contact by Function', |
|||
'version': '1.0', |
|||
'author': 'Savoir-faire Linux', |
|||
'maintainer': 'Savoir-faire Linux', |
|||
'website': 'http://www.savoirfairelinux.com', |
|||
'category': 'Customer Relationship Management', |
|||
'description': """ |
|||
Contacts by Functions |
|||
===================== |
|||
|
|||
This module allows you to manage contacts by functions. |
|||
|
|||
A person can occupy many job positions in many organizations and you may need |
|||
to retrieve all your contacts for a given job position. |
|||
|
|||
This module replaces the single "job position" field on a contact and gives |
|||
the possibility to declare many functions (i.e job positions) for a contact. |
|||
You can also manage the functions on the organization |
|||
(res.partner is_company=True) itself. |
|||
|
|||
To retrieve contacts by functions, categories (tags) are used in order to group |
|||
similar functions in a single category. Within a category, you can declare |
|||
the sequence of functions so you could use this sequence to sort the contacts |
|||
of this category by their function. |
|||
|
|||
When you have functions for your contacts and functions for the categories you |
|||
can tag the contacts (manually or automatically with the segmentation tool) and |
|||
search with the tag name. |
|||
|
|||
E.g.: |
|||
You may need to have a category such as 'Head of State' to quickly identify |
|||
contacts that occupies the functions 'President', 'Prime minister' or 'King'. |
|||
For protocol reasons, you may want to have 'Kings' sorted first. |
|||
|
|||
Contributors |
|||
------------ |
|||
* El Hadji Dem (elhadji.dem@savoirfairelinux.com) |
|||
* Sandy Carter (sandy.carter@savoirfairelinux.com) |
|||
""", |
|||
'depends': [ |
|||
'base_contact', |
|||
], |
|||
'data': [ |
|||
'res_partner_function_view.xml', |
|||
'res_partner_category_view.xml', |
|||
'res_partner_view.xml', |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,265 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_contact_function |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-10-31 16:24+0000\n" |
|||
"PO-Revision-Date: 2014-10-31 16:24+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.category.function,category_id:0 |
|||
msgid "Category" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "City" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_function_tree_list |
|||
#: view:res.partner:0 |
|||
#: field:res.partner,function_ids:0 |
|||
#: view:res.partner.category:0 |
|||
#: field:res.partner.category,category_function_ids:0 |
|||
#: field:res.partner.category.function,function_id:0 |
|||
#: view:res.partner.function:0 |
|||
#: field:res.partner.function,partner_ids:0 |
|||
msgid "Functions" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_category_function |
|||
msgid "Partner Category Function" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_partner_contact_form |
|||
msgid "Contacts" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Street..." |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "State" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "e.g. Sales Director" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_function |
|||
msgid "Partner Function" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Tags..." |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,start_date:0 |
|||
msgid "Start date" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Parent Organism" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Fax:" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
#: view:res.partner.category:0 |
|||
#: view:res.partner.function:0 |
|||
msgid "Function" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Fax" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.function,acronym:0 |
|||
msgid "Acronym" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,other_contact_history_ids:0 |
|||
msgid "unknown" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_partner_customer_form |
|||
msgid "Company" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "History (Functions)" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Tag" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Address" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Use Organisation Address" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "have the same form for contact and other postions" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Phone:" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.function,name:0 |
|||
msgid "Name" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "ZIP" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Country" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Select Functions for this Organisation" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Is an Organism" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,function_id:0 |
|||
msgid "Position Occupied" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Contact" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Parent Organisation" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Mobile:" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_category |
|||
msgid "Partner Categories" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Organism" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner,naming:0 |
|||
msgid "Naming." |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "History" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,end_date:0 |
|||
msgid "End date" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner.category:0 |
|||
msgid "Add function" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Bank Details" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.category.function,sequence:0 |
|||
msgid "Sequence" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Bank Accounts" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "No, Street, Apartment/Office" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.category.function,sequence:0 |
|||
msgid "Used to order" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.function,acronym:0 |
|||
msgid "Acronym of function." |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.function,name:0 |
|||
msgid "Name of function." |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner |
|||
msgid "Partner" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,naming:0 |
|||
msgid "Naming" |
|||
msgstr "" |
@ -0,0 +1,290 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_contact_function |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-10-31 16:24+0000\n" |
|||
"PO-Revision-Date: 2014-10-31 12:25-0500\n" |
|||
"Last-Translator: Sandy Carter <sandy.carter@savoirfairelinux.com>\n" |
|||
"Language-Team: \n" |
|||
"Language: fr\n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"X-Generator: Poedit 1.6.10\n" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.category.function,category_id:0 |
|||
msgid "Category" |
|||
msgstr "Catégorie" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "City" |
|||
msgstr "Ville" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_function_tree_list |
|||
#: view:res.partner:0 field:res.partner,function_ids:0 |
|||
#: view:res.partner.category:0 |
|||
#: field:res.partner.category,category_function_ids:0 |
|||
#: field:res.partner.category.function,function_id:0 |
|||
#: view:res.partner.function:0 field:res.partner.function,partner_ids:0 |
|||
msgid "Functions" |
|||
msgstr "Fonctions" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_category_function |
|||
msgid "Partner Category Function" |
|||
msgstr "Fonction de la catégorie du partenaire" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_partner_contact_form |
|||
msgid "Contacts" |
|||
msgstr "Contacts" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Street..." |
|||
msgstr "Rue..." |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "State" |
|||
msgstr "Etat" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "e.g. Sales Director" |
|||
msgstr "ex: Directeur de vente" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_function |
|||
msgid "Partner Function" |
|||
msgstr "Fonction du partenaire" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Tags..." |
|||
msgstr "Etiquettes..." |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,start_date:0 |
|||
msgid "Start date" |
|||
msgstr "Date de début" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Parent Organism" |
|||
msgstr "Organisme parent" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Fax:" |
|||
msgstr "Télécopie :" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 view:res.partner.category:0 view:res.partner.function:0 |
|||
msgid "Function" |
|||
msgstr "Fonction" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Fax" |
|||
msgstr "Télécopie" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.function,acronym:0 |
|||
msgid "Acronym" |
|||
msgstr "Acronyme" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,other_contact_history_ids:0 |
|||
msgid "unknown" |
|||
msgstr "inconnu" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.actions.act_window,name:base_contact_function.action_partner_customer_form |
|||
msgid "Company" |
|||
msgstr "Organisme" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "History (Functions)" |
|||
msgstr "Historique (Fonctions)" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Tag" |
|||
msgstr "Etiquette" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Address" |
|||
msgstr "Adresse" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Use Organisation Address" |
|||
msgstr "Utiliser l'adresse de l'organisme" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "have the same form for contact and other postions" |
|||
msgstr "Avoir le même formulaire de contact et d'autres postions" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Phone:" |
|||
msgstr "Téléphone:" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.function,name:0 |
|||
msgid "Name" |
|||
msgstr "Nom" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "ZIP" |
|||
msgstr "Code postal" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Country" |
|||
msgstr "Pays" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Select Functions for this Organisation" |
|||
msgstr "Sélectionner les fonctions de cet organisme" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Is an Organism" |
|||
msgstr "Est un Organisme" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,function_id:0 |
|||
msgid "Position Occupied" |
|||
msgstr "Fonction Occupée" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Contact" |
|||
msgstr "Contact" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Parent Organisation" |
|||
msgstr "Organisme parent" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Mobile:" |
|||
msgstr "Portable :" |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner_category |
|||
msgid "Partner Categories" |
|||
msgstr "Catégories de partenaires" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Organism" |
|||
msgstr "Organisme" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner,naming:0 |
|||
msgid "Naming." |
|||
msgstr "Appellation" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "History" |
|||
msgstr "Historique" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,end_date:0 |
|||
msgid "End date" |
|||
msgstr "Date de fin" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner.category:0 |
|||
msgid "Add function" |
|||
msgstr "Ajouter fonction" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Bank Details" |
|||
msgstr "Coordonnées bancaires" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner.category.function,sequence:0 |
|||
msgid "Sequence" |
|||
msgstr "Séquence" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "Bank Accounts" |
|||
msgstr "Comptes bancaires" |
|||
|
|||
#. module: base_contact_function |
|||
#: view:res.partner:0 |
|||
msgid "No, Street, Apartment/Office" |
|||
msgstr "No, Rue, Appartement/Bureau" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.category.function,sequence:0 |
|||
msgid "Used to order" |
|||
msgstr "Permet d'ordonner" |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.function,acronym:0 |
|||
msgid "Acronym of function." |
|||
msgstr "Acronyme de la fonction." |
|||
|
|||
#. module: base_contact_function |
|||
#: help:res.partner.function,name:0 |
|||
msgid "Name of function." |
|||
msgstr "Nom de la fonction." |
|||
|
|||
#. module: base_contact_function |
|||
#: model:ir.model,name:base_contact_function.model_res_partner |
|||
msgid "Partner" |
|||
msgstr "Partenaire" |
|||
|
|||
#. module: base_contact_function |
|||
#: field:res.partner,naming:0 |
|||
msgid "Naming" |
|||
msgstr "Appellation" |
|||
|
|||
#~ msgid "institution" |
|||
#~ msgstr "institution" |
|||
|
|||
#~ msgid "Add functions for this institution" |
|||
#~ msgstr "Ajouter des fonctions de cette institution" |
|||
|
|||
#~ msgid "Name already exists" |
|||
#~ msgstr "Le nom existe déjà" |
|||
|
|||
#~ msgid "InstitutionsForm" |
|||
#~ msgstr "InstitutionsForm" |
|||
|
|||
#~ msgid "Name of institution." |
|||
#~ msgstr "Nom de l'institution." |
|||
|
|||
#~ msgid "Institution" |
|||
#~ msgstr "Institution" |
|||
|
|||
#~ msgid "Used to order the institutions" |
|||
#~ msgstr "Permet d'ordonner les institutions" |
|||
|
|||
#~ msgid "Institution Function" |
|||
#~ msgstr "Fonction de l'institution" |
|||
|
|||
#~ msgid "Institutions" |
|||
#~ msgstr "Institutions" |
@ -0,0 +1,97 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import time |
|||
from openerp.osv import orm, fields |
|||
|
|||
|
|||
class res_partner(orm.Model): |
|||
""" |
|||
Inherits partner and adds function_ids : List of functions |
|||
""" |
|||
_inherit = 'res.partner' |
|||
|
|||
def onchange_partner_function(self, cr, uid, ids, part, context=None): |
|||
partner_pool = self.pool['res.partner'] |
|||
if not part: |
|||
return {'value': None} |
|||
partner_ids = partner_pool.search(cr, uid, [('id', '=', part)]) |
|||
function_ids = partner_pool.browse( |
|||
cr, uid, partner_ids, context=context)[0].function_ids |
|||
result = [] |
|||
if function_ids: |
|||
for line in function_ids: |
|||
result.append(line.id) |
|||
dom = {'function_id': [('id', 'in', result)]} |
|||
return {'domain': dom} |
|||
|
|||
def _get_history_lines(self, cr, uid, ids, name, arg, context=None): |
|||
res = {} |
|||
res_partner_pool = self.pool.get('res.partner') |
|||
for record in self.browse(cr, uid, ids, context=context): |
|||
|
|||
if record.is_company: |
|||
return res |
|||
contact_ids = res_partner_pool.search( |
|||
cr, uid, [ |
|||
('contact_id', '=', record.id), |
|||
('active', '=', False), |
|||
], context=context |
|||
) |
|||
res[record.id] = [ |
|||
x.id for x in res_partner_pool.browse(cr, uid, contact_ids) |
|||
if x.end_date and x.end_date <= time.strftime('%Y-%m-%d') |
|||
] |
|||
return res |
|||
|
|||
_columns = { |
|||
'function_ids': fields.many2many( |
|||
'res.partner.function', |
|||
'function_partner_rel', |
|||
'partner_id', |
|||
'function_id', |
|||
'Functions', |
|||
), |
|||
'start_date': fields.date('Start date'), |
|||
'end_date': fields.date('End date'), |
|||
'naming': fields.char( |
|||
'Naming', |
|||
help="Naming.", |
|||
), |
|||
'function_id': fields.many2one( |
|||
'res.partner.function', |
|||
'Position Occupied', |
|||
), |
|||
'other_contact_history_ids': fields.function( |
|||
_get_history_lines, |
|||
relation="res.partner", |
|||
method=True, |
|||
type="one2many", |
|||
), |
|||
# Replace company by Organisation |
|||
'use_parent_address': fields.boolean( |
|||
'Use Organisation Address', |
|||
help="Select this if you want to set organisation's address " |
|||
"information for this contact", |
|||
), |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import orm, fields |
|||
|
|||
|
|||
class res_partner_category(orm.Model): |
|||
""" |
|||
Inherits partner_category |
|||
""" |
|||
_inherit = 'res.partner.category' |
|||
_columns = { |
|||
'category_function_ids': fields.one2many( |
|||
'res.partner.category.function', |
|||
'category_id', |
|||
'Functions' |
|||
), |
|||
} |
|||
|
|||
def name_search(self, cr, user, name='', args=None, operator='ilike', |
|||
context=None, limit=100): |
|||
if not args: |
|||
args = [] |
|||
if not context: |
|||
context = {} |
|||
if name: |
|||
name = name.split(' / ')[-1] |
|||
ids = self.search(cr, user, [('name', operator, name)] + args, |
|||
limit=limit, context=context) |
|||
if ids: |
|||
child_ids = self.search( |
|||
cr, user, [('parent_id', 'child_of', ids)], |
|||
limit=limit, context=context) |
|||
if child_ids: |
|||
ids.extend(child_ids) |
|||
# Remove duplicates and respect limit |
|||
ids = list(set(ids))[:limit] |
|||
else: |
|||
ids = self.search(cr, user, args, limit=limit, context=context) |
|||
return self.name_get(cr, user, ids, context) |
@ -0,0 +1,47 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import orm, fields |
|||
|
|||
|
|||
class res_partner_category_function(orm.Model): |
|||
""" |
|||
Adds this class to link category and functions |
|||
""" |
|||
_description = 'Partner Category Function' |
|||
_name = 'res.partner.category.function' |
|||
_order = 'sequence asc' |
|||
_columns = { |
|||
'function_id': fields.many2one( |
|||
'res.partner.function', |
|||
'Functions', |
|||
required='True', |
|||
), |
|||
'sequence': fields.integer( |
|||
'Sequence', |
|||
help="Used to order", |
|||
), |
|||
'category_id': fields.many2one( |
|||
'res.partner.category', |
|||
'Category', |
|||
), |
|||
} |
@ -0,0 +1,54 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="view_partner_category_form_admin" model="ir.ui.view"> |
|||
<field name="name">List Form</field> |
|||
<field name="model">res.partner.category</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="List"> |
|||
<field name="complete_name"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_partner_category_list_admin" model="ir.ui.view"> |
|||
<field name="name">List Tree</field> |
|||
<field name="model">res.partner.category</field> |
|||
<field name="field_parent">child_ids</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="List"> |
|||
<field name="name"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="partner_category_action" model="ir.actions.act_window"> |
|||
<field name="name">List</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">res.partner.category</field> |
|||
<field name="domain">[('parent_id','=',False)]</field> |
|||
<field name="view_type">tree</field> |
|||
<field name="view_mode">tree</field> |
|||
<field name="view_id" ref="view_partner_category_list_admin"/> |
|||
<field name="help" type="html"> |
|||
<p> |
|||
Here is a list of all your partners classified by category. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<menuitem id="menu_partner_category_list_form" |
|||
name="Category Lists" |
|||
parent="mail.mail_my_stuff" |
|||
sequence="30" |
|||
action="base.action_partner_category_form"/> |
|||
|
|||
<menuitem id="menu_partner_category" |
|||
name="Category Lists Tree" |
|||
action="partner_category_action" |
|||
parent="mail.mail_my_stuff" |
|||
sequence="40" /> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,51 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import fields, orm |
|||
|
|||
|
|||
class res_partner_function(orm.Model): |
|||
_description = 'Partner Function' |
|||
_name = 'res.partner.function' |
|||
_columns = { |
|||
'name': fields.char( |
|||
'Name', |
|||
required=True, |
|||
select=True, |
|||
translate=True, |
|||
help='Name of function.', |
|||
), |
|||
'acronym': fields.char( |
|||
'Acronym', |
|||
size=50, |
|||
select=True, |
|||
translate=True, |
|||
help='Acronym of function.', |
|||
), |
|||
'partner_ids': fields.many2many( |
|||
'res.partner', |
|||
'function_partner_rel', |
|||
'function_id', |
|||
'partner_id', |
|||
'Functions', |
|||
), |
|||
} |
@ -0,0 +1,43 @@ |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- Tree Views functions--> |
|||
<record id="function_tree_view" model="ir.ui.view"> |
|||
<field name="name">Function Tree View</field> |
|||
<field name="model">res.partner.function</field> |
|||
<field name="arch" type="xml"> |
|||
|
|||
<tree string="Functions" version="7.0"> |
|||
<field name="name"/> |
|||
<field name="acronym"/> |
|||
</tree> |
|||
|
|||
</field> |
|||
</record> |
|||
|
|||
<!-- Form Views functions--> |
|||
<record id="function_form_view" model="ir.ui.view"> |
|||
<field name="name">Function Form View</field> |
|||
<field name="model">res.partner.function</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Function" version="7.0" > |
|||
<group col="4"> |
|||
<field name="name"/> |
|||
<field name="acronym"/> |
|||
</group> |
|||
</form> |
|||
|
|||
</field> |
|||
</record> |
|||
|
|||
<!-- Actions --> |
|||
<record id="action_function_tree_list" model="ir.actions.act_window"> |
|||
<field name="name">Functions</field> |
|||
<field name="view_id" ref="function_tree_view"/> |
|||
<field name="res_model">res.partner.function</field> |
|||
<field name="view_mode">tree,form</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,527 @@ |
|||
<?xml version = "1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<!--Add list of functions in partner view--> |
|||
<record id="view_contact_by_function_form" model="ir.ui.view"> |
|||
<field name="name">contact.functions.form.inherit</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="use_parent_address" position="replace"> |
|||
<field name="use_parent_address" |
|||
class="oe_edit_only oe_inline" |
|||
on_change="onchange_address(use_parent_address, parent_id)" |
|||
attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}" |
|||
string="Use Organisation Address"/> |
|||
</field> |
|||
<label for="use_parent_address" position="replace"> |
|||
<label for="use_parent_address" |
|||
class="oe_edit_only" |
|||
attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}" |
|||
string="Use Organisation Address"/> |
|||
</label> |
|||
<!--Add ')' at the end of 'Is an Organism?'--> |
|||
<label for="is_company" position="replace"> |
|||
<label for="is_company" string="Is an Organism"/>) |
|||
</label> |
|||
<!--Replace Street placeholder by No, Street, Apartment/Office--> |
|||
<field name="street" position="attributes"> |
|||
<attribute name="placeholder">No, Street, Apartment/Office</attribute> |
|||
</field> |
|||
<field name="fax" position="attributes"> |
|||
<attribute name="string">Fax</attribute> |
|||
</field> |
|||
|
|||
<notebook position="inside"> |
|||
<page string="Functions" |
|||
attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}" |
|||
autofocus="autofocus"> |
|||
<separator string="Select Functions for this Organisation"/> |
|||
<field name="function_ids"/> |
|||
</page> |
|||
<page string="History (Functions)" attrs="{'invisible': ['|','|',('is_company','=',True),('contact_id','!=',False),('other_contact_history_ids','=',[])]}"> |
|||
<separator string="History"/> |
|||
<field name="other_contact_history_ids" mode="kanban" |
|||
attrs="{'invisible': [('other_contact_history_ids','=',False)]}"> |
|||
<kanban> |
|||
<field name="color"/> |
|||
<field name="name"/> |
|||
<field name="title"/> |
|||
<field name="email"/> |
|||
<field name="parent_id" string="Organism"/> |
|||
<field name="is_company"/> |
|||
<field name="function_id" string="Function"/> |
|||
<field name="phone"/> |
|||
<field name="street"/> |
|||
<field name="street2"/> |
|||
<field name="zip"/> |
|||
<field name="city"/> |
|||
<field name="country_id"/> |
|||
<field name="mobile"/> |
|||
<field name="fax"/> |
|||
<field name="state_id"/> |
|||
<field name="has_image"/> |
|||
<templates> |
|||
<t t-name="kanban-box"> |
|||
<div class="oe_kanban_vignette oe_semantic_html_override"> |
|||
<a type="open"> |
|||
<t t-if="record.has_image.raw_value === true"> |
|||
<img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)" |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
<t t-if="record.has_image.raw_value === false"> |
|||
<t t-if="record.is_company.raw_value === true"> |
|||
<img t-att-src='_s + "/base/static/src/img/company_image.png"' |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
<t t-if="record.is_company.raw_value === false"> |
|||
<img t-att-src='_s + "/base/static/src/img/avatar.png"' |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
</t> |
|||
</a> |
|||
<div class="oe_kanban_details"> |
|||
<h4 class="oe_partner_heading"> |
|||
<a type="open"> |
|||
<field name="name"/> |
|||
</a> |
|||
</h4> |
|||
<div class="oe_kanban_partner_categories"/> |
|||
<div class="oe_kanban_partner_links"/> |
|||
<ul> |
|||
<li t-if="!record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
</li> |
|||
<li t-if="record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
, |
|||
<field name="parent_id"/> |
|||
</li> |
|||
<li t-if="record.city.raw_value and !record.country.raw_value"> |
|||
<field name="city"/> |
|||
</li> |
|||
<li t-if="!record.city.raw_value and record.country.raw_value"> |
|||
<field name="country"/> |
|||
</li> |
|||
<li t-if="record.city.raw_value and record.country.raw_value"> |
|||
<field name="city"/> |
|||
, |
|||
<field name="country"/> |
|||
</li> |
|||
<li t-if="record.email.raw_value"> |
|||
<a t-attf-href="mailto:#{record.email.raw_value}"> |
|||
<field name="email"/> |
|||
</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</templates> |
|||
</kanban> |
|||
<form string="Contact" version="7.0"> |
|||
<sheet> |
|||
<field name="image" widget='image' class="oe_avatar oe_left" |
|||
options='{"preview_image": "image_medium"}'/> |
|||
<div class="oe_title"> |
|||
<label for="name" class="oe_edit_only"/> |
|||
<h1> |
|||
<field name="name" style="width: 70%%"/> |
|||
</h1> |
|||
</div> |
|||
<group> |
|||
<!-- inherited part --> |
|||
<field name="category_id" widget="many2many_tags" |
|||
placeholder="Tags..." style="width: 70%%" string="Tag"/> |
|||
<field name="parent_id" |
|||
placeholder="Organism" |
|||
domain="[('is_company','=',True)]" |
|||
string="Parent Organism"/> |
|||
<!-- inherited part end --> |
|||
<field name="function_id" placeholder="e.g. Sales Director"/> |
|||
<group colspan="4"> |
|||
<field name="start_date" /> |
|||
<field name="end_date"/> |
|||
<field name="naming"/> |
|||
</group> |
|||
<field name="email"/> |
|||
<field name="phone"/> |
|||
<field name="mobile"/> |
|||
</group> |
|||
<div> |
|||
<field name="use_parent_address"/> |
|||
<label for="use_parent_address" string="Use Organisation Address"/> |
|||
</div> |
|||
<group> |
|||
<label for="type"/> |
|||
<div name="div_type"> |
|||
<field class="oe_inline" name="type"/> |
|||
</div> |
|||
<label for="street" string="Address" |
|||
attrs="{'invisible': [('use_parent_address','=', True)]}"/> |
|||
<div attrs="{'invisible': [('use_parent_address','=', True)]}" |
|||
name="div_address"> |
|||
<field name="street" placeholder="Street..."/> |
|||
<field name="street2"/> |
|||
<div class="address_format"> |
|||
<field name="city" placeholder="City" style="width: 40%%"/> |
|||
<field name="state_id" class="oe_no_button" |
|||
placeholder="State" style="width: 37%%" |
|||
options='{"no_open": True}' on_change="onchange_state(state_id)"/> |
|||
<field name="zip" placeholder="ZIP" style="width: 20%%"/> |
|||
</div> |
|||
<field name="country_id" placeholder="Country" |
|||
class="oe_no_button" options='{"no_open": True}'/> |
|||
</div> |
|||
</group> |
|||
<field name="supplier" invisible="True"/> |
|||
<group string="Bank Accounts"> |
|||
<field name="bank_ids" nolabel="1"> |
|||
<tree string="Bank Details"> |
|||
<field name="state" invisible="1"/> |
|||
<field name="sequence" invisible="1"/> |
|||
<field name="acc_number"/> |
|||
<field name="bank_name"/> |
|||
<field name="owner_name"/> |
|||
</tree> |
|||
</field> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
<!--Replace function by function_id defined by Organisation--> |
|||
<field name="function" position="replace"/> |
|||
</field> |
|||
|
|||
</record> |
|||
<!--Add start_date, end_date, naming and account bank in partner view--> |
|||
<record id="view_position_info_form" model="ir.ui.view"> |
|||
<field name="name">position.info.form.inherit</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base_contact.view_partner_form_inherit"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='category_id']" |
|||
position="attributes"> |
|||
<attribute name="string">Tag</attribute> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']" |
|||
position="after"> |
|||
<group colspan="4"> |
|||
<field name="start_date" /> |
|||
<field name="end_date"/> |
|||
<field name="naming"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='supplier']" |
|||
position="after"> |
|||
<group string="Bank Accounts"> |
|||
<field name="bank_ids" nolabel="1"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='parent_id']" |
|||
position="replace"> |
|||
<group colspan="4"> |
|||
<field name="parent_id" placeholder="Organism" |
|||
domain="[('is_company','=',True)]" |
|||
on_change="onchange_partner_function(parent_id)" |
|||
string="Parent Organism"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']" |
|||
position="replace"> |
|||
<group colspan="4"> |
|||
<field name="function_id" string="Function"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//label[@for='use_parent_address']" |
|||
position="replace"> |
|||
<label for="use_parent_address"/> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='function']" |
|||
position="replace"> |
|||
<group colspan="4"> |
|||
<field name="function_id" string="Function"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']" |
|||
position="after"> |
|||
<templates> |
|||
<t t-name="kanban-box"> |
|||
<t t-set="color" t-value="kanban_color(record.color.raw_value)"/> |
|||
<div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')" |
|||
style="position: relative"> |
|||
<a t-if="! read_only_mode" type="delete" |
|||
style="position: absolute; right: 0; padding: 4px; diplay: inline-block"> |
|||
X |
|||
</a> |
|||
<div class="oe_module_vignette"> |
|||
<a type="open"> |
|||
<t t-if="record.has_image.raw_value === true"> |
|||
<img t-att-src="kanban_image('res.partner', 'image', |
|||
record.id.value, {'preview_image': 'image_small'})" |
|||
class="oe_avatar oe_kanban_avatar_smallbox"/> |
|||
</t> |
|||
<t t-if="record.image and record.image.raw_value !== false"> |
|||
<img t-att-src="'data:image/png;base64,'+record.image.raw_value" |
|||
class="oe_avatar oe_kanban_avatar_smallbox"/> |
|||
</t> |
|||
<t t-if="record.has_image.raw_value === false |
|||
and (!record.image or record.image.raw_value === false)"> |
|||
<t t-if="record.is_company.raw_value === true"> |
|||
<img t-att-src='_s + "/base/static/src/img/company_image.png"' |
|||
class="oe_kanban_image oe_kanban_avatar_smallbox"/> |
|||
</t> |
|||
<t t-if="record.is_company.raw_value === false"> |
|||
<img t-att-src='_s + "/base/static/src/img/avatar.png"' |
|||
class="oe_kanban_image oe_kanban_avatar_smallbox"/> |
|||
</t> |
|||
</t> |
|||
</a> |
|||
<div class="oe_module_desc"> |
|||
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border"> |
|||
<table class="oe_kanban_table"> |
|||
<tr> |
|||
<td class="oe_kanban_title1" align="left" valign="middle"> |
|||
<h4> |
|||
<a type="open"> |
|||
<field name="name"/> |
|||
</a> |
|||
</h4> |
|||
<i> |
|||
<t t-if="record.parent_id.raw_value and !record.function_id.raw_value"> |
|||
<field name="parent_id"/> |
|||
</t> |
|||
<t t-if="!record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
</t> |
|||
<t t-if="record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
, |
|||
<field name="parent_id"/> |
|||
</t> |
|||
</i> |
|||
<div> |
|||
<a t-if="record.email.raw_value" title="Mail" |
|||
t-att-href="'mailto:'+record.email.value"> |
|||
<field name="email"/> |
|||
</a> |
|||
</div> |
|||
<div t-if="record.phone.raw_value"> |
|||
Phone: <field name="phone"/> |
|||
</div> |
|||
<div t-if="record.mobile.raw_value"> |
|||
Mobile: <field name="mobile"/> |
|||
</div> |
|||
<div t-if="record.fax.raw_value"> |
|||
Fax: <field name="fax"/> |
|||
</div> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</templates> |
|||
</xpath> |
|||
have the same form for contact and other postions |
|||
<field name="parent_id" position="replace"> |
|||
<field name="parent_id" placeholder="Parent Organisation" |
|||
domain="[('is_company','=',True)]" |
|||
attrs="{'invisible': [('is_company','=', False)]}"/> |
|||
</field> |
|||
<xpath expr="//field[@name='child_ids']/form//field[@name='supplier']" |
|||
position="after"> |
|||
<group string="Bank Accounts"> |
|||
<field name="bank_ids" nolabel="1"/> |
|||
</group> |
|||
</xpath> |
|||
|
|||
<xpath expr="//field[@name='child_ids']/form//field[@name='function']" |
|||
position="after"> |
|||
<group colspan="4"> |
|||
<field name="start_date" /> |
|||
<field name="end_date"/> |
|||
<field name="naming"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='child_ids']/form//field[@name='function']" |
|||
position="replace"> |
|||
<group colspan="4"> |
|||
<field name="parent_id" |
|||
placeholder="Organism" |
|||
domain="[('is_company','=',True)]" |
|||
string="Parent Organisation" /> |
|||
<field name="function_id" |
|||
readonly="False" |
|||
options="{'create': false, 'create_edit': false}" |
|||
domain="[('id', 'in', parent.function_ids[0][2])]" |
|||
string="Function"/> |
|||
</group> |
|||
</xpath> |
|||
|
|||
<xpath expr="//field[@name='child_ids']/form//label[@for='use_parent_address']" |
|||
position="replace"> |
|||
<label for="use_parent_address"/> |
|||
</xpath> |
|||
|
|||
<xpath expr="//field[@name='child_ids']/kanban//field[@name='function']" |
|||
position="replace"> |
|||
<group colspan="4"> |
|||
<field name="function_id" string="Function"/> |
|||
</group> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']" |
|||
position="after"> |
|||
<templates> |
|||
<t t-name="kanban-box"> |
|||
<div class="oe_kanban_vignette oe_semantic_html_override"> |
|||
<a type="open"> |
|||
<t t-if="record.has_image.raw_value === true"> |
|||
<img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)" |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
<t t-if="record.has_image.raw_value === false"> |
|||
<t t-if="record.is_company.raw_value === true"> |
|||
<img t-att-src='_s + "/base/static/src/img/company_image.png"' |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
<t t-if="record.is_company.raw_value === false"> |
|||
<img t-att-src='_s + "/base/static/src/img/avatar.png"' |
|||
class="oe_kanban_image"/> |
|||
</t> |
|||
</t> |
|||
</a> |
|||
<div class="oe_kanban_details"> |
|||
<h4 class="oe_partner_heading"> |
|||
<a type="open"> |
|||
<field name="name"/> |
|||
</a> |
|||
</h4> |
|||
<div class="oe_kanban_partner_categories"/> |
|||
<div class="oe_kanban_partner_links"/> |
|||
<ul> |
|||
<li t-if="record.parent_id.raw_value and !record.function_id.raw_value"> |
|||
<field name="parent_id"/> |
|||
</li> |
|||
<li t-if="!record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
</li> |
|||
<li t-if="record.parent_id.raw_value and record.function_id.raw_value"> |
|||
<field name="function_id"/> |
|||
, |
|||
<field name="parent_id"/> |
|||
</li> |
|||
<li t-if="record.city.raw_value and !record.country.raw_value"> |
|||
<field name="city"/> |
|||
</li> |
|||
<li t-if="!record.city.raw_value and record.country.raw_value"> |
|||
<field name="country"/> |
|||
</li> |
|||
<li t-if="record.city.raw_value and record.country.raw_value"> |
|||
<field name="city"/> |
|||
, |
|||
<field name="country"/> |
|||
</li> |
|||
<li t-if="record.email.raw_value"> |
|||
<a t-attf-href="mailto:#{record.email.raw_value}"> |
|||
<field name="email"/> |
|||
</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</templates> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!-- Actions for Organisation --> |
|||
<record id="action_partner_customer_form" model="ir.actions.act_window"> |
|||
<field name="name">Company</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">res.partner</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">kanban,tree,form</field> |
|||
<field name="domain">[('is_company','=',1)]</field> |
|||
<field name="context" eval="{'default_is_company': True}"/> |
|||
<field name="filter" eval="True"/> |
|||
</record> |
|||
<!-- Actions for Contacts --> |
|||
<record id="action_partner_contact_form" model="ir.actions.act_window"> |
|||
<field name="name">Contacts</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">res.partner</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">kanban,tree,form</field> |
|||
<field name="domain">[('is_company','=',0)]</field> |
|||
<field name="filter" eval="True"/> |
|||
</record> |
|||
|
|||
<!--Add country,street fields in tree partner view--> |
|||
<record model="ir.ui.view" id="view_partner_tree_country_address"> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="country_id" position="replace"/> |
|||
<field name="name" position="after"> |
|||
<field name="country_id"/> |
|||
</field> |
|||
<field name="email" position="after"> |
|||
<field name="street" string="Address"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<!-- Inherit Categories adding functions --> |
|||
<record id="view_partner_category_functions_form" model="ir.ui.view"> |
|||
<field name="name">Partner Categories Functions</field> |
|||
<field name="model">res.partner.category</field> |
|||
<field name="inherit_id" ref="base.view_partner_category_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//form[@string='Partner Category']/group[1]" |
|||
position="after"> |
|||
<notebook position="inside"> |
|||
<page string="Functions"> |
|||
<separator string="Add function"/> |
|||
<group col="2" colspan="4"> |
|||
<field name="category_function_ids" nolabel="1"> |
|||
<tree string="Functions"> |
|||
<field name="sequence"/> |
|||
<field name="function_id"/> |
|||
</tree> |
|||
<form string="Function"> |
|||
<field name="function_id"/> |
|||
<field name="sequence"/> |
|||
</form> |
|||
</field> |
|||
</group> |
|||
</page> |
|||
</notebook> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<!--Replace company by Organisation--> |
|||
<record id="view_partner_simple_form" model="ir.ui.view"> |
|||
<field name="name">res.partner.simplified.form</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="arch" type="xml"> |
|||
<label for="is_company" position="replace"> |
|||
<label for="is_company" string="Is an Organism"/> |
|||
</label> |
|||
<field name="parent_id" position="replace"> |
|||
<field name="parent_id" |
|||
placeholder="Organism" |
|||
domain="[('is_company', '=', True)]" |
|||
context="{'default_is_company': True, 'default_supplier': supplier}" |
|||
attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}" |
|||
on_change="onchange_address(use_parent_address, parent_id)"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,3 @@ |
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" |
|||
"access_res_partner_function","access_res_partner_function_user","model_res_partner_function","base.group_user",1,1,1,1 |
|||
"access_res_partner_category_function","access_res_partner_category_function_user","model_res_partner_category_function","base.group_user",1,1,1,1 |
@ -0,0 +1,31 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from . import ( |
|||
test_functions, |
|||
test_partner_category, |
|||
) |
|||
|
|||
checks = [ |
|||
test_functions, |
|||
test_partner_category |
|||
] |
@ -0,0 +1,105 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
from openerp.osv.orm import browse_record |
|||
from openerp.tools import ustr |
|||
|
|||
|
|||
class Base_Test_function(TransactionCase): |
|||
""" |
|||
Simple test creating a function |
|||
This is a base class for function test cases. |
|||
Inherit from this and setup values. |
|||
""" |
|||
|
|||
def setUp(self, vals=None): |
|||
""" |
|||
Setting up function. |
|||
""" |
|||
if not vals: |
|||
vals = {} |
|||
# Default test values |
|||
self.vals = { |
|||
'name': u'This is a test function name with uniödé', |
|||
'acronym': u'This is a test function acronym with uniödé', |
|||
} |
|||
super(Base_Test_function, self).setUp() |
|||
self.vals = dict(self.vals.items() + vals.items()) |
|||
# Create the function object; we will be testing this, so store in self |
|||
function_pool = self.registry('res.partner.function') |
|||
self.function_id = function_pool.create( |
|||
self.cr, self.uid, self.vals, context=None |
|||
) |
|||
|
|||
def test_function(self): |
|||
""" |
|||
Checking the function creation. |
|||
""" |
|||
function_function = self.registry('res.partner.function') |
|||
function_obj = function_function.browse( |
|||
self.cr, self.uid, self.function_id, context=None |
|||
) |
|||
for field in self.vals: |
|||
val = function_obj[field] |
|||
if type(val) == browse_record: |
|||
self.assertEquals(self.vals[field], val.id, |
|||
"IDs for %s don't match: (%i != %i)" % |
|||
(field, self.vals[field], val.id)) |
|||
else: |
|||
self.assertEquals(ustr(self.vals[field]), ustr(val), |
|||
"Values for %s don't match: (%s != %s)" % |
|||
(field, ustr(self.vals[field]), ustr(val))) |
|||
|
|||
|
|||
class Test_function_bad(Base_Test_function): |
|||
""" |
|||
Simple test creating a function, test against bad values |
|||
""" |
|||
def setUp(self): |
|||
""" |
|||
Setting up function, then changing the values to test against. |
|||
""" |
|||
super(Test_function_bad, self).setUp() |
|||
# Change vals to something wrong |
|||
self.vals = {'name': 'This is the wrong function name', |
|||
'acronym': 'This is the wrong function acronym', |
|||
} |
|||
|
|||
def test_function(self): |
|||
""" |
|||
Checking the function creation, assertions should all be false. |
|||
""" |
|||
function_function = self.registry('res.partner.function') |
|||
function_obj = function_function.browse( |
|||
self.cr, self.uid, self.function_id, context=None |
|||
) |
|||
for field in self.vals: |
|||
val = function_obj[field] |
|||
if type(val) == browse_record: |
|||
self.assertNotEqual(self.vals[field], val.id, |
|||
"IDs for %s don't match: (%i != %i)" % |
|||
(field, self.vals[field], val.id)) |
|||
else: |
|||
self.assertNotEqual(ustr(self.vals[field]), ustr(val), |
|||
"Values for %s don't match: (%s != %s)" % |
|||
(field, ustr(self.vals[field]), ustr(val))) |
@ -0,0 +1,193 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
from openerp.osv.orm import browse_record |
|||
from openerp.tools import ustr |
|||
|
|||
|
|||
class Base_Test_partner_category(TransactionCase): |
|||
""" |
|||
Simple test creating a partner_category |
|||
This is a base class for partner_category test cases. |
|||
Inherit from this and setup values. |
|||
""" |
|||
|
|||
def setUp(self, vals=None): |
|||
""" |
|||
Setting up partner_category. |
|||
""" |
|||
if not vals: |
|||
vals = {} |
|||
# Default test values |
|||
self.vals = { |
|||
'name': 'This is a test partner_category name with unicödé', |
|||
'active': True, |
|||
} |
|||
super(Base_Test_partner_category, self).setUp() |
|||
# Create the parent |
|||
partner_category_partner = self.registry('res.partner.category') |
|||
self.vals['parent_id'] = partner_category_partner.create( |
|||
self.cr, self.uid, { |
|||
'name': 'Test parent', |
|||
'active': True, |
|||
}, context=None |
|||
) |
|||
|
|||
self.vals = dict(self.vals.items() + vals.items()) |
|||
# Create the partner_category object; we will be testing this, |
|||
# so store in self |
|||
self.partner_category_id = partner_category_partner.create( |
|||
self.cr, self.uid, self.vals, context=None |
|||
) |
|||
|
|||
def test_partner_category(self): |
|||
""" |
|||
Checking the partner_category creation. |
|||
""" |
|||
partner_category = self.registry('res.partner.category') |
|||
partner_category_obj = partner_category.browse( |
|||
self.cr, self.uid, self.partner_category_id, context=None |
|||
) |
|||
for field in self.vals: |
|||
val = partner_category_obj[field] |
|||
if type(val) == browse_record: |
|||
self.assertEquals(self.vals[field], val.id, |
|||
"IDs for %s don't match: (%i != %i)" % |
|||
(field, self.vals[field], val.id)) |
|||
else: |
|||
self.assertEquals(ustr(self.vals[field]), ustr(val), |
|||
"Values for %s don't match: (%s != %s)" % |
|||
(field, ustr(self.vals[field]), ustr(val))) |
|||
|
|||
|
|||
class Test_partner_category_bad(Base_Test_partner_category): |
|||
""" |
|||
Simple test creating a partner_category, test against bad values |
|||
""" |
|||
def setUp(self): |
|||
""" |
|||
Setting up partner_category, then changing the values to test against. |
|||
""" |
|||
super(Test_partner_category_bad, self).setUp() |
|||
# Change vals to something wrong |
|||
self.vals = {'name': 'This is the wrong partner_category name', |
|||
'active': False, |
|||
} |
|||
|
|||
def test_partner_category(self): |
|||
""" |
|||
Checking the partner_category creation, assertions should all be false. |
|||
""" |
|||
partner_category_partner_category = self.registry( |
|||
'res.partner.category' |
|||
) |
|||
partner_category_obj = partner_category_partner_category.browse( |
|||
self.cr, self.uid, self.partner_category_id, context=None |
|||
) |
|||
for field in self.vals: |
|||
val = partner_category_obj[field] |
|||
if type(val) == browse_record: |
|||
self.assertNotEqual(self.vals[field], val.id, |
|||
"IDs for %s don't match: (%i != %i)" % |
|||
(field, self.vals[field], val.id)) |
|||
else: |
|||
self.assertNotEqual(ustr(self.vals[field]), ustr(val), |
|||
"Values for %s don't match: (%s != %s)" % |
|||
(field, ustr(self.vals[field]), ustr(val))) |
|||
|
|||
|
|||
class test_partner_category(TransactionCase): |
|||
|
|||
def setUp(self): |
|||
super(test_partner_category, self).setUp() |
|||
# Clean up registries |
|||
self.registry('ir.model').clear_caches() |
|||
self.registry('ir.model.data').clear_caches() |
|||
# Get registries |
|||
self.user_model = self.registry("res.users") |
|||
self.partner_cat_model = self.registry("res.partner.category") |
|||
# Get context |
|||
self.context = self.user_model.context_get(self.cr, self.uid) |
|||
# Create parent partner category |
|||
self.test_parent_id = self.partner_cat_model.create( |
|||
self.cr, self.uid, { |
|||
'name': 'test_parent', |
|||
}, context=self.context) |
|||
|
|||
self.test_child_id = self.partner_cat_model.create( |
|||
self.cr, self.uid, { |
|||
'name': 'test_child', |
|||
'parent_id': self.test_parent_id, |
|||
}, context=self.context) |
|||
|
|||
self.test_grandchild_id = self.partner_cat_model.create( |
|||
self.cr, self.uid, { |
|||
'name': 'test_grandchild', |
|||
'parent_id': self.test_child_id, |
|||
}, context=self.context) |
|||
|
|||
self.test_orphan_id = self.partner_cat_model.create( |
|||
self.cr, self.uid, { |
|||
'name': 'test_orphan', |
|||
}, context=self.context) |
|||
|
|||
def test_name_search(self): |
|||
|
|||
self.assertItemsEqual( |
|||
self.partner_cat_model.name_search( |
|||
self.cr, self.uid, name='test_parent', context=self.context |
|||
), |
|||
[ |
|||
(self.test_child_id, 'test_parent / test_child'), |
|||
(self.test_grandchild_id, |
|||
'test_parent / test_child / test_grandchild'), |
|||
(self.test_parent_id, 'test_parent'), |
|||
] |
|||
) |
|||
self.assertItemsEqual( |
|||
self.partner_cat_model.name_search( |
|||
self.cr, self.uid, name='test_child', context=self.context |
|||
), |
|||
[ |
|||
(self.test_child_id, 'test_parent / test_child'), |
|||
(self.test_grandchild_id, |
|||
'test_parent / test_child / test_grandchild'), |
|||
] |
|||
) |
|||
self.assertItemsEqual( |
|||
self.partner_cat_model.name_search( |
|||
self.cr, self.uid, name='test_grandchild', context=self.context |
|||
), |
|||
[ |
|||
(self.test_grandchild_id, |
|||
'test_parent / test_child / test_grandchild'), |
|||
] |
|||
) |
|||
self.assertItemsEqual( |
|||
self.partner_cat_model.name_search( |
|||
self.cr, self.uid, name='test_orphan', context=self.context |
|||
), |
|||
[ |
|||
(self.test_orphan_id, 'test_orphan'), |
|||
] |
|||
) |
@ -0,0 +1,23 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from . import res_partner |
@ -0,0 +1,51 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
'name': 'Contacts by Functions - Partner Firstname Bindings', |
|||
'version': '0.1', |
|||
'category': 'Customer Relationship Management', |
|||
'summary': 'Contacts by Functions - Partner Firstname Bindings', |
|||
'description': """ |
|||
Contacts by Functions - Partner Firstname Bindings |
|||
================================================== |
|||
|
|||
Contributors |
|||
------------ |
|||
* El Hadji Dem (elhadji.dem@savoirfairelinux.com) |
|||
""", |
|||
'author': 'Savoir-faire Linux', |
|||
'website': 'www.savoirfairelinux.com', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'base_contact_function', |
|||
'partner_firstname', |
|||
], |
|||
'data': [ |
|||
'res_partner_view.xml', |
|||
], |
|||
'test': [], |
|||
'demo': [ |
|||
], |
|||
'installable': True, |
|||
'auto_install': True, |
|||
} |
@ -0,0 +1,27 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_contact_function_partner_firstname |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-01-03 07:16+0000\n" |
|||
"PO-Revision-Date: 2014-01-03 02:17-0500\n" |
|||
"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"X-Generator: Poedit 1.5.4\n" |
|||
|
|||
#. module: base_contact_function_partner_firstname |
|||
#: view:res.partner:0 |
|||
msgid "lastname" |
|||
msgstr "" |
|||
|
|||
#. module: base_contact_function_partner_firstname |
|||
#: view:res.partner:0 |
|||
msgid "Firstname" |
|||
msgstr "" |
@ -0,0 +1,27 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * base_contact_function_partner_firstname |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-01-03 07:17+0000\n" |
|||
"PO-Revision-Date: 2014-01-03 02:18-0500\n" |
|||
"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: 8bit\n" |
|||
"Plural-Forms: \n" |
|||
"X-Generator: Poedit 1.5.4\n" |
|||
|
|||
#. module: base_contact_function_partner_firstname |
|||
#: view:res.partner:0 |
|||
msgid "lastname" |
|||
msgstr "Nom" |
|||
|
|||
#. module: base_contact_function_partner_firstname |
|||
#: view:res.partner:0 |
|||
msgid "Firstname" |
|||
msgstr "Prénom" |
@ -0,0 +1,82 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2013 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import time |
|||
from openerp.osv import orm |
|||
|
|||
|
|||
class res_partner(orm.Model): |
|||
_inherit = 'res.partner' |
|||
|
|||
def create(self, cr, user, vals, context=None): |
|||
context = self._basecontact_check_context(cr, user, 'create', context) |
|||
if not vals.get('name') and vals.get('contact_id'): |
|||
vals['name'] = self.browse( |
|||
cr, user, vals['contact_id'], context=context).name |
|||
if vals.get('end_date'): |
|||
if vals.get('end_date', "Z") <= time.strftime('%Y-%m-%d'): |
|||
vals['active'] = False |
|||
if vals.get('contact_type') == 'standalone': |
|||
contact_vals = dict( |
|||
filter(lambda (k, v): k != 'parent_id', vals.iteritems()) |
|||
) |
|||
contact_vals['active'] = True |
|||
contact_vals['function_id'] = None |
|||
vals['contact_id'] = super(res_partner, self).create( |
|||
cr, user, contact_vals, context=context |
|||
) |
|||
self.write(cr, user, vals['contact_id'], { |
|||
'firstname': vals.get('firstname', ''), |
|||
'lastname': vals.get('lastname', ''), |
|||
}, context=context) |
|||
# Check if we create existing contact from company(ie: company is true) |
|||
# Check if we create another function from contact view |
|||
if vals.get('contact_type') == 'attached' or ( |
|||
not vals.get('contact_type') and vals.get('contact_id')): |
|||
contact_info = self.browse( |
|||
cr, user, vals.get('contact_id'), context=context) |
|||
vals['firstname'] = contact_info.firstname |
|||
vals['title'] = contact_info.title.id or '' |
|||
|
|||
if ('contact_id'in vals and ('reset_password' in context or |
|||
'install_mode' in context)): |
|||
return vals['contact_id'] |
|||
res = super(res_partner, self).create(cr, user, vals, context=context) |
|||
return res |
|||
|
|||
def write(self, cr, user, ids, vals, context=None): |
|||
context = self._basecontact_check_context(cr, user, 'write', context) |
|||
if vals.get('end_date'): |
|||
if vals.get('end_date', "Z") <= time.strftime('%Y-%m-%d'): |
|||
vals['active'] = False |
|||
if vals.get('contact_type') == 'standalone': |
|||
contact_vals = dict( |
|||
filter(lambda (k, v): k != 'parent_id', vals.iteritems()) |
|||
) |
|||
contact_vals['active'] = True |
|||
contact_vals['function_id'] = None |
|||
vals['contact_id'] = super(res_partner, self).write( |
|||
cr, user, contact_vals, context=context |
|||
) |
|||
return super(res_partner, self).write( |
|||
cr, user, ids, vals, context=context |
|||
) |
@ -0,0 +1,76 @@ |
|||
<?xml version = "1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<!--Redefine this part of view from firstname_partner module --> |
|||
<record id="view_partner_form_firstname_inherit11" model="ir.ui.view"> |
|||
<field name="name">res.partner.form.firstname.inherit11</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/> |
|||
<field name="arch" type="xml"> |
|||
<!--Redefine firstname field in view partner--> |
|||
<field name="firstname" position="replace"> |
|||
<group attrs="{'invisible': [('is_company', '=', True)]}"> |
|||
<field name="firstname"/> |
|||
</group> |
|||
</field> |
|||
<!--Redefine firstname field in contact view--> |
|||
<xpath expr="//form[@string='Contact']/sheet/div//field[@name='firstname']" position="replace"> |
|||
<field name="firstname" attrs="{'invisible': [('contact_type', '=', 'attached')]}"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<!--Replace name by full name in kanban view--> |
|||
<record id="view_partner_form_firstname_inherit11" model="ir.ui.view"> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base_contact_function.view_contact_by_function_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='other_contact_history_ids']/kanban//field[@name='name']" position="replace"> |
|||
<field name="lastname"/> |
|||
</xpath> |
|||
<xpath expr="//field[@name='other_contact_history_ids']/kanban/templates//t[@t-name='kanban-box']//div[@class='oe_kanban_details']//field[@name='name']" |
|||
position="before"> |
|||
<field name="firstname"/> |
|||
</xpath> |
|||
<!--Display firstname and name after Image--> |
|||
<xpath expr="//field[@name='other_contact_history_ids']/form[@string='Contact']/sheet//field[@name='image']" |
|||
position="after"> |
|||
<h1> |
|||
<field name="contact_id" style="width: 70%%" readonly="1"/> |
|||
</h1> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<!--Display firstname and name in kanban view for other position --> |
|||
<record id="view_partner_form_firstname_name" model="ir.ui.view"> |
|||
<field name="name">res.partner.form.firstname.name</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base_contact_function.view_position_info_form"/> |
|||
<field name="arch" type="xml"> |
|||
|
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='name']" |
|||
position="replace"/> |
|||
|
|||
<xpath expr="//field[@name='other_contact_ids']/form//field[@name='image']" |
|||
position="after"> |
|||
<h1> |
|||
<field name="contact_id" style="width: 70%%" readonly="1"/> |
|||
</h1> |
|||
</xpath> |
|||
|
|||
<!-- Don't display the label field --> |
|||
<xpath expr="//field[@name='other_contact_ids']/form//label[@for='name']" |
|||
position="replace"/> |
|||
|
|||
<!-- Add firstname before name in templates view --> |
|||
<xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/h4[@class='oe_partner_heading']//field[@name='name']" |
|||
position="before"> |
|||
<field name="firstname"/> |
|||
</xpath> |
|||
|
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,27 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2010 - 2014 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from . import test_partner |
|||
|
|||
checks = [ |
|||
test_partner, |
|||
] |
@ -0,0 +1,57 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# OpenERP, Open Source Management Solution |
|||
# This module copyright (C) 2010 - 2014 Savoir-faire Linux |
|||
# (<http://www.savoirfairelinux.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
|
|||
|
|||
class test_partner_contact_id(TransactionCase): |
|||
|
|||
def setUp(self): |
|||
super(test_partner_contact_id, self).setUp() |
|||
# Clean up registries |
|||
self.registry('ir.model').clear_caches() |
|||
self.registry('ir.model.data').clear_caches() |
|||
# Get registries |
|||
self.user_model = self.registry("res.users") |
|||
self.partner_model = self.registry("res.partner") |
|||
# Get context |
|||
self.context = self.user_model.context_get(self.cr, self.uid) |
|||
# Create values for test, contact also created |
|||
contact_id = self.partner_model.create(self.cr, self.uid, { |
|||
'name': u'Astérix', |
|||
'title': 1, |
|||
}, context=self.context) |
|||
self.vals = { |
|||
'name': u'Obélix', |
|||
'type': 'contact', |
|||
'contact_id': contact_id, |
|||
} |
|||
|
|||
def test_create_partner(self): |
|||
cr, uid, vals, context = self.cr, self.uid, self.vals, self.context |
|||
partner_id = self.partner_model.create(cr, uid, vals, context=context) |
|||
partner = self.partner_model.browse( |
|||
cr, uid, partner_id, context=context |
|||
) |
|||
# Creating the partner uses the name from the contact |
|||
self.assertEqual(partner.name, u'Astérix') |
|||
self.assertEqual(partner.lastname, u'Astérix') |
Write
Preview
Loading…
Cancel
Save
Reference in new issue