diff --git a/partner_blacklist/README.rst b/partner_blacklist/README.rst new file mode 100644 index 000000000..106598dc5 --- /dev/null +++ b/partner_blacklist/README.rst @@ -0,0 +1,18 @@ +.. image httpsimg.shields.iobadgelicence-AGPL--3-blue.svg + alt License AGPL-3 + +{ Blacklist partner} +============== + +This module allows you to add a category 'blacklist' in the form of your customers. If a customer is in this category it will appear in red in OpenERP. + +Credits +======= + +Contributors +------------ + BHC SPRL + Guillaume Leclercq guillaume.leclercq@bhc.be + Rudy valentin rudy.valentin@bhc.be + Nicolas Doclot nicolas.doclot@bhc.be + diff --git a/partner_blacklist/__init__.py b/partner_blacklist/__init__.py new file mode 100644 index 000000000..f937b64c3 --- /dev/null +++ b/partner_blacklist/__init__.py @@ -0,0 +1,18 @@ +###################################################################################################### +# +# Copyright (C) B.H.C. sprl - All Rights Reserved, http://www.bhc.be +# +# 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. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +# including but not limited to the implied warranties +# of merchantability and/or fitness for a particular purpose +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see +import partner_listing diff --git a/partner_blacklist/__openerp__.py b/partner_blacklist/__openerp__.py new file mode 100644 index 000000000..a11c33eb2 --- /dev/null +++ b/partner_blacklist/__openerp__.py @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- +###################################################################################################### +# +# Copyright (C) B.H.C. sprl - All Rights Reserved, http://www.bhc.be +# +# 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. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +# including but not limited to the implied warranties +# of merchantability and/or fitness for a particular purpose +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see + + +{ + 'name': 'blacklist partner', + 'version': '1.0', + 'category': 'Generic Modules/Others', + 'description': """ + This module allows you to add a category 'blacklist' in the form of your customers. + If a customer is in this category it will appear in red in OpenERP. + """, + 'author': 'BHC', + 'website': 'www.bhc.com/', + 'depends': ['base','sale','warning'], + 'images': ['images/customer.png','images/customer_tree.png','images/sale_order.png'], + 'init_xml': [], + 'update_xml': ['partner_listing.xml'], + 'demo_xml': [], + 'installable': True, + 'active': False, +} + diff --git a/partner_blacklist/i18n/fr.po b/partner_blacklist/i18n/fr.po new file mode 100644 index 000000000..44bfcc810 --- /dev/null +++ b/partner_blacklist/i18n/fr.po @@ -0,0 +1,61 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * crm_blacklist +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0-20130825-231127\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-18 08:53+0000\n" +"PO-Revision-Date: 2013-11-18 08:53+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: crm_blacklist +#: view:res.partner:0 +msgid "Contacts" +msgstr "Contacts" + +#. module: crm_blacklist +#: view:product.product:0 +msgid "Warnings" +msgstr "Avertissements" + +#. module: crm_blacklist +#: view:res.partner:0 +msgid "Warning on the Picking" +msgstr "Avertissement sur les Colisages" + +#. module: crm_blacklist +#: view:res.partner:0 +msgid "Warning on the Purchase Order" +msgstr "Avertissement sur les commandes d'achat" + +#. module: crm_blacklist +#: code:addons/crm_blacklist/partner_listing.py:27 +#: code:addons/crm_blacklist/partner_listing.py:35 +#: field:res.partner,blacklist:0 +#: field:res.partner.category,blacklist:0 +#: model:res.partner.category,name:crm_blacklist.category_bl +#, python-format +msgid "Blacklist" +msgstr "Liste noire" + +#. module: crm_blacklist +#: view:res.partner:0 +msgid "Warning on the Invoice" +msgstr "Avertissement sur la Facture" + +#. module: crm_blacklist +#: model:ir.model,name:crm_blacklist.model_res_partner_category +msgid "Partner Categories" +msgstr "Catégories de partenaires" + +#. module: crm_blacklist +#: model:ir.model,name:crm_blacklist.model_res_partner +msgid "Partner" +msgstr "Partenaire" \ No newline at end of file diff --git a/partner_blacklist/images/customer.png b/partner_blacklist/images/customer.png new file mode 100644 index 000000000..6be16c2a3 Binary files /dev/null and b/partner_blacklist/images/customer.png differ diff --git a/partner_blacklist/images/customer_tree.png b/partner_blacklist/images/customer_tree.png new file mode 100644 index 000000000..bf09d1360 Binary files /dev/null and b/partner_blacklist/images/customer_tree.png differ diff --git a/partner_blacklist/images/sale_order.png b/partner_blacklist/images/sale_order.png new file mode 100644 index 000000000..b4290430a Binary files /dev/null and b/partner_blacklist/images/sale_order.png differ diff --git a/partner_blacklist/partner_listing.py b/partner_blacklist/partner_listing.py new file mode 100644 index 000000000..d46632e3c --- /dev/null +++ b/partner_blacklist/partner_listing.py @@ -0,0 +1,56 @@ +###################################################################################################### +# +# Copyright (C) B.H.C. sprl - All Rights Reserved, http://www.bhc.be +# +# 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. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +# including but not limited to the implied warranties +# of merchantability and/or fitness for a particular purpose +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see +# -*- coding: utf-8 -*- +import datetime +from lxml import etree +import math +import pytz +import urlparse + +import openerp +from openerp import tools, api +from openerp.osv import osv, fields +from openerp.osv.expression import get_unaccent_wrapper +from openerp.tools.translate import _ + +class res_partner(osv.Model): + _inherit = "res.partner" + + def _check_categ(self, cr, uid, ids, name, args, context): + res={} + bl=self.pool.get('res.partner.category').search(cr,uid,[('blacklist','=',True)]) + if bl and len(ids)==1: + for i in self.browse(cr,uid,ids): + for j in i.category_id: + if j.blacklist==True: + res[i.id]=1 + else: + res[i.id]=0 + return res + + _columns = { + 'blacklist': fields.function(_check_categ, method=True, string=_('Blacklist'), type='boolean', store=True ), + } +res_partner() + +class category(osv.Model): + _inherit = "res.partner.category" + _columns = { + 'blacklist': fields.boolean(_('Blacklist')), + } +category() \ No newline at end of file diff --git a/partner_blacklist/partner_listing.xml b/partner_blacklist/partner_listing.xml new file mode 100644 index 000000000..575e11536 --- /dev/null +++ b/partner_blacklist/partner_listing.xml @@ -0,0 +1,75 @@ + + + + + Blacklist + + + + + + res.partner.tree + res.partner + + + + + + + + + + + + + + + + + + + + res.partner.warning.form.inherit.in + res.partner + + + + + + + + + + + + + + + + + + + + product.warning.form.inherit + product.product + + + + + + + + Partner Categories + res.partner.category + + + + + + + + + diff --git a/partner_blacklist/static/src/img/icon.png b/partner_blacklist/static/src/img/icon.png new file mode 100644 index 000000000..fc010826a Binary files /dev/null and b/partner_blacklist/static/src/img/icon.png differ