-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.py
36 lines (31 loc) · 1.18 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
# Copyright (C) 2020 - Gabriel Cardoso de Faria <gabriel.cardoso@kmee.com.br>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import SUPERUSER_ID, api, tools
def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
coa_simple_tmpl = env.ref("l10n_br_coa_simple.l10n_br_coa_simple_chart_template")
if env["ir.module.module"].search_count(
[
("name", "=", "l10n_br_account"),
("state", "=", "installed"),
]
):
from odoo.addons.l10n_br_account.hooks import load_fiscal_taxes
# Relate fiscal taxes to account taxes.
load_fiscal_taxes(env, coa_simple_tmpl)
# Load COA to Demo Company
if not tools.config.get("without_demo"):
company = env.ref(
"l10n_br_base.empresa_simples_nacional", raise_if_not_found=False
)
if company:
coa_simple_tmpl.try_loading(company=company)
tools.convert_file(
cr,
"l10n_br_coa_simple",
"demo/account_journal.xml",
None,
mode="init",
noupdate=True,
kind="init",
)