From bfeba02b3340f8824dc0bcd809186b59d2824dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 17 Jun 2013 10:55:52 +0200 Subject: [CLEAN] idea: code style cleanup (spaces / wording, indentation). No functional or technical changes, only style cleanup. bzr revid: tde@openerp.com-20130617085552-jx0ne2c4gr18582q --- addons/idea/idea.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'addons/idea/idea.py') diff --git a/addons/idea/idea.py b/addons/idea/idea.py index d1e250ce9a5..2cd7a9858d1 100644 --- a/addons/idea/idea.py +++ b/addons/idea/idea.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-Today OpenERP S.A. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,13 +21,13 @@ from openerp.osv import osv from openerp.osv import fields -from openerp.tools.translate import _ -import time + VoteValues = [('-1', 'Not Voted'), ('0', 'Very Bad'), ('25', 'Bad'), \ - ('50', 'Normal'), ('75', 'Good'), ('100', 'Very Good') ] + ('50', 'Normal'), ('75', 'Good'), ('100', 'Very Good')] DefaultVoteValue = '50' + class idea_category(osv.osv): """ Category of Idea """ _name = "idea.category" @@ -42,20 +42,24 @@ class idea_category(osv.osv): class idea_idea(osv.osv): - """ Idea """ + """ Model of an Idea """ _name = 'idea.idea' _inherit = ['mail.thread'] _columns = { 'create_uid': fields.many2one('res.users', 'Creator', required=True, readonly=True), - 'name': fields.char('Idea Summary', size=64, required=True, readonly=True, oldname='title', states={'draft': [('readonly', False)]}), - 'description': fields.text('Description', help='Content of the idea', readonly=True, states={'draft': [('readonly', False)]}), - 'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, states={'draft': [('readonly', False)]}), + 'name': fields.char('Idea Summary', size=64, required=True, readonly=True, + states={'draft': [('readonly', False)]}, + oldname='title'), + 'description': fields.text('Description', readonly=True, + states={'draft': [('readonly', False)]}, + help='Content of the idea'), + 'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, + states={'draft': [('readonly', False)]}), 'state': fields.selection([('draft', 'New'), - ('open', 'Accepted'), - ('cancel', 'Refused'), - ('close', 'Done')], - 'Status', readonly=True, track_visibility='onchange', - ) + ('open', 'Accepted'), + ('cancel', 'Refused'), + ('close', 'Done')], + 'Status', readonly=True, track_visibility='onchange'), } _sql_constraints = [ ('name', 'unique(name)', 'The name of the idea must be unique') -- cgit v1.2.3 From 145befd3e73905e23688bacfafc27ae51468aa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 17 Jun 2013 13:27:34 +0200 Subject: [CLEAN] [IMP] Idea: - created models/views/tests/data/demo directories, moved existing files into them - reorganized menus (less depth) - removed inherit and dependance from mail.thread (basic idea = without mail.thread -> will be added further) - removed custom tools user group - added basic files for test, currently void bzr revid: tde@openerp.com-20130617112734-4vhj6sjbvip0ufuv --- addons/idea/idea.py | 82 ----------------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 addons/idea/idea.py (limited to 'addons/idea/idea.py') diff --git a/addons/idea/idea.py b/addons/idea/idea.py deleted file mode 100644 index 2cd7a9858d1..00000000000 --- a/addons/idea/idea.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-Today OpenERP S.A. (). -# -# 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 . -# -############################################################################## - -from openerp.osv import osv -from openerp.osv import fields - - -VoteValues = [('-1', 'Not Voted'), ('0', 'Very Bad'), ('25', 'Bad'), \ - ('50', 'Normal'), ('75', 'Good'), ('100', 'Very Good')] -DefaultVoteValue = '50' - - -class idea_category(osv.osv): - """ Category of Idea """ - _name = "idea.category" - _description = "Idea Category" - _columns = { - 'name': fields.char('Category Name', size=64, required=True), - } - _sql_constraints = [ - ('name', 'unique(name)', 'The name of the category must be unique') - ] - _order = 'name asc' - - -class idea_idea(osv.osv): - """ Model of an Idea """ - _name = 'idea.idea' - _inherit = ['mail.thread'] - _columns = { - 'create_uid': fields.many2one('res.users', 'Creator', required=True, readonly=True), - 'name': fields.char('Idea Summary', size=64, required=True, readonly=True, - states={'draft': [('readonly', False)]}, - oldname='title'), - 'description': fields.text('Description', readonly=True, - states={'draft': [('readonly', False)]}, - help='Content of the idea'), - 'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, - states={'draft': [('readonly', False)]}), - 'state': fields.selection([('draft', 'New'), - ('open', 'Accepted'), - ('cancel', 'Refused'), - ('close', 'Done')], - 'Status', readonly=True, track_visibility='onchange'), - } - _sql_constraints = [ - ('name', 'unique(name)', 'The name of the idea must be unique') - ] - _defaults = { - 'state': lambda *a: 'draft', - } - _order = 'name asc' - - def idea_cancel(self, cr, uid, ids, context=None): - return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) - - def idea_open(self, cr, uid, ids, context={}): - return self.write(cr, uid, ids, {'state': 'open'}, context=context) - - def idea_close(self, cr, uid, ids, context={}): - return self.write(cr, uid, ids, {'state': 'close'}, context=context) - - def idea_draft(self, cr, uid, ids, context={}): - return self.write(cr, uid, ids, {'state': 'draft'}, context=context) -- cgit v1.2.3