[IMP] thunderbird

bzr revid: hmo@tinyerp.com-20100803121146-ncmti6j0dq3uj6uy
This commit is contained in:
Harry (OpenERP) 2010-08-03 17:41:46 +05:30
parent ebcc4b52ed
commit 676fc12591
5 changed files with 16 additions and 57 deletions

View File

@ -79,25 +79,23 @@ class thunderbird_partner(osv.osv_memory):
def update_contact(self,cr,user,vals):
dictcreate = dict(vals)
res_id = dictcreate.get('res_id',False)
result={}
if res_id:
dictcreate.pop('res_id')
address_obj = self.pool.get('res.partner.address')
address_data = address_obj.read(cr, user, int(res_id), [])
result={ 'partner_id': address_data['partner_id'] and address_data['partner_id'][0] or False,
'country_id': dictcreate['country_id'] and int(dictcreate['country_id'][0]) or False,
'state_id': dictcreate['state_id'] and int(dictcreate['state_id'][0]) or False,
'name': dictcreate['name'],
'street': dictcreate['street'],
'street2': dictcreate['street2'],
'zip': dictcreate['zip'],
'city': dictcreate['city'],
'phone': dictcreate['phone'],
'fax': dictcreate['fax'],
'mobile': dictcreate['mobile'],
'email': dictcreate['email'],
}
address_obj.write(cr, user,res_id,result )
result={
'partner_id': dictcreate.get('partner_id',False),
'country_id': dictcreate.get('country_id', False),
'state_id': dictcreate('state_id', False),
'name': dictcreate.get('name', False),
'street': dictcreate.get('street', False),
'street2': dictcreate.get('street2', False),
'zip': dictcreate.get('zip', False),
'city': dictcreate.get('city', False),
'phone': dictcreate.get('phone', False),
'fax': dictcreate.get('fax', False),
'mobile': dictcreate.get('mobile', False),
'email': dictcreate.get('email', False),
}
address_obj.write(cr, user,res_id,result )
return True
def create_partner(self,cr,user,vals):
@ -114,16 +112,6 @@ class thunderbird_partner(osv.osv_memory):
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):
# 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 address_obj.name_get(cr, user, search_id1)
# elif search_id2:
# return address_obj.name_get(cr, user, search_id2)
# return []
def search_checkbox(self,cr,user,vals):
if vals[0]:
value = vals[0][0]
@ -172,29 +160,6 @@ class thunderbird_partner(osv.osv_memory):
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)
attach_obj = self.pool.get('ir.attachment')
for read_data in ret_read:
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={}):
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 list_alldocument(self,cr,user,vals):
obj_list= [('crm.lead','Lead'),('project.issue','Project Issue'), ('hr.applicant','HR Recruitment')]
object=[]

View File

@ -18,11 +18,7 @@
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="80"/>
<textbox id="txtcport" width="100" />
</hbox>
<hbox id="test">
<label id="lblprotocol" control="txtcprotocol" value="&lblservices.label;" width="80"/>
<textbox id="txtcprotocol" width="150" />
</hbox>
</hbox>
</groupbox>
<hbox align="rightr">
<spacer width="50"/>

View File

@ -1412,7 +1412,6 @@ function createContact(){
strmethod.data = 'create_contact';
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
var a = ['partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
var b = [getPartnerId(),getSenderName(),document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,getSenderEmail()];
var arrofarr = dictcontact(a,b);

View File

@ -1,6 +1,5 @@
<!ENTITY lblurl.label "Server: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblservices.label "Protocol Connection: ">
<!ENTITY imagecancel.value "chrome://openerp_plugin/skin/Error.gif">
<!ENTITY imageok.value "chrome://openerp_plugin/skin/Success.gif">