From b43d2e2f829bcfda3d39a0001daaf08ad611877c Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Fri, 31 Oct 2014 18:19:52 -0400 Subject: [PATCH] [ADD] base_contact_function module Allow to manage contacts by function --- base_contact_function/__init__.py | 28 + base_contact_function/__openerp__.py | 51 ++ .../i18n/base_contact_function.pot | 265 +++++++++ base_contact_function/i18n/fr.po | 290 ++++++++++ base_contact_function/res_partner.py | 97 ++++ base_contact_function/res_partner_category.py | 57 ++ .../res_partner_category_function.py | 47 ++ .../res_partner_category_view.xml | 54 ++ base_contact_function/res_partner_function.py | 51 ++ .../res_partner_function_view.xml | 43 ++ base_contact_function/res_partner_view.xml | 526 ++++++++++++++++++ .../security/ir.model.access.csv | 3 + base_contact_function/tests/__init__.py | 31 ++ base_contact_function/tests/test_functions.py | 105 ++++ .../tests/test_partner_category.py | 193 +++++++ 15 files changed, 1841 insertions(+) create mode 100644 base_contact_function/__init__.py create mode 100644 base_contact_function/__openerp__.py create mode 100644 base_contact_function/i18n/base_contact_function.pot create mode 100644 base_contact_function/i18n/fr.po create mode 100644 base_contact_function/res_partner.py create mode 100644 base_contact_function/res_partner_category.py create mode 100644 base_contact_function/res_partner_category_function.py create mode 100644 base_contact_function/res_partner_category_view.xml create mode 100644 base_contact_function/res_partner_function.py create mode 100644 base_contact_function/res_partner_function_view.xml create mode 100644 base_contact_function/res_partner_view.xml create mode 100644 base_contact_function/security/ir.model.access.csv create mode 100644 base_contact_function/tests/__init__.py create mode 100644 base_contact_function/tests/test_functions.py create mode 100644 base_contact_function/tests/test_partner_category.py diff --git a/base_contact_function/__init__.py b/base_contact_function/__init__.py new file mode 100644 index 000000000..cea049ce4 --- /dev/null +++ b/base_contact_function/__init__.py @@ -0,0 +1,28 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +from . import ( + res_partner, + res_partner_function, + res_partner_category, + res_partner_category_function, +) diff --git a/base_contact_function/__openerp__.py b/base_contact_function/__openerp__.py new file mode 100644 index 000000000..01d652325 --- /dev/null +++ b/base_contact_function/__openerp__.py @@ -0,0 +1,51 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +{ + '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 + +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, +} diff --git a/base_contact_function/i18n/base_contact_function.pot b/base_contact_function/i18n/base_contact_function.pot new file mode 100644 index 000000000..f648c9df0 --- /dev/null +++ b/base_contact_function/i18n/base_contact_function.pot @@ -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 "" diff --git a/base_contact_function/i18n/fr.po b/base_contact_function/i18n/fr.po new file mode 100644 index 000000000..67b649f36 --- /dev/null +++ b/base_contact_function/i18n/fr.po @@ -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 \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" diff --git a/base_contact_function/res_partner.py b/base_contact_function/res_partner.py new file mode 100644 index 000000000..2eec8d106 --- /dev/null +++ b/base_contact_function/res_partner.py @@ -0,0 +1,97 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +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", + ), + + } diff --git a/base_contact_function/res_partner_category.py b/base_contact_function/res_partner_category.py new file mode 100644 index 000000000..09daa83fd --- /dev/null +++ b/base_contact_function/res_partner_category.py @@ -0,0 +1,57 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +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)], + context=context) + if child_ids: + ids.extend(child_ids) + else: + ids = self.search(cr, user, args, limit=limit, context=context) + return self.name_get(cr, user, ids, context) diff --git a/base_contact_function/res_partner_category_function.py b/base_contact_function/res_partner_category_function.py new file mode 100644 index 000000000..d3a9e6fe4 --- /dev/null +++ b/base_contact_function/res_partner_category_function.py @@ -0,0 +1,47 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +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', + ), + } diff --git a/base_contact_function/res_partner_category_view.xml b/base_contact_function/res_partner_category_view.xml new file mode 100644 index 000000000..38ce8098d --- /dev/null +++ b/base_contact_function/res_partner_category_view.xml @@ -0,0 +1,54 @@ + + + + + + List Form + res.partner.category + + + + + + + + + List Tree + res.partner.category + child_ids + + + + + + + + + List + ir.actions.act_window + res.partner.category + [('parent_id','=',False)] + tree + tree + + +

+ Here is a list of all your partners classified by category. +

+
+
+ + + + + +
+
diff --git a/base_contact_function/res_partner_function.py b/base_contact_function/res_partner_function.py new file mode 100644 index 000000000..fa7088977 --- /dev/null +++ b/base_contact_function/res_partner_function.py @@ -0,0 +1,51 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2013 Savoir-faire Linux +# (). +# +# 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 . +# +############################################################################## + +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', + ), + } diff --git a/base_contact_function/res_partner_function_view.xml b/base_contact_function/res_partner_function_view.xml new file mode 100644 index 000000000..1a98c6fff --- /dev/null +++ b/base_contact_function/res_partner_function_view.xml @@ -0,0 +1,43 @@ + + + + + + + Function Tree View + res.partner.function + + + + + + + + + + + + + Function Form View + res.partner.function + +
+ + + + +
+ +
+
+ + + + Functions + + res.partner.function + tree,form + + +
+
diff --git a/base_contact_function/res_partner_view.xml b/base_contact_function/res_partner_view.xml new file mode 100644 index 000000000..0e4220d86 --- /dev/null +++ b/base_contact_function/res_partner_view.xml @@ -0,0 +1,526 @@ + + + + + + contact.functions.form.inherit + res.partner + + + + + +