summaryrefslogtreecommitdiff
path: root/addons/thunderbird
diff options
context:
space:
mode:
authorVir (Open ERP) <vir@tinyerp.com>2010-06-02 13:53:32 +0530
committerVir (Open ERP) <vir@tinyerp.com>2010-06-02 13:53:32 +0530
commita00a181d98fdb43a9987e8117ef70eac2d09638a (patch)
treeffe3e986d4427b3132e268e2c83ba11fca27eb62 /addons/thunderbird
parentd1cfcf4c5cf99b98883613418d076e606864e8b7 (diff)
parent8397cd973da9ae5033ad11a3c121f02e6aa7d653 (diff)
[Merge] Merge with trunk addons
bzr revid: vir@tinyerp.com-20100602082332-bq3vbck48iyd4thx
Diffstat (limited to 'addons/thunderbird')
-rw-r--r--addons/thunderbird/installer.py28
-rw-r--r--addons/thunderbird/partner/partner.py62
-rw-r--r--addons/thunderbird/plugin/tiny_plugin-2.0.xpibin0 -> 68817 bytes
-rw-r--r--addons/thunderbird/security/ir.model.access.csv2
-rw-r--r--addons/thunderbird/thunderbird_installer.xml26
5 files changed, 66 insertions, 52 deletions
diff --git a/addons/thunderbird/installer.py b/addons/thunderbird/installer.py
index 4e0f4435d31..c93e10080ed 100644
--- a/addons/thunderbird/installer.py
+++ b/addons/thunderbird/installer.py
@@ -29,38 +29,28 @@ class thunderbird_installer(osv.osv_memory):
_name = 'thunderbird.installer'
_inherit = 'res.config.installer'
- def process_plugin(self, cr, uid, ids, context):
- """
- Default Attach Thunderbird Plug-in File.
- """
- data = {}
- file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
- data['plugin_file'] = base64.encodestring(file.read())
- self.write(cr, uid, ids, data)
- return False
-
- def process_pdf_file(self, cr, uid, ids, context):
- """
- Default Attach Thunderbird Plug-in Installation File.
- """
- data = {}
+ def default_get(self, cr, uid, fields, context={}):
+ data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r')
data['pdf_file'] = base64.encodestring(pdf_file.read())
- self.write(cr, uid, ids, data)
- return False
+ file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
+ data['plugin_file'] = base64.encodestring(file.read())
+ return data
_columns = {
'name':fields.char('File name', size=34),
'pdf_name':fields.char('File name', size=64),
'thunderbird':fields.boolean('Thunderbird Module ', help="Allows you to select an object that you’d like to add to your email and its attachments."),
- 'plugin_file':fields.binary('Thunderbird Plug-in', readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbir."),
- 'pdf_file':fields.binary('Thunderbird Plug-in Installation File', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
+ 'plugin_file':fields.binary('Thunderbird Plug-in', readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbird."),
+ 'pdf_file':fields.binary('Installation Manual', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
+ 'description':fields.text('Description', readonly=True)
}
_defaults = {
'thunderbird' : True,
'name' : 'tiny_plugin-2.0.xpi',
'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf',
+ 'description' : """ * Save The thunderbird plug­in Follow the following step to install thunderbird plug­in. \n -> 1. From Menu Bar, Open Tools ­> Add ons. \n -> 2. Now click on install button and a browser window will appear. \n -> 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. \n -> 4. Click on Install Now and restart Thunderbird. \n -> 5. Now Thunderbird plug­in is installed."""
}
thunderbird_installer()
diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py
index f7c3f41a776..f91a4e29737 100644
--- a/addons/thunderbird/partner/partner.py
+++ b/addons/thunderbird/partner/partner.py
@@ -90,9 +90,9 @@ class tinythunderbird_partner(osv.osv):
case_pool=self.pool.get(dictcreate.get('object','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:
+ if partner and partner[0] and partner[0]['partner_id']:
dictcreate.update({'partner_id':partner[0]['partner_id'][0]})
- create_id = self.pool.get(dictcreate.get('object','crm.case')).create(cr, user, dictcreate)
+ create_id = case_pool.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
@@ -104,10 +104,11 @@ class tinythunderbird_partner(osv.osv):
def thunderbird_createpartner(self,cr,user,vals):
dictcreate = dict(vals)
- search_id = self.pool.get('res.partner').search(cr, user,[('name','=',dictcreate['name'])])
+ address_obj = self.pool.get('res.partner')
+ search_id = address_obj.search(cr, user,[('name','=',dictcreate['name'])])
if search_id:
return 0
- create_id = self.pool.get('res.partner').create(cr, user, dictcreate)
+ create_id = address_obj.create(cr, user, dictcreate)
return create_id
def thunderbird_searchobject(self,cr,user,vals):
@@ -116,12 +117,13 @@ class tinythunderbird_partner(osv.osv):
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)])
+ address_obj = self.pool.get('res.partner.address')
+ search_id1 = address_obj.search(cr,user,[('name','ilike',vals)])
+ search_id2 = address_obj.search(cr,user,[('email','=',vals)])
if search_id1:
- return self.pool.get('res.partner.address').name_get(cr, user, search_id1)
+ return address_obj.name_get(cr, user, search_id1)
elif search_id2:
- return self.pool.get('res.partner.address').name_get(cr, user, search_id2)
+ return address_obj.name_get(cr, user, search_id2)
return []
def thunderbird_tempsearch(self,cr,user,vals):
@@ -132,21 +134,22 @@ class tinythunderbird_partner(osv.osv):
name_get=[]
er_val=[]
for object in obj:
+ dyn_object = self.pool.get(object)
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)])
+ search_id1 = dyn_object.search(cr,user,[('name','ilike',value)])
+ search_id2 = dyn_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))
+ name_get.append(dyn_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))
+ name_get.append(dyn_object.name_get(cr, user, search_id2))
else:
try:
- search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)])
+ search_id1 = dyn_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))
+ name_get.append(dyn_object.name_get(cr, user, search_id1))
except:
er_val.append(object)
continue
@@ -179,17 +182,38 @@ class tinythunderbird_partner(osv.osv):
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)
+ attach_obj = self.pool.get('ir.attachment')
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'])
+ attachments = attach_obj.search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])])
+ attechments_data = sattach_obj.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)
+ attach_obj = self.pool.get('ir.attachment')
+ attachments = attach_obj.search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)])
+ attach_obj.unlink(cr,uid,attachments)
return super(tinythunderbird_partner, self).unlink(cr, uid, ids,context)
-tinythunderbird_partner()
+ def thunderbird_objectsearch(self,cr,user,vals):
+ obj_list= [('crm.claim', 'Claim'), ('crm.lead','Lead'), ('crm.meeting','Metting'), ('crm.opportunity','Opportunity'), ('crm.phonecall','Phonecall'), ('crm.fundraising','Fund raising'), ('crm.helpdesk','Helpdesk')]
+ object=[]
+ model_obj = self.pool.get('ir.model')
+ for obj in obj_list:
+ if model_obj.search(cr, user, [('model', '=', obj[0])]):
+ object.append(obj)
+ return object
+
+ def thunderbird_list_search_object(self,cr,user,vals):
+ model_obj = self.pool.get('ir.model')
+ object=''
+ for obj in vals[0][1].split(','):
+ if model_obj.search(cr, user, [('model', '=', obj)]):
+ object += obj + ","
+ else:
+ object += "null,"
+ return object
+
+tinythunderbird_partner()
diff --git a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi
new file mode 100644
index 00000000000..ef42a9a0c14
--- /dev/null
+++ b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi
Binary files differ
diff --git a/addons/thunderbird/security/ir.model.access.csv b/addons/thunderbird/security/ir.model.access.csv
index fdd310a0679..b7cc3262e2d 100644
--- a/addons/thunderbird/security/ir.model.access.csv
+++ b/addons/thunderbird/security/ir.model.access.csv
@@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_tinythunderbird_partner","tinythunderbird.partner","model_tinythunderbird_partner",,1,1,1,1
-
+"access_thunderbird_installer","thunderbird.installer","model_thunderbird_installer","base.group_user",1,1,1,1
diff --git a/addons/thunderbird/thunderbird_installer.xml b/addons/thunderbird/thunderbird_installer.xml
index 356282d2de5..34812a38cee 100644
--- a/addons/thunderbird/thunderbird_installer.xml
+++ b/addons/thunderbird/thunderbird_installer.xml
@@ -29,13 +29,11 @@
<newline/>
<field name="plugin_file" filename="name"/>
- <button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
<newline/>
<field name="pdf_file" filename="pdf_name"/>
- <button name="process_pdf_file" icon="gtk-execute" string="Get Plugin Installation File" type="object"/>
<newline/>
<separator string="Thunderbird plugin installation note." colspan="4"/>
- <label colspan="8" string="Save The thunderbird plug­in Follow the following step to install thunderbird plug­in ? 1. From Menu Bar, Open Tools ­> Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plug­in is installed."/>
+ <field name="description" nolabel="1" colspan="8"/>
</group>
</group>
</data>
@@ -74,16 +72,18 @@
<label align="0.0" string="This module is required for the thuderbird plug-in to work properly.This allows you to select an object that you had like to add to your email and its attachments. You can select a partner, a task, a project, an analytical account, or any other object and attach selected mail as .eml file in attachment of selected record." width="200"/>
</group>
<group colspan="8">
- <separator string="Thunderbird" colspan="4"/>
- <field name="thunderbird"/>
- <field name="name" invisible="1"/>
- <newline/>
- <field name="plugin_file"/>
- <button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
- <newline/>
- <separator string="Thunderbird plugin installation note." colspan="4"/>
- <label colspan="8" string="Save The thunderbird plug­in Follow the following step to install thunderbird plug­in ? 1. From Menu Bar, Open Tools ­> Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plug­in is installed."/>
- </group>
+ <field name="thunderbird"/>
+ <field name="name" invisible="1"/>
+ <field name="pdf_name" invisible="1"/>
+ <newline/>
+
+ <field name="plugin_file" filename="name"/>
+ <newline/>
+ <field name="pdf_file" filename="pdf_name"/>
+ <newline/>
+ <separator string="Thunderbird plugin installation note." colspan="4"/>
+ <field name="description" nolabel="1" colspan="8"/>
+ </group>
</group>
</group>
<separator string="" colspan="4"/>