1. create a wizard
2 add this function into that button
def get_document(self, cr, uid, ids, context=None):
matter_obj = self.pool.get('project.project')
attach_obj=self.pool.get('ir.attachment')
path = '/home/logicious/Downloads/document/demo_document.csv'
files = glob.glob(path)
for file in files:
f=open(file, 'r')
for m in f.readlines():
print '%s' % m
get_lst=m.split(',')
if len(get_lst)>=4:
print'-------',get_lst[1]
print'#########',get_lst[4]
d = get_lst[4]
print 'dddddddddddddddd',d
search_ids= matter_obj.search(cr,uid,[('name','=',get_lst[1])])
print'%%%%%%%%%',len(search_ids)
if len(search_ids):
matter_data = matter_obj.browse(cr,uid,search_ids[0])
if get_lst[4]!=False:
print']]]]]]]',"/home/logicious/Downloads/document/files"+get_lst[4]
if get_lst[4].find('.')!=-1:
ext=get_lst[4].split('.')[1]
file_name=get_lst[4].split('.')[0]+ext.lower()
if os.path.exists("/home/logicious/Downloads/document/files/"+file_name):
print'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
m = open('/home/logicious/Downloads/document/files/'+file_name,'rb')
attach_vals = {
'name': str(get_lst[4]),
'datas': base64.b64encode(m.read()),
'description': 'files',
'res_name': matter_data.name,
'res_model': 'project.project',
'res_id': matter_data.id,
}
attach_id = attach_obj.create(cr, uid, attach_vals)
f.close()
return 'True'
thanks
prasanth
actually you need to write python script for that...
friend did you find a solution really i need the same thing like you
@Drees Far: Friend i find the solution how to solve that, i am doing based up that.I will updated it on tomorrow morning.
Thanks a lot friend happy for hearing this ;)
@Drees Far: i didn't complete that yet..still am i am trying... if you want my code i will send by mail.. mail me on this prasanth.logicious@gmail.com