-1

I am trying to upload and import a csv file. When I chose file I'm getting warning/ error of file_type False. When Iam debugging the code I'm getting file content in binary, file_name also, but getting file_type field as false.

this is the error.

here is my .py code

file = fields.Binary(string='Input file')
file_type = fields.Char(string='Content Type', size=128)
file_name = fields.Char(string='File Name', size=128)

Here is the view code

<group>
     <field name="file" filename="file_name"/>
     <field name="file_name" invisible="1"/>
     <field name="file_type" invisible="True" attrs="{'readonly':[('file_type','!=', False)]}" />
     <field name="size" invisible="True" />
</group>

Help appreciated.

1 Answers1

1

You should read below file:

PY: https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/ir/ir_attachment.py,

XML: https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/ir/ir_attachment_view.xml

Here you are doing wrong,

<field name="file_type" invisible="True" attrs="{'readonly':[('file_type','!=', False)]}" />
Prashant
  • 704
  • 10
  • 23