forked from OCA/l10n-brazil
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hooks.py
58 lines (48 loc) · 1.54 KB
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import logging
from odoo import _, tools
_logger = logging.getLogger(__name__)
def post_init_hook(cr, registry):
"""Import XML data to change core data"""
files = [
"data/l10n_br_cnab.structure.csv",
"data/l10n_br_cnab.batch.csv",
"data/cnab.payment.way.csv",
"data/l10n_br_cnab.line.csv",
"data/cnab.line.field.group.csv",
"data/l10n_br_cnab.line.field.csv",
"data/cnab.line.group.field.condition.csv",
"data/cnab.occurrence.csv",
"data/cnab.pix.key.type.csv",
"data/cnab.pix.transfer.type.csv",
]
_logger.info(_("Loading l10n_br_cnab_structure data files."))
for file in files:
tools.convert_file(
cr,
"l10n_br_cnab_structure",
file,
None,
mode="init",
noupdate=True,
kind="init",
)
cr.execute("select demo from ir_module_module where name='l10n_br_cnab_structure';")
if cr.fetchone()[0]:
demofiles = [
"demo/account_account.xml",
"demo/account_journal.xml",
"demo/payment_mode.xml",
"demo/res_partner_bank.xml",
"demo/account_invoice.xml",
]
_logger.info(_("Loading l10n_br_cnab_structure demo files."))
for file in demofiles:
tools.convert_file(
cr,
"l10n_br_cnab_structure",
file,
None,
mode="init",
noupdate=True,
kind="demo",
)