Jordi Esteve (Zikzakmedia) avatar Jordi Esteve (Zikzakmedia) committed 6db1c42

Renamend model network.protocol to network.service. And network.protocol.type to network.protocol

Comments (0)

Files changed (10)

         NetworkSoftwareType,
         NetworkSoftware,
         NetworkSoftwareLogin,
-        NetworkProtocolType,
         NetworkProtocol,
+        NetworkSoftwareService,
         module='network', type_='model')
     'NetworkSoftwareType',
     'NetworkSoftware',
     'NetworkSoftwareLogin',
-    'NetworkProtocolType',
     'NetworkProtocol',
+    'NetworkSoftwareService',
 ]
 
 
         )
     logins = fields.One2Many('network.software.login', 'software',
         'Login Users')
-    protocols = fields.One2Many('network.protocol', 'software',
-        'Connection Protocols')
+    services = fields.One2Many('network.software.service', 'software',
+        'Connection Services')
 
     def get_network(self, name):
         return self.hardware.network.id
     @classmethod
     @ModelView.button
     def compute_url(cls, logins):
-        Protocol = Pool().get('network.protocol')
+        Service = Pool().get('network.software.service')
         for login in logins:
-            protocols = Protocol.search([('software', '=', login.software)])
+            services = Service.search([('software', '=', login.software)])
             url = login.software.network.domain
             if not url:
                 url = login.software.network.ip_address
-            if url and protocols:
-                protocol = protocols[0]
-                login.url = (protocol.name.name.lower() + "://" + login.login +
-                    "@" + url + ":" + str(protocol.port))
+            if url and services:
+                service = services[0]
+                login.url = (service.protocol.name.lower() + "://" +
+                    login.login + "@" + url + ":" + str(service.port))
                 login.save()
 
 
-class NetworkProtocolType(ModelSQL, ModelView):
-    'Network Protocol Type'
-    __name__ = 'network.protocol.type'
+class NetworkProtocol(ModelSQL, ModelView):
+    'Network Protocol'
+    __name__ = 'network.protocol'
 
     name = fields.Char('Protocol Name', required=True)
 
     @classmethod
     def __setup__(cls):
-        super(NetworkProtocolType, cls).__setup__()
+        super(NetworkProtocol, cls).__setup__()
         cls._order.insert(0, ('name', 'ASC'))
 
 
-class NetworkProtocol(ModelSQL, ModelView):
-    'Network Protocol'
-    __name__ = 'network.protocol'
+class NetworkSoftwareService(ModelSQL, ModelView):
+    'Network Software Service'
+    __name__ = 'network.software.service'
+    _rec_name = 'url'
 
-    name = fields.Many2One('network.protocol.type', 'Protocol', required=True)
-    note = fields.Text('Notes')
+    protocol = fields.Many2One('network.protocol', 'Protocol', required=True)
     port = fields.Integer('Port', required=True)
     software = fields.Many2One('network.software', 'Software', required=True)
+    note = fields.Text('Notes')
     url = fields.Char('URL')
 
     @classmethod
     def __setup__(cls):
-        super(NetworkProtocol, cls).__setup__()
+        super(NetworkSoftwareService, cls).__setup__()
         cls._buttons.update({
                 'compute_url': {},
                 })
 
     @classmethod
     @ModelView.button
-    def compute_url(cls, protocols):
-        for protocol in protocols:
-            url = protocol.software.network.domain
+    def compute_url(cls, services):
+        for service in services:
+            url = service.software.network.domain
             if not url:
-                url = protocol.software.network.ip_address
+                url = service.software.network.ip_address
             if url:
-                protocol.url = (protocol.name.name.lower() + "://" + url + ":" +
-                    str(protocol.port))
-                protocol.save()
+                service.url = (service.protocol.name.lower() + "://" + url +
+                    ":" + str(service.port))
+                service.save()
         <field name="perm_delete" eval="True"/>
     </record>
 
-    <!-- network.protocol.type -->
-    <record model="ir.ui.view" id="network_protocol_type_view_tree">
-        <field name="model">network.protocol.type</field>
-        <field name="type">tree</field>
-        <field name="name">protocol_type_tree</field>
-    </record>
-
-    <record model="ir.ui.view" id="network_protocol_type_view_form">
-        <field name="model">network.protocol.type</field>
-        <field name="type">form</field>
-        <field name="name">protocol_type_form</field>
-    </record>
-
-    <record model="ir.model.access" id="access_network_protocol_type">
-        <field name="model" search="[('model', '=', 'network.protocol.type')]"/>
-        <field name="perm_read" eval="True"/>
-        <field name="perm_write" eval="False"/>
-        <field name="perm_create" eval="False"/>
-        <field name="perm_delete" eval="False"/>
-    </record>
-
-    <record model="ir.model.access" id="access_network_protocol_admin_type">
-        <field name="model" search="[('model', '=', 'network.protocol.type')]"/>
-        <field name="group" ref="group_network"/>
-        <field name="perm_read" eval="True"/>
-        <field name="perm_write" eval="True"/>
-        <field name="perm_create" eval="True"/>
-        <field name="perm_delete" eval="True"/>
-    </record>
-
-    <record model="network.protocol.type" id="ftp_protocol_type">
-      <field name="name">FTP</field>
-    </record>
-
-    <record model="network.protocol.type" id="http_protocol_type">
-      <field name="name">HTTP</field>
-    </record>
-
-    <record model="network.protocol.type" id="https_protocol_type">
-      <field name="name">HTTPS</field>
-    </record>
-
-    <record model="network.protocol.type" id="net_rpc_protocol_type">
-      <field name="name">NET-RPC</field>
-    </record>
-
-    <record model="network.protocol.type" id="pop_protocol_type">
-      <field name="name">POP</field>
-    </record>
-
-    <record model="network.protocol.type" id="rtps_protocol_type">
-      <field name="name">RTPS</field>
-    </record>
-
-    <record model="network.protocol.type" id="smtp_protocol_type">
-      <field name="name">SMTP</field>
-    </record>
-
-    <record model="network.protocol.type" id="ssh_protocol_type">
-      <field name="name">SSH</field>
-    </record>
-
-    <record model="network.protocol.type" id="ssl_protocol_type">
-      <field name="name">SSL</field>
-    </record>
-
-    <record model="network.protocol.type" id="tls_protocol_type">
-      <field name="name">TLS</field>
-    </record>
-
-    <record model="network.protocol.type" id="xml_rpc_protocol_type">
-      <field name="name">XML-RPC</field>
-    </record>
-
-    <record model="network.protocol.type" id="xml_rpcs_protocol_type">
-      <field name="name">XML-RPCS</field>
-    </record>
-
-    <record model="network.protocol.type" id="json_protocol_type">
-      <field name="name">JSON</field>
-    </record>
-
-
     <!-- network.protocol -->
     <record model="ir.ui.view" id="network_protocol_view_tree">
         <field name="model">network.protocol</field>
         <field name="perm_delete" eval="True"/>
     </record>
 
+    <record model="network.protocol" id="ftp_protocol">
+      <field name="name">FTP</field>
+    </record>
+
+    <record model="network.protocol" id="http_protocol">
+      <field name="name">HTTP</field>
+    </record>
+
+    <record model="network.protocol" id="https_protocol">
+      <field name="name">HTTPS</field>
+    </record>
+
+    <record model="network.protocol" id="net_rpc_protocol">
+      <field name="name">NET-RPC</field>
+    </record>
+
+    <record model="network.protocol" id="pop_protocol">
+      <field name="name">POP</field>
+    </record>
+
+    <record model="network.protocol" id="rtps_protocol">
+      <field name="name">RTPS</field>
+    </record>
+
+    <record model="network.protocol" id="smtp_protocol">
+      <field name="name">SMTP</field>
+    </record>
+
+    <record model="network.protocol" id="ssh_protocol">
+      <field name="name">SSH</field>
+    </record>
+
+    <record model="network.protocol" id="ssl_protocol">
+      <field name="name">SSL</field>
+    </record>
+
+    <record model="network.protocol" id="tls_protocol">
+      <field name="name">TLS</field>
+    </record>
+
+    <record model="network.protocol" id="xml_rpc_protocol">
+      <field name="name">XML-RPC</field>
+    </record>
+
+    <record model="network.protocol" id="xml_rpcs_protocol">
+      <field name="name">XML-RPCS</field>
+    </record>
+
+    <record model="network.protocol" id="json_protocol">
+      <field name="name">JSON</field>
+    </record>
+
+
+    <!-- network.software.service -->
+    <record model="ir.ui.view" id="network_software_service_view_tree">
+        <field name="model">network.software.service</field>
+        <field name="type">tree</field>
+        <field name="name">service_tree</field>
+    </record>
+
+    <record model="ir.ui.view" id="network_software_service_view_form">
+        <field name="model">network.software.service</field>
+        <field name="type">form</field>
+        <field name="name">service_form</field>
+    </record>
+
+    <record model="ir.model.access" id="access_network_software_service">
+        <field name="model" search="[('model', '=', 'network.software.service')]"/>
+        <field name="perm_read" eval="True"/>
+        <field name="perm_write" eval="False"/>
+        <field name="perm_create" eval="False"/>
+        <field name="perm_delete" eval="False"/>
+    </record>
+
+    <record model="ir.model.access" id="access_network_software_service_admin">
+        <field name="model" search="[('model', '=', 'network.software.service')]"/>
+        <field name="group" ref="group_network"/>
+        <field name="perm_read" eval="True"/>
+        <field name="perm_write" eval="True"/>
+        <field name="perm_create" eval="True"/>
+        <field name="perm_delete" eval="True"/>
+    </record>
+
     </data>
 </tryton>

view/protocol_form.xml

 <form string="Protocol">
     <label name='name'/>
     <field name='name'/>
-    <label name='port'/>
-    <field name='port'/>
-    <button name="compute_url" string="Compute _URL" icon="tryton-go-next"/>
-    <field name='url'/>
 </form>

view/protocol_tree.xml

 copyright notices and license terms. -->
 <tree string="Protocols">
     <field name='name'/>
-    <field name='port'/>
-    <field name='url'/>
 </tree>

view/protocol_type_form.xml

-<?xml version="1.0"?>
-<!-- This file is part of network module for Tryton.
-The COPYRIGHT file at the top level of this repository contains the full
-copyright notices and license terms. -->
-<form string="Protocol">
-    <label name='name'/>
-    <field name='name'/>
-</form>

view/protocol_type_tree.xml

-<?xml version="1.0"?>
-<!-- This file is part of network module for Tryton.
-The COPYRIGHT file at the top level of this repository contains the full
-copyright notices and license terms. -->
-<tree string="Protocols">
-    <field name='name'/>
-</tree>

view/service_form.xml

+<?xml version="1.0"?>
+<!-- This file is part of network module for Tryton.
+The COPYRIGHT file at the top level of this repository contains the full
+copyright notices and license terms. -->
+<form string="Service">
+    <label name='protocol'/>
+    <field name='protocol'/>
+    <label name='port'/>
+    <field name='port'/>
+    <button name="compute_url" string="Compute _URL" icon="tryton-go-next"/>
+    <field name='url'/>
+    <separator name="note" colspan="6"/>
+    <field name="note" colspan="6"/>
+</form>

view/service_tree.xml

+<?xml version="1.0"?>
+<!-- This file is part of network module for Tryton.
+The COPYRIGHT file at the top level of this repository contains the full
+copyright notices and license terms. -->
+<tree string="Services">
+    <field name='protocol'/>
+    <field name='port'/>
+    <field name='url'/>
+</tree>

view/software_form.xml

     <label name='hardware'/>
     <field name='hardware'/>
     <notebook colspan="6">
-        <page string="Login Protocols and Users" id="logins">
-            <field name="protocols" colspan="6"/>
+        <page string="Login Services and Users" id="logins">
+            <field name="services" colspan="6"/>
             <field name='logins' colspan="6"/>
         </page>
         <page string="Notes" id="note">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.