Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4495 มุมมอง

Hello everybody :)

I am using the ir.attachment module.

SO i am creating my own document and then i automatically add it to the attachment by this way:

filename="/opt/file.txt"

files = open(filename,'rb').read()

print files

ir_values={

'name':"image_name",

'index_content': files,

'datas_fname': "image_name",

'type':'binary',

# 'partner_id':ids[0],

'res_model':'declaration.cnss',

'res_id':ids[0],

}

self.pool.get('ir.attachment').create(cr,uid,ir_values,context=context)

And, unfortunately i have got this error:

Internal Server Error

{"message": "OpenERP WebClient Error", "code": 300, "data": {"debug": "Client Traceback (most recent call last):\n File \"/opt/openerp/v7/addons/web/http.py\", line 285, in dispatch\n r = method(self, **self.params)\n File \"/opt/openerp/v7/addons/web/controllers/main.py\", line 1286, in saveas\n filecontent = base64.b64decode(res.get(field, ''))\n File \"/usr/lib/python2.7/base64.py\", line 73, in b64decode\n return binascii.a2b_base64(s)\nTypeError: must be string or buffer, not bool\n", "type": "client_exception"}}

Can anyone help please :/

Regards.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 15
3109
2
พ.ค. 22
34021
0
มี.ค. 19
4097
0
ม.ค. 19
5152
4
ก.พ. 24
12391