[IMP] knowledge: remove field server_address_port from the res_config.py and add...
authorJagdish Panchal (Open ERP) <jap@tinyerp.com>
Mon, 2 Apr 2012 08:37:16 +0000 (14:07 +0530)
committerJagdish Panchal (Open ERP) <jap@tinyerp.com>
Mon, 2 Apr 2012 08:37:16 +0000 (14:07 +0530)
bzr revid: jap@tinyerp.com-20120402083716-y7t0w1v0vof8v04z

addons/document/res_config.py
addons/document/res_config_view.xml
addons/document_ftp/__init__.py
addons/document_ftp/__openerp__.py
addons/document_ftp/res_config.py [new file with mode: 0644]
addons/document_ftp/res_config_view.xml [new file with mode: 0644]

index e43d856..d9fa0db 100644 (file)
@@ -34,42 +34,12 @@ class knowledge_configuration(osv.osv_memory):
                            help ="""It install the wiki_faq."""), 
         'module_document_ftp': fields.boolean('Share repositories (FTP)',
                            help ="""It install the document_ftp."""),
-        'server_address_port': fields.char('Server address/IP and port',size=128,
-                           help ="""It assign server address/IP and port."""),               
         'module_document_webdav': fields.boolean('Share Repositories (WebDAV)',
                            help ="""It install the document_webdav."""),                                   
                              
     }
     
-    _defaults = {
-        'server_address_port': config.get('ftp_server_host', 'localhost') + ':' + config.get('ftp_server_port', '8021'),
-    }
-              
-    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
-        res = super(knowledge_configuration, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
-        ir_module = self.pool.get('ir.module.module')
-        module_id= ir_module.search(cr, uid, [('name','=','document_ftp')])
-        modle_state = ir_module.browse(cr,uid, module_id[0],context=context).state
-        doc = etree.XML(res['arch'])
-        nodes = doc.xpath("//field[@name='server_address_port']")
-        if modle_state == 'uninstalled':
-            for node in nodes:
-                node.set('invisible', '1')
-            res['arch'] = etree.tostring(doc)
-        return res
     
-    def set_ftp_configurations(self, cr, uid, ids, context=None):
-        data_pool = self.pool.get('ir.model.data')
-        ir_module = self.pool.get('ir.module.module')
-        module_id= ir_module.search(cr, uid, [('name','=','document_ftp')])
-        modle_state = ir_module.browse(cr,uid, module_id[0],context=context).state
-        if modle_state == 'installed':
-            conf = self.browse(cr, uid, ids[0], context=context)
-            doc_id = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
-            doc_ids = data_pool.browse(cr, uid, doc_id, context=context).res_id
-            self.pool.get('ir.actions.url').write(cr, uid, [doc_ids], {'url': 'ftp://'+(conf.server_address_port or 'localhost:8021')+'/' + cr.dbname+'/'})
-        return True
-        
 knowledge_configuration()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
index 3d96d0d..b24984c 100644 (file)
@@ -9,15 +9,13 @@
             <field name="arch" type="xml">
                <form string ="Knowledge Application">
                    <separator string="Wiki" colspan="4"/>
-                   <group  colspan="2" col="4">
+                   <group  colspan="4" col="4">
                         <field name="module_wiki_quality_manual"/>
                         <field name="module_wiki_faq"/>
                    </group>
-                   <separator string="Document" colspan="4"/>
-                   <group  colspan="2" col="4">
+                   <separator string="Documents" colspan="4"/>
+                   <group  colspan="4" col="4">
                         <field name="module_document_ftp"/>
-                        <field name="server_address_port"/>
-                        <newline/>
                         <field name="module_document_webdav"/>
                    </group>                               
                 </form>
index b86320f..7ba25cb 100644 (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:
index c10cd91..f6ab461 100644 (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': [
diff --git a/addons/document_ftp/res_config.py b/addons/document_ftp/res_config.py
new file mode 100644 (file)
index 0000000..556c024
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- 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
+from lxml import etree
+
+class documnet_ftp_configuration(osv.osv_memory):
+    _name = 'knowledge.configuration'
+    _inherit = 'knowledge.configuration'
+    _columns = {
+        'server_address_port': fields.char('Server address/IP and port',size=128,
+                           help ="""It assign server address/IP and port."""),               
+    }
+    
+
+    _defaults = {
+        'server_address_port': config.get('ftp_server_host', 'localhost') + ':' + config.get('ftp_server_port', '8021'),
+    }
+    
+# 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 (file)
index 0000000..07793c2
--- /dev/null
@@ -0,0 +1,16 @@
+<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">
+                    <field name="server_address_port"/>
+                </xpath>
+            </field>
+        </record>
+    </data>
+</openerp>