Odoo Ayuda


12 Respuestas

Borni DHIFI Túnez

--Borni DHIFI--
| 7 9 11
Tunis, Túnez
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 


Skype : dhifi.borni

Borni DHIFI Túnez
15/5/13 14:24


you can use fields.binary. you can save your file in database.

in your file.py

 'data': fields.binary('File'),

in your file.xml:

<field name="data" />
<button name="import_file" string="Import" type="object"  class="oe_highlight" />

if you clik in button Import it call function import_file

in your function :

create a temp file for treatment content data.

 def import_file(self, cr, uid, ids, context=None):
    fileobj = TemporaryFile('w+')

    # your treatment


7 Comentarios
Joaquin España
15/5/13 14:27

I need a button on my form that allows me to look at the client workstation, the file you want to upload to the server, and already once uploaded to launch the program evaluate the content of the file. After parsing the file's contents, if correct, shall be recorded in the custom tables, but never before.

Hadooc, Borni DHIFI Túnez
15/5/13 14:36

yes retrieve contents of file to download to a temporary file then do tests on this file if correct save this object in your database else display a warning for example.

Joaquin España
15/5/13 14:44

That is: in my custom program (my. py file), I introduce the sentence: 'data': fields.binary ('File') Along with the content of the file. Xml, this creates a button on the form. Is it right? Once this is when my role would create the temporary file, and then proceed to treatment. Is it right?

Hadooc, Borni DHIFI Túnez
15/5/13 15:10

I edit my answer .it is now clear?

Joaquin España
15/5/13 16:51

Sorry, but my English is not very fluid, so I asked confirmation, would not bother or offend. I apologize. Now if I understood your answer. The try tomorrow. Thank you. Best regards from Spain.

Rove.design GmbH, Stefan Reisich Alemania
30/1/14 10:32

In your function you try to write data to a temporary file, but data is not defined in this function. How you get data?

Laxicon Solution, Shivam Dudhat India
10/1/16 23:51

@Joaquin i want to import sale order line from import button like i want add sale order line three(3) way 1-> add sale order line as current working oi's ok 2-> add sale oder line from my CSV/Excel file when i click on import button in sale order form view 3-> add sale order line both like 1, 2 how it is possible ?

Evans Bernier Canadá
13/8/15 16:44


How can we do this without storing the file in the database? I would like to store the file in filepath on server.


1 Comentario
Jérémy Kersten (jke) Bélgica
13/8/15 17:13

You can use ir.attachment with the filestore

Edy Kendengis Indonesia
14/8/15 1:41

Storing field data to filestore (file store on folder data/filestore)

images= fields.Many2one(comodel_name="ir.attachment", string="Images")

Realizar una pregunta
Keep Informed
3 seguidor(es)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now