diff --git a/addons/thunderbird/installer.py b/addons/thunderbird/installer.py index 7e6aac6f8c1..f5f04b86fe9 100644 --- a/addons/thunderbird/installer.py +++ b/addons/thunderbird/installer.py @@ -41,7 +41,7 @@ class thunderbird_installer(osv.osv_memory): '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."), + '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) } diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py index 80d2b7eacbd..f91a4e29737 100644 --- a/addons/thunderbird/partner/partner.py +++ b/addons/thunderbird/partner/partner.py @@ -92,7 +92,7 @@ class tinythunderbird_partner(osv.osv): partner=add_obj.read(cr,user,partner_ids,['partner_id']) 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,19 @@ 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) def thunderbird_objectsearch(self,cr,user,vals): diff --git a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi index ffb25365525..ef42a9a0c14 100644 Binary files a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi and b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi differ