diff options
| author | Raphael Collet <rco@openerp.com> | 2012-04-20 15:00:58 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2012-04-20 15:00:58 +0200 |
| commit | 36f97a0f3ac25e4b7a053888f7e4dd6747e25404 (patch) | |
| tree | d463c7c591e5b47281c6226912d9e37463fcd573 /addons/document_ftp | |
| parent | 259295535a24c369b4745dccd0c15dded44692c6 (diff) | |
| parent | caf2acc46a2c8a1a9e64f79d3387c3201839743d (diff) | |
[MERGE] trunk-v62_knowledge_config-jap (config wizard of Knowledge)
bzr revid: rco@openerp.com-20120420130058-orf7juhf0mgxie6k
Diffstat (limited to 'addons/document_ftp')
| -rw-r--r-- | addons/document_ftp/__init__.py | 2 | ||||
| -rw-r--r-- | addons/document_ftp/__openerp__.py | 3 | ||||
| -rw-r--r-- | addons/document_ftp/res_config.py | 49 | ||||
| -rw-r--r-- | addons/document_ftp/res_config_view.xml | 18 |
4 files changed, 70 insertions, 2 deletions
diff --git a/addons/document_ftp/__init__.py b/addons/document_ftp/__init__.py index b86320f9909..7ba25cb0540 100644 --- a/addons/document_ftp/__init__.py +++ b/addons/document_ftp/__init__.py @@ -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: diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index c10cd913f56..f6ab4616b2d 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -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': [ diff --git a/addons/document_ftp/res_config.py b/addons/document_ftp/res_config.py new file mode 100644 index 00000000000..724b59afafe --- /dev/null +++ b/addons/document_ftp/res_config.py @@ -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:
\ No newline at end of file diff --git a/addons/document_ftp/res_config_view.xml b/addons/document_ftp/res_config_view.xml new file mode 100644 index 00000000000..159c0cf1025 --- /dev/null +++ b/addons/document_ftp/res_config_view.xml @@ -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> |
