Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2851 Lượt xem

Hi, 

Is it possible in Odoo to export a list of records from a module and then import them from the data directory on when the module loads? So for example if you export a csv file, can you put that csv into the data directory of a module to automatically load those records when the module is installed? The use case is that we have several custom records that we want loaded whenever the database is installed so that we don't have to manually recreate them.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can follow these steps:

Step 1: Put that csv file into the data folder of that module.

Step 2: Put the path to that csv file into the data command block of the __manifest__.py file of that module. For example:

'data': [
        'security/group.xml',
        'security/ir.model.access.csv',
        'security/security.xml',
        'data/res.country.state.csv',
        'data/account.account.type.csv',
        'data/account.group.csv'
    ],
    'installable': True,

Please contact me via email anhtuan.acoi@gmail.com if you need further assistance.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 24
1654
1
thg 11 24
2150
3
thg 12 23
20739
0
thg 5 21
7567
1
thg 11 16
3579