forked from OCA/knowledge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hooks.py
31 lines (29 loc) · 1.22 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
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import SUPERUSER_ID, api
def post_init_hook(cr, pool):
env = api.Environment(
cr, SUPERUSER_ID, pool['res.users'].context_get(cr, SUPERUSER_ID)
)
for action in env['ir.actions.act_window'].search([
'|',
('enduser_help', '!=', False),
('advanced_help', '!=', False),
]):
if action.enduser_help and not action.enduser_document_page_ids:
env['document.page'].create({
'name': action.name,
'parent_id':
env.ref('help_popup_document_page.page_category').id,
'help_popup_window_action_ids': [(4, action.id)],
'content': action.enduser_help
})
if action.advanced_help and not action.advanced_document_page_ids:
env['document.page'].create({
'name': action.name,
'parent_id':
env.ref('help_popup_document_page.page_category').id,
'help_popup_window_advanced_action_ids': [(4, action.id)],
'content': action.advanced_help
})