[MERGE] trunk-v62_knowledge_config-jap (config wizard of Knowledge)

bzr revid: rco@openerp.com-20120420130058-orf7juhf0mgxie6k
This commit is contained in:
Raphael Collet 2012-04-20 15:00:58 +02:00
commit 36f97a0f3a
6 changed files with 124 additions and 2 deletions

View File

@ -56,4 +56,22 @@ class report_config_settings(osv.osv_memory):
This installs the module report_webkit_sample."""),
}
class knowledge_config_settings(osv.osv_memory):
_name = 'knowledge.configuration'
_inherit = 'res.config.settings'
_columns = {
'module_wiki_quality_manual': fields.boolean('Use an internal wiki to group FAQ',
help="""It installs the wiki_quality_manual module."""),
'module_wiki_faq': fields.boolean('Track quality with wiki',
help="""It install the wiki_faq."""),
'module_document': fields.boolean('Full Document Indexing',
help="""It install the document."""),
'module_document_ftp': fields.boolean('Share repositories (FTP)',
help="""It install the document_ftp."""),
'module_document_webdav': fields.boolean('Share Repositories (WebDAV)',
help="""It install the document_webdav."""),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -63,5 +63,41 @@
<menuitem id="menu_reporting_configuration" name="Reporting" parent="base.menu_config"
sequence="45" action="action_reporting_configuration"/>
<record id="view_knowledge_configuration" model="ir.ui.view">
<field name="name">Configure Knowledge</field>
<field name="model">knowledge.configuration</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Configure Knowledge" layout="manual">
<div class="oe_form_topbar">
<button string="Apply" type="object" name="execute"/>
<button string="Cancel" special="cancel"/>
</div>
<sheet layout="auto">
<separator string="Wiki" colspan="4"/>
<field name="module_wiki_quality_manual"/>
<newline/>
<field name="module_wiki_faq"/>
<separator string="Documents" colspan="4"/>
<field name="module_document"/>
<newline/>
<field name="module_document_ftp"/>
<newline/>
<field name="module_document_webdav"/>
</sheet>
</form>
</field>
</record>
<record id="action_knowledge_configuration" model="ir.actions.act_window">
<field name="name">Configure Knowledge</field>
<field name="res_model">knowledge.configuration</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_knowledge_configuration" name="Knowledge" parent="base.menu_config"
sequence="19" action="action_knowledge_configuration"/>
</data>
</openerp>

View File

@ -20,7 +20,7 @@
##############################################################################
import ftpserver
import wizard
import res_config
post_load = ftpserver.start_server
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -40,7 +40,8 @@ FTP client.
'update_xml': [
'wizard/ftp_configuration_view.xml',
'wizard/ftp_browse_view.xml',
'security/ir.model.access.csv'
'security/ir.model.access.csv',
'res_config_view.xml',
],
'demo_xml': [],
'test': [

View File

@ -0,0 +1,49 @@
# -*- 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/>.
#
##############################################################################
from osv import fields, osv
from tools import config
class documnet_ftp_setting(osv.osv_memory):
_name = 'knowledge.configuration'
_inherit = 'knowledge.configuration'
_columns = {
'url': fields.char('Browse Documents',size=64,
help ="""It allow to browse the document from the relative URL""", readonly=True),
}
def get_default_ftp_config(self, cr, uid, ids, context=None):
ir_values = self.pool.get('ir.actions.url')
user_pool = self.pool.get('res.users')
current_user = user_pool.browse(cr, uid, uid, context=context)
data_pool = self.pool.get('ir.model.data')
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
aid = data_pool.browse(cr, uid, aid, context=context).res_id
ftp_url = self.pool.get('ir.actions.url').browse(cr, uid, aid, context=context)
url = ftp_url.url and ftp_url.url.split('ftp://') or []
if url:
url = url[1]
if url[-1] == '/':
url = url[:-1]
else:
url = '%s:%s' %(ftpserver.HOST, ftpserver.PORT)
return {'url':'ftp://%s@%s'%(current_user.login, url)}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,18 @@
<openerp>
<data>
<record id="view_document_ftp_configuration" model="ir.ui.view">
<field name="name">Knowledge Application</field>
<field name="model">knowledge.configuration</field>
<field name="type">form</field>
<field name="inherit_id" ref="document.view_knowledge_configuration"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='module_document_ftp']" position="after">
<group colspan="2" col="2">
<field name="url" widget="url" colspan="2"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>