diff --git a/addons/thunderbird/__init__.py b/addons/thunderbird/__init__.py new file mode 100644 index 00000000000..5b7582a98f0 --- /dev/null +++ b/addons/thunderbird/__init__.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +############################################################################## +# +# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import partner + diff --git a/addons/thunderbird/__terp__.py b/addons/thunderbird/__terp__.py new file mode 100644 index 00000000000..3447b0377c2 --- /dev/null +++ b/addons/thunderbird/__terp__.py @@ -0,0 +1,61 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +############################################################################## +# +# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +{ + "name" : "Thunderbird Interface", + "version" : "1.0", + "author" : "Axelor", + "website" : "http://www.axelor.com/", + "depends" : ["base","crm"], + "category" : "Generic Modules/Thunderbird interface", + "init_xml" : [], + "demo_xml" : [], + "update_xml" : [], + "active": False, + "installable": True +} diff --git a/addons/thunderbird/i18n/fr_BE.po b/addons/thunderbird/i18n/fr_BE.po new file mode 100644 index 00000000000..a5e18aec9b8 --- /dev/null +++ b/addons/thunderbird/i18n/fr_BE.po @@ -0,0 +1,83 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * thunderbird +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.6\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-11-26 06:05:17+0000\n" +"PO-Revision-Date: 2009-11-26 06:05:17+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: thunderbird +#: field:tinythunderbird.partner,copy_to:0 +msgid "Copy To" +msgstr "" + +#. module: thunderbird +#: constraint:ir.model:0 +msgid "The Object name must start with x_ and not contain any special character !" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,description:0 +msgid "Description" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,reference:0 +msgid "Reference" +msgstr "" + +#. module: thunderbird +#: model:ir.model,name:thunderbird.model_tinythunderbird_partner +msgid "Thunderbid mails" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,attachments:0 +msgid "Attached Files" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,res_user_id:0 +msgid "User" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,receiver:0 +msgid "Receiver" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,date:0 +msgid "Date" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,title:0 +msgid "Subject" +msgstr "" + +#. module: thunderbird +#: code:addons/thunderbird/partner/partner.py:0 +#, python-format +msgid "Archive" +msgstr "" + +#. module: thunderbird +#: model:ir.module.module,shortdesc:thunderbird.module_meta_information +msgid "Thunderbird Interface" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,sender:0 +msgid "Sender" +msgstr "" + diff --git a/addons/thunderbird/i18n/thunderbird.pot b/addons/thunderbird/i18n/thunderbird.pot new file mode 100644 index 00000000000..a5e18aec9b8 --- /dev/null +++ b/addons/thunderbird/i18n/thunderbird.pot @@ -0,0 +1,83 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * thunderbird +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.6\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-11-26 06:05:17+0000\n" +"PO-Revision-Date: 2009-11-26 06:05:17+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: thunderbird +#: field:tinythunderbird.partner,copy_to:0 +msgid "Copy To" +msgstr "" + +#. module: thunderbird +#: constraint:ir.model:0 +msgid "The Object name must start with x_ and not contain any special character !" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,description:0 +msgid "Description" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,reference:0 +msgid "Reference" +msgstr "" + +#. module: thunderbird +#: model:ir.model,name:thunderbird.model_tinythunderbird_partner +msgid "Thunderbid mails" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,attachments:0 +msgid "Attached Files" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,res_user_id:0 +msgid "User" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,receiver:0 +msgid "Receiver" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,date:0 +msgid "Date" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,title:0 +msgid "Subject" +msgstr "" + +#. module: thunderbird +#: code:addons/thunderbird/partner/partner.py:0 +#, python-format +msgid "Archive" +msgstr "" + +#. module: thunderbird +#: model:ir.module.module,shortdesc:thunderbird.module_meta_information +msgid "Thunderbird Interface" +msgstr "" + +#. module: thunderbird +#: field:tinythunderbird.partner,sender:0 +msgid "Sender" +msgstr "" + diff --git a/addons/thunderbird/partner/__init__.py b/addons/thunderbird/partner/__init__.py new file mode 100644 index 00000000000..5b7582a98f0 --- /dev/null +++ b/addons/thunderbird/partner/__init__.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +############################################################################## +# +# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import partner + diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py new file mode 100644 index 00000000000..d3aa9020444 --- /dev/null +++ b/addons/thunderbird/partner/partner.py @@ -0,0 +1,195 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## +############################################################################## +# +# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import time +import ir +from osv import osv,fields +import base64 +import netsvc +from tools.translate import _ + +class tinythunderbird_partner(osv.osv): + + def _links_get(self, cr, uid, context={}): + obj = self.pool.get('res.request.link') + ids = obj.search(cr, uid, []) + res = obj.read(cr, uid, ids, ['object', 'name'], context) + + return [(r['object'], r['name']) for r in res] + + _name = "tinythunderbird.partner" + _description="Thunderbid mails" + _rec_name="sender" + _columns = { + 'sender':fields.char("Sender",size=128,required=True,select=True), + 'receiver':fields.text("Receiver"), + "copy_to":fields.text("Copy To"), + "date":fields.date("Date",select=True), + "title":fields.char("Subject",size=128,select=True), + "description":fields.text("Description"), + "reference":fields.reference("Reference", selection=_links_get, size=128), + "res_user_id":fields.many2one("res.users","User"), + "attachments":fields.text("Attached Files",readonly=True), + } + _defaults = { + 'res_user_id':lambda obj,cr,uid,context: uid, + 'date': lambda *a: time.strftime('%Y-%m-%d') + } + + def thunderbird_mailcreate(self,cr,user,vals): + dictcreate = dict(vals) + import email + header_name = email.Header.decode_header(dictcreate['name']) + dictcreate['name'] = header_name and header_name[0] and header_name[0][0] + add_obj=self.pool.get('res.partner.address') + case_pool=self.pool.get('crm.case') + partner_ids=add_obj.search(cr,user,[('email','=',dictcreate['email_from'])]) + partner=add_obj.read(cr,user,partner_ids,['partner_id']) + if partner: + dictcreate.update({'partner_id':partner[0]['partner_id'][0]}) + search_id = self.pool.get('res.request.link').search(cr,user,[('object','=',dictcreate['ref'].split(',')[0])]) + if not search_id: + create_link_id = self.pool.get('res.request.link').create(cr,user,{'name':dictcreate['ref'].split(',')[0],'object':dictcreate['ref'].split(',')[0]}) + create_id = self.pool.get('crm.case').create(cr, user, dictcreate) + cases=case_pool.browse(cr,user,[create_id]) + case_pool._history(cr, user, cases, _('Archive'), history=True, email=False) + return create_id + + def thunderbird_createcontact(self,cr,user,vals): + dictcreate = dict(vals) + create_id = self.pool.get('res.partner.address').create(cr, user, dictcreate) + return create_id + + def thunderbird_createpartner(self,cr,user,vals): + dictcreate = dict(vals) + search_id = self.pool.get('res.partner').search(cr, user,[('name','=',dictcreate['name'])]) + if search_id: + return 0 + create_id = self.pool.get('res.partner').create(cr, user, dictcreate) + return create_id + + def thunderbird_searchobject(self,cr,user,vals): + dictcreate = dict(vals) + search_id = self.pool.get('ir.model').search(cr, user,[('model','=',dictcreate['model'])]) + return (search_id and search_id[0]) or 0 + + def thunderbird_searchcontact(self,cr,user,vals): + search_id1 = self.pool.get('res.partner.address').search(cr,user,[('name','ilike',vals)]) + search_id2 = self.pool.get('res.partner.address').search(cr,user,[('email','=',vals)]) + if search_id1: + return self.pool.get('res.partner.address').name_get(cr, user, search_id1) + elif search_id2: + return self.pool.get('res.partner.address').name_get(cr, user, search_id2) + return [] + + def thunderbird_tempsearch(self,cr,user,vals): + if vals[0]: + value = vals[0][0] + if vals[1]: + obj = vals[1]; + name_get=[] + er_val=[] + for object in obj: + if object == 'res.partner.address': + search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)]) + search_id2 = self.pool.get(object).search(cr,user,[('email','=',value)]) + if search_id1: + name_get.append(object) + name_get.append(self.pool.get(object).name_get(cr, user, search_id1)) + elif search_id2: + name_get.append(object) + name_get.append(self.pool.get(object).name_get(cr, user, search_id2)) + else: + try: + search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)]) + if search_id1: + name_get.append(object) + name_get.append(self.pool.get(object).name_get(cr, user, search_id1)) + except: + er_val.append(object) + continue + if len(er_val) > 0: + name_get.append('error') + name_get.append(er_val) + return name_get + + def thunderbird_attachment(self,cr,user,vals): + dictcreate = dict(vals) + datas = [dictcreate['datas']] + name = [dictcreate['name']] + if(dictcreate['datas'].__contains__(',')): + name = dictcreate['name'].split(',') + datas = dictcreate['datas'].split(',') + for i in range(0,datas.__len__()): + dictcreate['name'] = name[i] + dictcreate['datas'] = datas[i] + create_id = self.pool.get('ir.attachment').create(cr,user,dictcreate) + return 0 + + def thunderbird_login(self,cr,user,vals): + dictcreate = dict(vals) + service = netsvc.LocalService('common') + res = service.login(dictcreate['db'],dictcreate['login'],dictcreate['passwd']) + return res or 0 + + def read(self, cr, user, ids, fields=None, context={}, load='_classic_read'): + ret_read = super(tinythunderbird_partner, self).read(cr, user, ids,fields,context,load) + for read_data in ret_read: + attachments = self.pool.get('ir.attachment').search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])]) + attechments_data = self.pool.get('ir.attachment').read(cr,user,attachments,['name']) + file_names = [a['name'] for a in attechments_data] + text_atteched = '\n'.join(file_names) + read_data['attachments'] = text_atteched + return ret_read + + def unlink(self, cr, uid, ids, context={}): + attachments = self.pool.get('ir.attachment').search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)]) + self.pool.get('ir.attachment').unlink(cr,uid,attachments) + return super(tinythunderbird_partner, self).unlink(cr, uid, ids,context) + +tinythunderbird_partner() \ No newline at end of file diff --git a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi new file mode 100755 index 00000000000..7fb57818c15 Binary files /dev/null and b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi differ