In my recent Odoo installation I needed to change some predefined data in multiple databases, so I decided to create a custom module that applies the changes to every database I choose to install it. One way to do this is by using SQL statements directly.
I used this instructions to create a new module.
After that I added the SQL statements to a file
data/data.sql in the module directory:
UPDATE res_country SET address_format=E'%(street)s\n%(street2)s\n%(zip)s %(city)s %(state_code)s' WHERE code = 'AT'; UPDATE res_lang SET date_format = '%d.%m.%Y' WHERE code = 'de_DE';
This instructions change the
address_format for Austria and the
date_format for the german language.
Now reference the new file in your
'data': [ # 'security/ir.model.access.csv', 'data/data.sql', 'views/views.xml', 'views/templates.xml', ],
The SQL instructions while be executed every time the module is installed/updated.