Commits

Raimon Esteve (Zikzakmedia) committed 7c9ebb8

Rename Model name. Replace _ to . (dot)

Comments (0)

Files changed (3)

+* Rename Model name. Replace _ to . (dot)
 * Add get_rec_name in ElectronicMail
 * Review INSTALL documentation
 * Test legal notice

electronic_mail.py

 
 class Mailbox(ModelSQL, ModelView):
     "Mailbox"
-    _name = "electronic_mail.mailbox"
+    _name = "electronic.mail.mailbox"
     _description = __doc__
 
     name = fields.Char('Name', required=True)
     user = fields.Many2One('res.user', 'Owner')
     parents = fields.Many2Many(
-             'electronic_mail.mailbox-mailbox',
+             'electronic.mail.mailbox.mailbox',
              'parent', 'child' ,'Parents')
     subscribed = fields.Boolean('Subscribed')
-    read_users = fields.Many2Many('electronic_mail.mailbox-read-res.user',
+    read_users = fields.Many2Many('electronic.mail.mailbox.read.res.user',
             'mailbox', 'user', 'Read Users')
-    write_users = fields.Many2Many('electronic_mail.mailbox-write-res.user',
+    write_users = fields.Many2Many('electronic.mail.mailbox.write.res.user',
             'mailbox', 'user', 'Write Users')
 
 Mailbox()
 class MailboxParent(ModelSQL):
     'Mailbox - parent - Mailbox'
     _description = __doc__
-    _name = 'electronic_mail.mailbox-mailbox'
+    _name = 'electronic.mail.mailbox.mailbox'
 
-    parent = fields.Many2One('electronic_mail.mailbox', 'Parent',
+    parent = fields.Many2One('electronic.mail.mailbox', 'Parent',
             ondelete='CASCADE', required=True, select=1)
-    child = fields.Many2One('electronic_mail.mailbox', 'Child',
+    child = fields.Many2One('electronic.mail.mailbox', 'Child',
             ondelete='CASCADE', required=True, select=1)
 
 MailboxParent()
 class ReadUser(ModelSQL):
     'Electronic Mail - read - User'
     _description = __doc__
-    _name = 'electronic_mail.mailbox-read-res.user'
+    _name = 'electronic.mail.mailbox.read.res.user'
 
-    mailbox = fields.Many2One('electronic_mail.mailbox', 'Mailbox',
+    mailbox = fields.Many2One('electronic.mail.mailbox', 'Mailbox',
             ondelete='CASCADE', required=True, select=1)
     user = fields.Many2One('res.user', 'User', ondelete='CASCADE',
             required=True, select=1)
 class WriteUser(ModelSQL):
     'Mailbox - write - User'
     _description = __doc__
-    _name = 'electronic_mail.mailbox-write-res.user'
+    _name = 'electronic.mail.mailbox.write.res.user'
 
-    mailbox = fields.Many2One('electronic_mail.mailbox', 'mailbox',
+    mailbox = fields.Many2One('electronic.mail.mailbox', 'mailbox',
             ondelete='CASCADE', required=True, select=1)
     user = fields.Many2One('res.user', 'User', ondelete='CASCADE',
             required=True, select=1)
 
 class ElectronicMail(ModelSQL, ModelView):
     "E-mail"
-    _name = 'electronic_mail'
+    _name = 'electronic.mail'
     _description = __doc__
 
     mailbox = fields.Many2One(
-        'electronic_mail.mailbox', 'Mailbox', required=True)
+        'electronic.mail.mailbox', 'Mailbox', required=True)
     from_ = fields.Char('From')
     sender = fields.Char('Sender')
     to = fields.Char('To')
     message_id = fields.Char('Message-ID', help='Unique Message Identifier')
     in_reply_to = fields.Char('In-Reply-To')
     headers = fields.One2Many(
-        'electronic_mail.header', 'electronic_mail', 'Headers')
+        'electronic.mail.header', 'electronic_mail', 'Headers')
     digest = fields.Char('MD5 Digest', size=32)
     collision = fields.Integer('Collision')
     email = fields.Function(fields.Binary('Email'), 'get_email', 'set_email')
         :param mail: email object
         :param mailbox: ID of the mailbox
         """
-        header_obj = Pool().get('electronic_mail.header')
+        header_obj = Pool().get('electronic.mail.header')
         email_date = mail.get('date') and datetime.fromtimestamp(
                 mktime(parsedate(mail.get('date'))))
         values = {
 
 class Header(ModelSQL, ModelView):
     "Header fields"
-    _name = 'electronic_mail.header'
+    _name = 'electronic.mail.header'
     _description = __doc__
 
     name = fields.Char('Name', help='Name of Header Field')
     value = fields.Char('Value', help='Value of Header Field')
-    electronic_mail = fields.Many2One('electronic_mail', 'e-mail')
+    electronic_mail = fields.Many2One('electronic.mail', 'e-mail')
 
     def create_from_email(self, mail, mail_id):
         """

electronic_mail.xml

     </record>
 
     <record model="ir.ui.view" id="mailbox_view_tree">
-      <field name="model">electronic_mail.mailbox</field>
+      <field name="model">electronic.mail.mailbox</field>
       <field name="type">tree</field>
       <field name="arch" type="xml">
         <![CDATA[
       </field>
     </record>
     <record model="ir.ui.view" id="mailbox_view_form">
-      <field name="model">electronic_mail.mailbox</field>
+      <field name="model">electronic.mail.mailbox</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
       <![CDATA[
     </record>
     <record model="ir.action.act_window" id="act_mailbox_form">
       <field name="name">Mailboxes</field>
-      <field name="res_model">electronic_mail.mailbox</field>
+      <field name="res_model">electronic.mail.mailbox</field>
     </record>
     <record model="ir.action.act_window.view" id="act_mailbox_form_view1">
       <field name="sequence" eval="10"/>
       parent="menu_email_management"/>
 
     <record model="ir.ui.view" id="headers_view_tree">
-      <field name="model">electronic_mail.header</field>
+      <field name="model">electronic.mail.header</field>
       <field name="type">tree</field>
       <field name="arch" type="xml">
       <![CDATA[
     </record>
 
     <record model="ir.ui.view" id="mail_view_tree">
-      <field name="model">electronic_mail</field>
+      <field name="model">electronic.mail</field>
       <field name="type">tree</field>
       <field name="arch" type="xml">
       <![CDATA[
       </field>
     </record>
     <record model="ir.ui.view" id="mail_view_form">
-      <field name="model">electronic_mail</field>
+      <field name="model">electronic.mail</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
       <![CDATA[
     </record>
     <record model="ir.action.act_window" id="act_mail_form">
       <field name="name">Emails</field>
-      <field name="res_model">electronic_mail</field>
+      <field name="res_model">electronic.mail</field>
     </record>
     <record model="ir.action.act_window.view" id="act_mail_form_view1">
       <field name="sequence" eval="10"/>
   
     <!-- Access Rule Mailbox -->
     <record model="ir.model.access" id="access_mailbox_admin">
-      <field name="model" search="[('model', '=', 'electronic_mail.mailbox')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail.mailbox')]"/>
       <field name="group" ref="group_email_admin"/>
       <field name="perm_read" eval="True"/>
       <field name="perm_write" eval="True"/>
       <field name="perm_delete" eval="True"/>
     </record>
     <record model="ir.model.access" id="access_mailbox_user">
-      <field name="model" search="[('model', '=', 'electronic_mail.mailbox')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail.mailbox')]"/>
       <field name="group" ref="group_email_user"/>
       <field name="perm_read" eval="True"/>
       <field name="perm_write" eval="False"/>
     </record>
     <!-- Access Rule Mail -->
     <record model="ir.model.access" id="access_mail_admin">
-      <field name="model" search="[('model', '=', 'electronic_mail')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail')]"/>
       <field name="group" ref="group_email_admin"/>
       <field name="perm_read" eval="True"/>
       <field name="perm_write" eval="True"/>
       <field name="perm_delete" eval="True"/>
     </record>
     <record model="ir.model.access" id="access_mail_user">
-      <field name="model" search="[('model', '=', 'electronic_mail')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail')]"/>
       <field name="group" ref="group_email_user"/>
       <field name="perm_read" eval="True"/>
       <field name="perm_write" eval="True"/>
 
     <!-- Rule to read mailboxes -->
     <record model="ir.rule.group" id="rule_group_read_mailbox">
-      <field name="model" search="[('model', '=', 'electronic_mail.mailbox')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail.mailbox')]"/>
       <field name="global_p" eval="True"/>
       <field name="default_p" eval="False"/>
       <field name="perm_read" eval="True"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mailbox_line1">
       <field name="field" 
-             search="[('name', '=', 'user'), ('model.model', '=', 'electronic_mail.mailbox')]"/>
+             search="[('name', '=', 'user'), ('model.model', '=', 'electronic.mail.mailbox')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mailbox"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mailbox_line2">
       <field name="field" 
-        search="[('name', '=', 'read_users'), ('model.model', '=', 'electronic_mail.mailbox')]"/>
+        search="[('name', '=', 'read_users'), ('model.model', '=', 'electronic.mail.mailbox')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mailbox"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mailbox_line3">
       <field name="field" 
-        search="[('name', '=', 'write_users'), ('model.model', '=', 'electronic_mail.mailbox')]"/>
+        search="[('name', '=', 'write_users'), ('model.model', '=', 'electronic.mail.mailbox')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mailbox"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mailbox_line4">
       <field name="field" 
-        search="[('name', '=', 'create_uid'), ('model.model', '=', 'electronic_mail.mailbox')]"/>
+        search="[('name', '=', 'create_uid'), ('model.model', '=', 'electronic.mail.mailbox')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mailbox"/>
 
     <!-- Rule to read emails -->
     <record model="ir.rule.group" id="rule_group_read_mail">
-      <field name="model" search="[('model', '=', 'electronic_mail')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail')]"/>
       <field name="global_p" eval="True"/>
       <field name="default_p" eval="False"/>
       <field name="perm_read" eval="True"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mail_line1">
       <field name="field" 
-        search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic_mail')]"/>
+        search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic.mail')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mail"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mail_line2">
       <field name="field" 
-        search="[('name', '=', 'mailbox_read_users'), ('model.model', '=', 'electronic_mail')]"/>
+        search="[('name', '=', 'mailbox_read_users'), ('model.model', '=', 'electronic.mail')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mail"/>
     </record>
     <record model="ir.rule" id="rule_group_read_mail_line3">
       <field name="field" 
-        search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic_mail')]"/>
+        search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic.mail')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_read_mail"/>
 
     <!-- Rule to write emails -->
     <record model="ir.rule.group" id="rule_group_write_mail">
-      <field name="model" search="[('model', '=', 'electronic_mail')]"/>
+      <field name="model" search="[('model', '=', 'electronic.mail')]"/>
       <field name="global_p" eval="True"/>
       <field name="default_p" eval="False"/>
       <field name="perm_read" eval="True"/>
     </record>
     <record model="ir.rule" id="rule_group_write_mail_line1">
       <field name="field" 
-        search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic_mail')]"/>
+        search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic.mail')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_write_mail"/>
     </record>
     <record model="ir.rule" id="rule_group_write_mailbox_line2">
       <field name="field" 
-        search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic_mail')]"/>
+        search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic.mail')]"/>
       <field name="operator">=</field>
       <field name="operand">User</field>
       <field name="rule_group" ref="rule_group_write_mail"/>
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.