Odoo Help

0
1

Yes, there is a way:

Assuming that your module names "demo", your model has the identifier "demo.howto" and the binary field is "file":

1. Put in the folder demo/static/src/binary your pdf files (howto.pdf).

2. Create a file with data records to register in the folder demo/data (howto_data.xml):

<odoo noupdate="1">

    <data>

        <record id="howto_1" model="demo.howto">

            <field file="demo/static/src/binary/howto.pdf" name="file" type="base64" />

        </record>

    </data>

</odoo>

3. Register the data file in the data section of the __manifest__.py

    # always loaded

    'data': [

        'security/ir.model.access.csv',

        'data/howto_data.xml',

        'views/views.xml',

        'views/templates.xml',

    ],

4. Install module and the data will be loaded.

 

Thanks! Needed only the 2. point, but a nice explanation how to load data on module install/upgrade.

Samo Arko
on 12/7/18, 4:57 AM

You are welcome. I'm glad I could help you.

Daniel Almaguer La Rosa
on 12/7/18, 11:49 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Odoo Training Center

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

Test it now

Question tools

2 follower(s)

Stats

Asked: 12/6/18, 9:46 AM
Seen: 82 times
Last updated: 12/7/18, 4:54 AM