如何在openerp 7上导入文件?

时间:2015-10-05 13:49:33

标签: xml python-2.7 openerp openerp-7

我尝试将文件导入到openerp 7并使用字段$.getJSON("Kategorie1.php", function (data) { //this will be called only after request completion window.nrFragen = JSON.parse(data); window.alert(data) }); //this will be called immediately after $.getJSON, it won't wait for request completion window.alert(window.nrFragen); ,但它没有给我文件的名称,只是内容二进制文件。

如何恢复文件名?

1 个答案:

答案 0 :(得分:0)

Your Python model:

'source_file': fields.binary('Your binary file'),
'filename': fields.char('Filename'),

Your XML view:

<field name="filename" invisible="1"/>
<field name="source_file" filename="filename"/>

And this way you will have the file name stored in the variable filename.

Hope it helps.