2010-03-02 10:56:55 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-03-02 04:55:33 +00:00
|
|
|
from osv import fields, osv
|
|
|
|
from service import web_services
|
|
|
|
import time
|
|
|
|
import wizard
|
|
|
|
import pooler
|
|
|
|
|
|
|
|
class wiki_wiki_page_open(osv.osv_memory):
|
|
|
|
_name = "wiki.wiki.page.open"
|
|
|
|
_description = "wiz open page"
|
|
|
|
_columns = {
|
|
|
|
|
|
|
|
}
|
|
|
|
def _open_wiki_page(self, cr, uid, ids, context):
|
|
|
|
""" Opens Wiki Page of Group"""
|
2010-03-02 10:56:55 +00:00
|
|
|
for group in self.pool.get('wiki.groups').browse(cr, uid,ids):
|
2010-03-02 04:55:33 +00:00
|
|
|
|
2010-03-02 10:56:55 +00:00
|
|
|
for openpage in self.pool.get('wiki.wiki.page.open').browse(cr, uid,ids):
|
2010-03-02 04:55:33 +00:00
|
|
|
|
|
|
|
value = {
|
2010-03-02 10:56:55 +00:00
|
|
|
'domain': "[('group_id','=',%d)]" % (group.id),
|
|
|
|
'name': 'Wiki Page',
|
|
|
|
'view_type': 'form',
|
|
|
|
'view_mode': 'form,tree',
|
|
|
|
'res_model': 'wiki.wiki',
|
|
|
|
'view_id': False,
|
|
|
|
'type': 'ir.actions.act_window',
|
2010-03-02 04:55:33 +00:00
|
|
|
}
|
|
|
|
if group.method == 'page':
|
|
|
|
value['res_id'] = group.home.id
|
|
|
|
elif group.method == 'list':
|
|
|
|
value['view_type'] = 'form'
|
|
|
|
value['view_mode'] = 'tree,form'
|
|
|
|
elif group.method == 'tree':
|
2010-03-02 10:56:55 +00:00
|
|
|
view_id = pool.get('ir.ui.view').search(cr, uid, [('name','=','wiki.wiki.tree.childs')])
|
2010-03-02 04:55:33 +00:00
|
|
|
value['view_id'] = view_id
|
2010-03-02 10:56:55 +00:00
|
|
|
value['domain'] = [('group_id','=',group.id),('parent_id','=',False)]
|
2010-03-02 04:55:33 +00:00
|
|
|
value['view_type'] = 'tree'
|
|
|
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
wiki_wiki_page_open()
|
2010-03-02 10:56:55 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|