From 1879af69f2ad98f8a53177062ac574634bd7d46a Mon Sep 17 00:00:00 2001 From: resteve Date: Wed, 29 Aug 2012 13:36:06 +0200 Subject: [PATCH] Rename Model name. Replace _ to . (dot) --- CHANGELOG | 1 + electronic_mail.py | 34 ++++++++++++++++----------------- electronic_mail.xml | 46 ++++++++++++++++++++++----------------------- 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index de90db2..b0ac7d5 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Rename Model name. Replace _ to . (dot) * Add get_rec_name in ElectronicMail * Review INSTALL documentation * Test legal notice diff --git a/electronic_mail.py b/electronic_mail.py index 1a910be..fd6f290 100644 --- a/electronic_mail.py +++ b/electronic_mail.py @@ -24,18 +24,18 @@ from trytond.pool import Pool 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() @@ -44,11 +44,11 @@ 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() @@ -57,9 +57,9 @@ 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) @@ -70,9 +70,9 @@ ReadUser() 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) @@ -82,11 +82,11 @@ WriteUser() 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') @@ -97,7 +97,7 @@ class ElectronicMail(ModelSQL, ModelView): 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') @@ -268,7 +268,7 @@ class ElectronicMail(ModelSQL, ModelView): :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 = { @@ -294,12 +294,12 @@ ElectronicMail() 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): """ diff --git a/electronic_mail.xml b/electronic_mail.xml index e508cff..ef4453f 100644 --- a/electronic_mail.xml +++ b/electronic_mail.xml @@ -22,7 +22,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - electronic_mail.mailbox + electronic.mail.mailbox tree - electronic_mail.mailbox + electronic.mail.mailbox form Mailboxes - electronic_mail.mailbox + electronic.mail.mailbox @@ -80,7 +80,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig parent="menu_email_management"/> - electronic_mail.header + electronic.mail.header tree - electronic_mail + electronic.mail tree - electronic_mail + electronic.mail form Emails - electronic_mail + electronic.mail @@ -169,7 +169,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -177,7 +177,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -186,7 +186,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -194,7 +194,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -204,7 +204,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -214,28 +214,28 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig + search="[('name', '=', 'user'), ('model.model', '=', 'electronic.mail.mailbox')]"/> = User + search="[('name', '=', 'read_users'), ('model.model', '=', 'electronic.mail.mailbox')]"/> = User + search="[('name', '=', 'write_users'), ('model.model', '=', 'electronic.mail.mailbox')]"/> = User + search="[('name', '=', 'create_uid'), ('model.model', '=', 'electronic.mail.mailbox')]"/> = User @@ -243,7 +243,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -253,21 +253,21 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig + search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic.mail')]"/> = User + search="[('name', '=', 'mailbox_read_users'), ('model.model', '=', 'electronic.mail')]"/> = User + search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic.mail')]"/> = User @@ -275,7 +275,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig - + @@ -285,14 +285,14 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig + search="[('name', '=', 'mailbox_owner'), ('model.model', '=', 'electronic.mail')]"/> = User + search="[('name', '=', 'mailbox_write_users'), ('model.model', '=', 'electronic.mail')]"/> = User