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/__init__.py | 2 +- addons/idea/__openerp__.py | 4 +- addons/idea/idea.py | 30 +++--- addons/idea/idea_view.xml | 184 ++++++++++++++++----------------- addons/idea/security/idea_security.xml | 12 +-- 5 files changed, 118 insertions(+), 114 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/__init__.py b/addons/idea/__init__.py index e6f7333e055..8b550800117 100644 --- a/addons/idea/__init__.py +++ b/addons/idea/__init__.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 diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index 8f32e1e91c4..878342d6d00 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.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 @@ -43,7 +43,7 @@ Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'idea_workflow.xml', ], 'demo': ['idea_data.xml'], - 'test':[], + 'test': [], 'installable': True, 'images': [], } 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') diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml index 53734d53919..e1a4b942e83 100644 --- a/addons/idea/idea_view.xml +++ b/addons/idea/idea_view.xml @@ -3,18 +3,19 @@ - - - idea.category.search - idea.category - - - - - - - + + + idea.category.search + idea.category + + + + + + + + idea.category.form idea.category @@ -40,96 +41,95 @@ + + Categories + idea.category + form + tree,form + + - - Categories - idea.category - form - tree,form - - - - - - - - - + - + - - idea.idea.form - idea.idea - -
-
-
- - -
- - -
-
-
-
+ - - - idea.idea.tree - idea.idea - - - - - - - - + + + idea.idea.form + idea.idea + +
+
+
+ + +
+ + +
+
+
+
- + + + idea.idea.tree + idea.idea + + + + + + + + - - idea.idea.search - idea.idea - - - - - - - - - - - - - - - + + + idea.idea.search + idea.idea + + + + + + + + + + + + + + + - - Ideas - idea.idea - form - tree,form - - + + Ideas + idea.idea + form + tree,form + + - +
diff --git a/addons/idea/security/idea_security.xml b/addons/idea/security/idea_security.xml index 8743252c9e5..c72608863b0 100644 --- a/addons/idea/security/idea_security.xml +++ b/addons/idea/security/idea_security.xml @@ -1,12 +1,12 @@ - + - - User - - + + User + + - + -- 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/__init__.py | 3 +- addons/idea/__openerp__.py | 35 ++++---- addons/idea/data/idea_workflow.xml | 60 ++++++++++++++ addons/idea/demo/idea.xml | 17 ++++ addons/idea/idea.py | 82 ------------------- addons/idea/idea_data.xml | 21 ----- addons/idea/idea_view.xml | 135 ------------------------------- addons/idea/idea_workflow.xml | 60 -------------- addons/idea/models/__init__.py | 22 +++++ addons/idea/models/idea.py | 87 ++++++++++++++++++++ addons/idea/security/idea.xml | 7 ++ addons/idea/security/idea_security.xml | 12 --- addons/idea/security/ir.model.access.csv | 4 +- addons/idea/static/src/img/icon.png | Bin 0 -> 142095 bytes addons/idea/tests/__init__.py | 28 +++++++ addons/idea/tests/test_idea.py | 39 +++++++++ addons/idea/views/idea.xml | 131 ++++++++++++++++++++++++++++++ 17 files changed, 415 insertions(+), 328 deletions(-) create mode 100644 addons/idea/data/idea_workflow.xml create mode 100644 addons/idea/demo/idea.xml delete mode 100644 addons/idea/idea.py delete mode 100644 addons/idea/idea_data.xml delete mode 100644 addons/idea/idea_view.xml delete mode 100644 addons/idea/idea_workflow.xml create mode 100644 addons/idea/models/__init__.py create mode 100644 addons/idea/models/idea.py create mode 100644 addons/idea/security/idea.xml delete mode 100644 addons/idea/security/idea_security.xml create mode 100644 addons/idea/static/src/img/icon.png create mode 100644 addons/idea/tests/__init__.py create mode 100644 addons/idea/tests/test_idea.py create mode 100644 addons/idea/views/idea.xml (limited to 'addons/idea') diff --git a/addons/idea/__init__.py b/addons/idea/__init__.py index 8b550800117..2b8966f9e7a 100644 --- a/addons/idea/__init__.py +++ b/addons/idea/__init__.py @@ -19,5 +19,4 @@ # ############################################################################## -import idea - +import models diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index 878342d6d00..bc2308ecc44 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -22,29 +22,36 @@ { 'name': 'Ideas', - 'version': '0.1', + 'summary': 'Share and Vote for your Ideas', + 'version': '1.0', 'category': 'Tools', 'description': """ -This module allows user to easily and efficiently participate in enterprise innovation. -======================================================================================= +Share your ideas and participate in enterprise innovation +========================================================= -It allows everybody to express ideas about different subjects. -Then, other users can comment on these ideas and vote for particular ideas. -Each idea has a score based on the different votes. -The managers can obtain an easy view of best ideas from all the users. +The Ideas module give users a way to express and discuss ideas, allowing everybody +to participate in enterprise innovation. Every user can suggest, comment ideas. +A vote mechanism is included. Each idea has a score based on the different +votes. The managers can obtain an easy view of best ideas from all the users. Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'author': 'OpenERP SA', - 'website': 'http://openerp.com', - 'depends': ['mail'], + 'website': 'http://www.openerp.com', + 'depends': ['base', 'base_setup'], 'data': [ - 'security/idea_security.xml', + 'security/idea.xml', 'security/ir.model.access.csv', - 'idea_view.xml', - 'idea_workflow.xml', + 'views/idea.xml', + 'data/idea_workflow.xml', + ], + 'demo': [ + 'demo/idea.xml' ], - 'demo': ['idea_data.xml'], - 'test': [], 'installable': True, + 'application': True, 'images': [], + 'css': [], + 'js': [], + 'qweb': [], } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/idea/data/idea_workflow.xml b/addons/idea/data/idea_workflow.xml new file mode 100644 index 00000000000..649541ae349 --- /dev/null +++ b/addons/idea/data/idea_workflow.xml @@ -0,0 +1,60 @@ + + + + + idea.wkf + idea.idea + True + + + + + True + draft + function + idea_draft() + + + + + open + function + idea_open() + + + + + close + function + idea_close() + True + + + + + cancel + function + idea_cancel() + True + + + + + + idea_open + + + + + + idea_close + + + + + + idea_cancel + + + + diff --git a/addons/idea/demo/idea.xml b/addons/idea/demo/idea.xml new file mode 100644 index 00000000000..e54708f92ec --- /dev/null +++ b/addons/idea/demo/idea.xml @@ -0,0 +1,17 @@ + + + + + + Sales + + + Organization + + + Technical + + + + + 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) diff --git a/addons/idea/idea_data.xml b/addons/idea/idea_data.xml deleted file mode 100644 index 421cb6a9eef..00000000000 --- a/addons/idea/idea_data.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - Sales - - - Organization - - - Technical - - - - - - - - - diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml deleted file mode 100644 index e1a4b942e83..00000000000 --- a/addons/idea/idea_view.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - idea.category.search - idea.category - - - - - - - - - - idea.category.form - idea.category - -
- - - -
-
-
- - - - idea.category.tree - idea.category - - - - - - - - - - - Categories - idea.category - form - tree,form - - - - - - - - - - - - - idea.idea.form - idea.idea - -
-
-
- - -
- - -
-
-
-
- - - - idea.idea.tree - idea.idea - - - - - - - - - - - - idea.idea.search - idea.idea - - - - - - - - - - - - - - - - - - Ideas - idea.idea - form - tree,form - - - - - -
-
diff --git a/addons/idea/idea_workflow.xml b/addons/idea/idea_workflow.xml deleted file mode 100644 index 649541ae349..00000000000 --- a/addons/idea/idea_workflow.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - idea.wkf - idea.idea - True - - - - - True - draft - function - idea_draft() - - - - - open - function - idea_open() - - - - - close - function - idea_close() - True - - - - - cancel - function - idea_cancel() - True - - - - - - idea_open - - - - - - idea_close - - - - - - idea_cancel - - - - diff --git a/addons/idea/models/__init__.py b/addons/idea/models/__init__.py new file mode 100644 index 00000000000..e8a48771771 --- /dev/null +++ b/addons/idea/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2013-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 . +# +############################################################################## + +import idea diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py new file mode 100644 index 00000000000..5bfcdb0c317 --- /dev/null +++ b/addons/idea/models/idea.py @@ -0,0 +1,87 @@ +# -*- 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" + _order = 'name asc' + + _columns = { + 'name': fields.char('Category Name', size=64, required=True), + } + + _sql_constraints = [ + ('name', 'unique(name)', 'The name of the category must be unique') + ] + + +class idea_idea(osv.osv): + """ Model of an Idea """ + _name = 'idea.idea' + _description = 'Propose and Share your Ideas' + _rec_name = 'name' + _order = 'name asc' + # _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', + } + + 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) diff --git a/addons/idea/security/idea.xml b/addons/idea/security/idea.xml new file mode 100644 index 00000000000..e7a0d800187 --- /dev/null +++ b/addons/idea/security/idea.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/addons/idea/security/idea_security.xml b/addons/idea/security/idea_security.xml deleted file mode 100644 index c72608863b0..00000000000 --- a/addons/idea/security/idea_security.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - User - - - - - - diff --git a/addons/idea/security/ir.model.access.csv b/addons/idea/security/ir.model.access.csv index 78b8deeaf57..761ada8132c 100644 --- a/addons/idea/security/ir.model.access.csv +++ b/addons/idea/security/ir.model.access.csv @@ -1,3 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_idea_category_user,idea.category user,model_idea_category,base.group_tool_user,1,1,1,1 -access_idea_idea_user,idea.idea user,model_idea_idea,base.group_tool_user,1,1,1,1 +access_idea_category_user,idea.category.user,model_idea_category,base.group_user,1,1,1,1 +access_idea_idea_user,idea.idea.user,model_idea_idea,base.group_user,1,1,1,1 diff --git a/addons/idea/static/src/img/icon.png b/addons/idea/static/src/img/icon.png new file mode 100644 index 00000000000..1f0cba223bb Binary files /dev/null and b/addons/idea/static/src/img/icon.png differ diff --git a/addons/idea/tests/__init__.py b/addons/idea/tests/__init__.py new file mode 100644 index 00000000000..a53567a380b --- /dev/null +++ b/addons/idea/tests/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2013-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.addons.idea.tests import test_idea + +checks = [ + test_idea, +] + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/idea/tests/test_idea.py b/addons/idea/tests/test_idea.py new file mode 100644 index 00000000000..4ca9bb9dcb9 --- /dev/null +++ b/addons/idea/tests/test_idea.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2013-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.tests import common + + +class TestIdeaBase(common.TransactionCase): + + def setUp(self): + super(TestIdeaBase, self).setUp() + cr, uid = self.cr, self.uid + + # Usefull models + self.idea_category = self.registry('idea.category') + self.idea_idea = self.registry('idea.idea') + + def tearDown(self): + super(TestIdeaBase, self).tearDown() + + def test_OO(self): + pass diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml new file mode 100644 index 00000000000..85858a9c860 --- /dev/null +++ b/addons/idea/views/idea.xml @@ -0,0 +1,131 @@ + + + + + + idea.category.search + idea.category + + + + + + + + + + idea.category.form + idea.category + +
+ + + +
+
+
+ + + + idea.category.tree + idea.category + + + + + + + + + + + Categories + idea.category + form + tree,form + + + + + + idea.idea.form + idea.idea + +
+
+
+ + +
+
+
+ + + + idea.idea.tree + idea.idea + + + + + + + + + + + + idea.idea.search + idea.idea + + + + + + + + + + + + + + + + + + Ideas + idea.idea + form + tree,form + + + + + + + + + + + + + + +
+
-- cgit v1.2.3 From f470535b0ece858f8cc98a7f846b26b9126cc4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 10:08:20 +0200 Subject: [ADD] idea: added a kanban view bzr revid: tde@openerp.com-20130618080820-18bhrsq3flfacpjl --- addons/idea/__openerp__.py | 5 +- addons/idea/demo/idea.xml | 25 ++++++++-- addons/idea/models/idea.py | 52 +++++++++++++++---- addons/idea/static/src/css/idea_idea.css | 21 ++++++++ addons/idea/views/category.xml | 56 +++++++++++++++++++++ addons/idea/views/idea.xml | 86 +++++++++++++------------------- 6 files changed, 180 insertions(+), 65 deletions(-) create mode 100644 addons/idea/static/src/css/idea_idea.css create mode 100644 addons/idea/views/category.xml (limited to 'addons/idea') diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index bc2308ecc44..f2e2e3f0b1d 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -41,6 +41,7 @@ Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'security/idea.xml', 'security/ir.model.access.csv', 'views/idea.xml', + 'views/category.xml', 'data/idea_workflow.xml', ], 'demo': [ @@ -49,7 +50,9 @@ Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'installable': True, 'application': True, 'images': [], - 'css': [], + 'css': [ + 'static/src/css/idea_idea.css', + ], 'js': [], 'qweb': [], } diff --git a/addons/idea/demo/idea.xml b/addons/idea/demo/idea.xml index e54708f92ec..cce96fe7f82 100644 --- a/addons/idea/demo/idea.xml +++ b/addons/idea/demo/idea.xml @@ -2,16 +2,35 @@ - + Sales - + Organization - + Technical + + Name + Description + draft + + + + Name2 + Description + draft + + + + Name3 + Description + draft + + + diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index 5bfcdb0c317..e491c06c2a5 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -28,7 +28,7 @@ VoteValues = [('-1', 'Not Voted'), ('0', 'Very Bad'), ('25', 'Bad'), \ DefaultVoteValue = '50' -class idea_category(osv.osv): +class IdeaCategory(osv.Model): """ Category of Idea """ _name = "idea.category" _description = "Idea Category" @@ -43,13 +43,18 @@ class idea_category(osv.osv): ] -class idea_idea(osv.osv): +class IdeaIdea(osv.Model): """ Model of an Idea """ _name = 'idea.idea' _description = 'Propose and Share your Ideas' _rec_name = 'name' _order = 'name asc' - # _inherit = ['mail.thread'] + + def _get_state_list(self, cr, uid, context=None): + return [('draft', 'New'), + ('open', 'Accepted'), + ('cancel', 'Refused'), + ('close', 'Done')] _columns = { 'create_uid': fields.many2one('res.users', 'Creator', required=True, readonly=True), @@ -61,19 +66,48 @@ class idea_idea(osv.osv): 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'), + 'state': fields.selection(_get_state_list, string='Status', + readonly=True, track_visibility='onchange'), } + _sql_constraints = [ ('name', 'unique(name)', 'The name of the idea must be unique') ] + _defaults = { - 'state': lambda *a: 'draft', + 'state': lambda self, cr, uid, ctx=None: self._get_state_list(cr, uid, ctx)[0][0], } + #------------------------------------------------------ + # Technical stuff + #------------------------------------------------------ + + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): + """ Override read_group to always display all states. """ + # Default result structure + states = self._get_state_list(cr, uid, context=context) + read_group_all_states = [{ + '__context': {'group_by': groupby[1:]}, + '__domain': domain + [('state', '=', state_value)], + 'state': state_value, + 'state_count': 0, + } for state_value, state_name in states] + # Get standard results + read_group_res = super(IdeaIdea, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) + # Update standard results with default results + result = [] + for state_value, state_name in states: + res = filter(lambda x: x['state'] == state_value, read_group_res) + if not res: + res = filter(lambda x: x['state'] == state_value, read_group_all_states) + res[0]['state'] = [state_value, state_name] + result.append(res[0]) + return result + + #------------------------------------------------------ + # Workflow / Actions + #------------------------------------------------------ + def idea_cancel(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) diff --git a/addons/idea/static/src/css/idea_idea.css b/addons/idea/static/src/css/idea_idea.css new file mode 100644 index 00000000000..08daffd902a --- /dev/null +++ b/addons/idea/static/src/css/idea_idea.css @@ -0,0 +1,21 @@ +.openerp .oe_kanban_view .oe_kanban_idea_idea { + width: 200px; +} + +.openerp .oe_kanban_view .oe_kanban_idea_idea .oe_avatars { + text-align: right; + margin: -5px 0 -10px 0; +} + +.openerp .oe_kanban_view .oe_kanban_idea_idea .oe_avatars img { + width: 30px; + height: 30px; + padding-left: 0px; + margin-top: 3px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} diff --git a/addons/idea/views/category.xml b/addons/idea/views/category.xml new file mode 100644 index 00000000000..c44491cf59f --- /dev/null +++ b/addons/idea/views/category.xml @@ -0,0 +1,56 @@ + + + + + + + + idea.category.search + idea.category + + + + + + + + + idea.category.form + idea.category + +
+ + + +
+
+
+ + + idea.category.tree + idea.category + + + + + + + + + + Categories + idea.category + form + tree,form + + + + + + + +
+
diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index 85858a9c860..d8b21cdabd6 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -1,52 +1,35 @@ - - - idea.category.search - idea.category - - - - - - - - - - idea.category.form - idea.category - -
- - - -
-
-
- - - idea.category.tree - idea.category - + + idea.idea.kanban + idea.idea - - - + + + +
+
+ í + +
+
+

+ +
+
+
+
+
- - - Categories - idea.category - form - tree,form - - - - idea.idea.form idea.idea @@ -70,7 +53,6 @@ - idea.idea.tree idea.idea @@ -83,21 +65,23 @@ - idea.idea.search idea.idea - - - + + + - - - + + + @@ -107,7 +91,7 @@ Ideas idea.idea form - tree,form + kanban,tree,form @@ -124,8 +108,6 @@ -
-- cgit v1.2.3 From 8c5428d33f26bd99e3e34f5230a8d5a107803bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 11:47:54 +0200 Subject: [IMP] Idea: create_uid -> user_id (to be tracked by chatter); improved some views; cleaned and improved demo data. bzr revid: tde@openerp.com-20130618094754-wlgx7vl2uo4pshfg --- addons/idea/__openerp__.py | 7 +++--- addons/idea/demo/idea.xml | 54 +++++++++++++++++++++++++++++++++++----------- addons/idea/models/idea.py | 14 ++++++------ addons/idea/views/idea.xml | 26 ++++++++++++++-------- 4 files changed, 69 insertions(+), 32 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index f2e2e3f0b1d..a4031bc86d7 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Ideas', - 'summary': 'Share and Vote for your Ideas', + 'summary': 'Share and Discuss your Ideas', 'version': '1.0', 'category': 'Tools', 'description': """ @@ -31,8 +31,7 @@ Share your ideas and participate in enterprise innovation The Ideas module give users a way to express and discuss ideas, allowing everybody to participate in enterprise innovation. Every user can suggest, comment ideas. -A vote mechanism is included. Each idea has a score based on the different -votes. The managers can obtain an easy view of best ideas from all the users. +The managers can obtain an easy view of best ideas from all the users. Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', @@ -45,7 +44,7 @@ Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'data/idea_workflow.xml', ], 'demo': [ - 'demo/idea.xml' + 'demo/idea.xml', ], 'installable': True, 'application': True, diff --git a/addons/idea/demo/idea.xml b/addons/idea/demo/idea.xml index cce96fe7f82..fea9d5535b5 100644 --- a/addons/idea/demo/idea.xml +++ b/addons/idea/demo/idea.xml @@ -12,24 +12,54 @@ Technical + + Docking station along with tablet PC + When you sell a tablet PC, maybe we could propose a docking station with it. I offer 20% on the docking stating (not the tablet). + + + + - Name - Description - draft - + Communicate using emails + I start communicating with prospects more by email than phonecalls. I send an email to create a sense of emergency, like "can I call you this week about our quote?" and I call only those that answer this email. + + + + - Name2 - Description - draft - + Use a two-stages testing phase + We should perform testing using two levels of validation. + + + + - Name3 - Description - draft - + Write some functional documentation about procurements + We receive many questions about OpenChatter. Maybe some functional doc could save us some time. + + + + + + + Better management of smtp errors + There should be away to store the reason why some emails are not sent. + + + + + + + + Kitten mode enabled by default + As this is the most loved feature, the kitten mode should be enabled by default. And maybe even impossible to remove. + + + + diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index e491c06c2a5..69a94598bad 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -52,13 +52,13 @@ class IdeaIdea(osv.Model): def _get_state_list(self, cr, uid, context=None): return [('draft', 'New'), - ('open', 'Accepted'), - ('cancel', 'Refused'), - ('close', 'Done')] + ('open', 'In discussion'), + ('close', 'Accepted'), + ('cancel', 'Refused')] _columns = { - 'create_uid': fields.many2one('res.users', 'Creator', required=True, readonly=True), - 'name': fields.char('Idea Summary', size=64, required=True, readonly=True, + 'user_id': fields.many2one('res.users', 'Responsible', required=True, readonly=True), + 'name': fields.char('Idea Summary', required=True, readonly=True, states={'draft': [('readonly', False)]}, oldname='title'), 'description': fields.text('Description', readonly=True, @@ -66,8 +66,7 @@ class IdeaIdea(osv.Model): help='Content of the idea'), 'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, states={'draft': [('readonly', False)]}), - 'state': fields.selection(_get_state_list, string='Status', - readonly=True, track_visibility='onchange'), + 'state': fields.selection(_get_state_list, string='Status'), } _sql_constraints = [ @@ -75,6 +74,7 @@ class IdeaIdea(osv.Model): ] _defaults = { + 'user_id': lambda self, cr, uid, ctx=None: uid, 'state': lambda self, cr, uid, ctx=None: self._get_state_list(cr, uid, ctx)[0][0], } diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index d8b21cdabd6..33702f0e5f3 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -7,6 +7,7 @@ idea.idea +
@@ -22,7 +23,12 @@

+ +
+ +
+
@@ -44,10 +50,11 @@
@@ -57,9 +64,9 @@ idea.idea.tree idea.idea - + - + @@ -70,7 +77,8 @@ idea.idea - + + @@ -79,9 +87,9 @@ - + - + -- cgit v1.2.3 From 8c36f2724341e06abb801379208d2ccc40ad65ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 12:16:21 +0200 Subject: [IMP] Idea: added mail as a dependancy to have already menus and everything ready to include chatter stuff inside the module. Easier for demos. bzr revid: tde@openerp.com-20130618101621-4f5me8grml002xci --- addons/idea/__openerp__.py | 2 +- addons/idea/models/idea.py | 1 + addons/idea/views/category.xml | 4 ++-- addons/idea/views/idea.xml | 12 ++---------- 4 files changed, 6 insertions(+), 13 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index a4031bc86d7..8d87416fcfe 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -35,7 +35,7 @@ The managers can obtain an easy view of best ideas from all the users. Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', - 'depends': ['base', 'base_setup'], + 'depends': ['mail'], 'data': [ 'security/idea.xml', 'security/ir.model.access.csv', diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index 69a94598bad..678cc6e3632 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -47,6 +47,7 @@ class IdeaIdea(osv.Model): """ Model of an Idea """ _name = 'idea.idea' _description = 'Propose and Share your Ideas' + _rec_name = 'name' _order = 'name asc' diff --git a/addons/idea/views/category.xml b/addons/idea/views/category.xml index c44491cf59f..79725fad73f 100644 --- a/addons/idea/views/category.xml +++ b/addons/idea/views/category.xml @@ -49,8 +49,8 @@ - + diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index 33702f0e5f3..6b9f960653f 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -106,16 +106,8 @@ - - - - - - - + -- cgit v1.2.3 From ddcef651b1a659aa0954628796a44b848953472f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 12:54:08 +0200 Subject: [IMP] Idea: cliking on a note in kanban view redirect to the form view in read mode, not edit. bzr revid: tde@openerp.com-20130618105408-8nqwmae58d6svqyi --- addons/idea/views/idea.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/idea') diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index 6b9f960653f..d6813d4112a 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -10,7 +10,7 @@ -
+
í -- cgit v1.2.3 From 4c9333c802f1547aa4d77f68963997c53f9f343c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 13:19:24 +0200 Subject: [IMP] Idea: removed dead code, updated slighty the model to be able to change user_id and other things like taht. bzr revid: tde@openerp.com-20130618111924-f34uih1qag7sykp9 --- addons/idea/models/idea.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index 678cc6e3632..b9ba80fb251 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -23,11 +23,6 @@ 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 IdeaCategory(osv.Model): """ Category of Idea """ _name = "idea.category" @@ -58,15 +53,14 @@ class IdeaIdea(osv.Model): ('cancel', 'Refused')] _columns = { - 'user_id': fields.many2one('res.users', 'Responsible', required=True, readonly=True), - 'name': fields.char('Idea Summary', required=True, readonly=True, + 'user_id': fields.many2one('res.users', 'Responsible', required=True), + 'name': fields.char('Summary', required=True, readonly=True, states={'draft': [('readonly', False)]}, oldname='title'), - 'description': fields.text('Description', readonly=True, + 'description': fields.text('Description', required=True, states={'draft': [('readonly', False)]}, help='Content of the idea'), - 'category_ids': fields.many2many('idea.category', string='Tags', readonly=True, - states={'draft': [('readonly', False)]}), + 'category_ids': fields.many2many('idea.category', string='Tags'), 'state': fields.selection(_get_state_list, string='Status'), } -- cgit v1.2.3 From aff7d457c47906d55798d450067a19786f64a52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 18 Jun 2013 15:15:45 +0200 Subject: [IMP] idea: workflow moved on a new priority field to avoid issues with kanban / clickable statusbar widget. Added a color field depending on the priori field. Updated views accordingly. bzr revid: tde@openerp.com-20130618131545-33tht1ps4ayzk0so --- addons/idea/data/idea_workflow.xml | 51 +++++++++++++-------------- addons/idea/demo/idea.xml | 16 +++++---- addons/idea/models/idea.py | 71 ++++++++++++++++++++++---------------- addons/idea/views/idea.xml | 16 ++++++--- 4 files changed, 86 insertions(+), 68 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/data/idea_workflow.xml b/addons/idea/data/idea_workflow.xml index 649541ae349..b460c73a6ed 100644 --- a/addons/idea/data/idea_workflow.xml +++ b/addons/idea/data/idea_workflow.xml @@ -7,53 +7,50 @@ True - + True - draft + normal function - idea_draft() + idea_set_normal_priority() - + - open + low function - idea_open() + idea_set_low_priority() - + - close + high function - idea_close() - True - - - - - cancel - function - idea_cancel() - True + idea_set_high_priority() - - - idea_open + + + idea_set_low_priority - - - idea_close + + + idea_set_normal_priority + + + + + + idea_set_high_priority - - - idea_cancel + + + idea_set_normal_priority diff --git a/addons/idea/demo/idea.xml b/addons/idea/demo/idea.xml index fea9d5535b5..2b4ff58b973 100644 --- a/addons/idea/demo/idea.xml +++ b/addons/idea/demo/idea.xml @@ -23,43 +23,45 @@ Communicate using emails I start communicating with prospects more by email than phonecalls. I send an email to create a sense of emergency, like "can I call you this week about our quote?" and I call only those that answer this email. + open - + Use a two-stages testing phase We should perform testing using two levels of validation. + open - + Write some functional documentation about procurements We receive many questions about OpenChatter. Maybe some functional doc could save us some time. + open - Better management of smtp errors There should be away to store the reason why some emails are not sent. + close - - + Kitten mode enabled by default As this is the most loved feature, the kitten mode should be enabled by default. And maybe even impossible to remove. + cancel - - + diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index b9ba80fb251..910a0de483d 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -52,6 +52,15 @@ class IdeaIdea(osv.Model): ('close', 'Accepted'), ('cancel', 'Refused')] + def _get_color(self, cr, uid, ids, fields, args, context=None): + res = dict.fromkeys(ids, 3) + for idea in self.browse(cr, uid, ids, context=context): + if idea.priority == 'low': + res[idea.id] = 0 + elif idea.priority == 'high': + res[idea.id] = 7 + return res + _columns = { 'user_id': fields.many2one('res.users', 'Responsible', required=True), 'name': fields.char('Summary', required=True, readonly=True, @@ -61,7 +70,10 @@ class IdeaIdea(osv.Model): states={'draft': [('readonly', False)]}, help='Content of the idea'), 'category_ids': fields.many2many('idea.category', string='Tags'), - 'state': fields.selection(_get_state_list, string='Status'), + 'state': fields.selection(_get_state_list, string='Status', required=True), + 'priority': fields.selection([('low', 'Low'), ('normal', 'Normal'), ('high', 'High')], + string='Priority', required=True), + 'color': fields.function(_get_color, type='integer', string='Color Index'), } _sql_constraints = [ @@ -71,6 +83,7 @@ class IdeaIdea(osv.Model): _defaults = { 'user_id': lambda self, cr, uid, ctx=None: uid, 'state': lambda self, cr, uid, ctx=None: self._get_state_list(cr, uid, ctx)[0][0], + 'priority': 'normal', } #------------------------------------------------------ @@ -79,38 +92,38 @@ class IdeaIdea(osv.Model): def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): """ Override read_group to always display all states. """ - # Default result structure - states = self._get_state_list(cr, uid, context=context) - read_group_all_states = [{ - '__context': {'group_by': groupby[1:]}, - '__domain': domain + [('state', '=', state_value)], - 'state': state_value, - 'state_count': 0, - } for state_value, state_name in states] - # Get standard results - read_group_res = super(IdeaIdea, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) - # Update standard results with default results - result = [] - for state_value, state_name in states: - res = filter(lambda x: x['state'] == state_value, read_group_res) - if not res: - res = filter(lambda x: x['state'] == state_value, read_group_all_states) - res[0]['state'] = [state_value, state_name] - result.append(res[0]) - return result + if groupby and groupby[0] == "state": + # Default result structure + states = self._get_state_list(cr, uid, context=context) + read_group_all_states = [{ + '__context': {'group_by': groupby[1:]}, + '__domain': domain + [('state', '=', state_value)], + 'state': state_value, + 'state_count': 0, + } for state_value, state_name in states] + # Get standard results + read_group_res = super(IdeaIdea, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) + # Update standard results with default results + result = [] + for state_value, state_name in states: + res = filter(lambda x: x['state'] == state_value, read_group_res) + if not res: + res = filter(lambda x: x['state'] == state_value, read_group_all_states) + res[0]['state'] = [state_value, state_name] + result.append(res[0]) + return result + else: + return super(IdeaIdea, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) #------------------------------------------------------ # Workflow / Actions #------------------------------------------------------ - 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_set_low_priority(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'priority': 'low'}, context=context) - def idea_close(self, cr, uid, ids, context={}): - return self.write(cr, uid, ids, {'state': 'close'}, context=context) + def idea_set_normal_priority(self, cr, uid, ids, context={}): + return self.write(cr, uid, ids, {'priority': 'normal'}, context=context) - def idea_draft(self, cr, uid, ids, context={}): - return self.write(cr, uid, ids, {'state': 'draft'}, context=context) + def idea_set_high_priority(self, cr, uid, ids, context={}): + return self.write(cr, uid, ids, {'priority': 'high'}, context=context) diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index d6813d4112a..87094a29ace 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -7,10 +7,11 @@ idea.idea + -
+
í @@ -42,16 +43,20 @@
-
++
++ ++ ++
+
+
+ + diff --git a/addons/idea/doc/patch2_needaction.txt b/addons/idea/doc/patch2_needaction.txt new file mode 100644 index 00000000000..6897d597fd3 --- /dev/null +++ b/addons/idea/doc/patch2_needaction.txt @@ -0,0 +1,27 @@ +=== modified file 'idea/models/idea.py' +--- idea/models/idea.py 2013-06-18 10:34:31 +0000 ++++ idea/models/idea.py 2013-06-18 10:36:26 +0000 +@@ -47,7 +47,7 @@ + """ Model of an Idea """ + _name = 'idea.idea' + _description = 'Propose and Share your Ideas' +- _inherit = ['mail.thread'] ++ _inherit = ['mail.thread', 'ir.needaction_mixin'] + + _rec_name = 'name' + _order = 'name asc' + +=== modified file 'idea/views/idea.xml' +--- idea/views/idea.xml 2013-06-18 10:34:31 +0000 ++++ idea/views/idea.xml 2013-06-18 10:36:08 +0000 +@@ -92,6 +92,9 @@ + help="Open Ideas"/> + ++ + + + + diff --git a/addons/idea/doc/patch3_treebold.txt b/addons/idea/doc/patch3_treebold.txt new file mode 100644 index 00000000000..9521837750a --- /dev/null +++ b/addons/idea/doc/patch3_treebold.txt @@ -0,0 +1,20 @@ +=== modified file 'idea/views/idea.xml' +--- idea/views/idea.xml 2013-06-18 13:17:10 +0000 ++++ idea/views/idea.xml 2013-06-18 13:17:57 +0000 +@@ -75,11 +75,14 @@ + idea.idea.tree + idea.idea + +- ++ + + + + ++ + + + + diff --git a/addons/idea/doc/patch4_chatterkanban.txt b/addons/idea/doc/patch4_chatterkanban.txt new file mode 100644 index 00000000000..ccce81db7a6 --- /dev/null +++ b/addons/idea/doc/patch4_chatterkanban.txt @@ -0,0 +1,27 @@ +=== modified file 'idea/views/idea.xml' +--- idea/views/idea.xml 2013-06-18 10:58:33 +0000 ++++ idea/views/idea.xml 2013-06-18 11:03:38 +0000 +@@ -8,6 +8,9 @@ + + + ++ ++ ++ + + +
+@@ -27,6 +30,12 @@ +
+ +
++ ++ +
+
+
+ diff --git a/addons/idea/doc/patch5_trackvisibility.txt b/addons/idea/doc/patch5_trackvisibility.txt new file mode 100644 index 00000000000..dd62f44710a --- /dev/null +++ b/addons/idea/doc/patch5_trackvisibility.txt @@ -0,0 +1,28 @@ +=== modified file 'idea/models/idea.py' +--- idea/models/idea.py 2013-06-18 13:29:15 +0000 ++++ idea/models/idea.py 2013-06-18 13:29:38 +0000 +@@ -63,7 +63,8 @@ + return res + + _columns = { +- 'user_id': fields.many2one('res.users', 'Responsible', required=True), ++ 'user_id': fields.many2one('res.users', 'Responsible', required=True, ++ track_visibility='onchange'), + 'name': fields.char('Summary', required=True, readonly=True, + states={'draft': [('readonly', False)]}, + oldname='title'), +@@ -71,9 +72,11 @@ + states={'draft': [('readonly', False)]}, + help='Content of the idea'), + 'category_ids': fields.many2many('idea.category', string='Tags'), +- 'state': fields.selection(_get_state_list, string='Status', required=True), ++ 'state': fields.selection(_get_state_list, string='Status', required=True, ++ track_visibility='onchange'), + 'priority': fields.selection([('low', 'Low'), ('normal', 'Normal'), ('high', 'High')], +- string='Priority', required=True), ++ string='Priority', required=True, ++ track_visibility='always'), + 'color': fields.function(_get_color, type='integer', string='Color Index'), + } + + diff --git a/addons/idea/doc/patch6_subtypes.txt b/addons/idea/doc/patch6_subtypes.txt new file mode 100644 index 00000000000..429b95d57d1 --- /dev/null +++ b/addons/idea/doc/patch6_subtypes.txt @@ -0,0 +1,55 @@ +=== modified file 'idea/__openerp__.py' +--- idea/__openerp__.py 2013-06-18 10:16:21 +0000 ++++ idea/__openerp__.py 2013-06-18 13:23:42 +0000 +@@ -41,6 +41,7 @@ + 'security/ir.model.access.csv', + 'views/idea.xml', + 'views/category.xml', ++ 'data/idea.xml', + 'data/idea_workflow.xml', + ], + 'demo': [ + +=== modified file 'idea/data/idea.xml' +--- idea/data/idea.xml 2013-06-18 13:23:19 +0000 ++++ idea/data/idea.xml 2013-06-18 13:23:56 +0000 +@@ -2,5 +2,19 @@ + + + ++ ++ ++ State Changed ++ idea.idea ++ ++ State changed ++ ++ ++ Idea Approved ++ idea.idea ++ ++ Idea approved ++ ++ + + +\ No newline at end of file + +=== modified file 'idea/models/idea.py' +--- idea/models/idea.py 2013-06-18 13:23:37 +0000 ++++ idea/models/idea.py 2013-06-18 13:23:42 +0000 +@@ -47,6 +47,13 @@ + _rec_name = 'name' + _order = 'name asc' + ++ _track = { ++ 'state': { ++ 'idea.mt_state_approved': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'close', ++ 'idea.mt_state_change': lambda self, cr, uid, obj, ctx=None: obj['state'] != 'close', ++ }, ++ } ++ + def _get_state_list(self, cr, uid, context=None): + return [('draft', 'New'), + ('open', 'In discussion'), + diff --git a/addons/idea/doc/patch7_messagepost.txt b/addons/idea/doc/patch7_messagepost.txt new file mode 100644 index 00000000000..492fef88bdd --- /dev/null +++ b/addons/idea/doc/patch7_messagepost.txt @@ -0,0 +1,31 @@ +=== modified file 'idea/data/idea.xml' +--- idea/data/idea.xml 2013-06-18 13:25:00 +0000 ++++ idea/data/idea.xml 2013-06-18 13:27:58 +0000 +@@ -15,6 +15,11 @@ + + Idea approved + ++ ++ Priority High ++ idea.idea ++ Priority set to high ++ + + + +\ No newline at end of file + +=== modified file 'idea/models/idea.py' +--- idea/models/idea.py 2013-06-18 13:25:00 +0000 ++++ idea/models/idea.py 2013-06-18 13:26:50 +0000 +@@ -136,4 +136,9 @@ + return self.write(cr, uid, ids, {'priority': 'normal'}, context=context) + + def idea_set_high_priority(self, cr, uid, ids, context={}): ++ for idea in self.browse(cr, uid, ids, context=context): ++ self.message_post(cr, uid, ids, body='Your idea has been set as high priority. Congratulations!', ++ subtype='idea.mt_priority_high', ++ partner_ids=[idea.user_id.partner_id.id], ++ context=context) + return self.write(cr, uid, ids, {'priority': 'high'}, context=context) + -- cgit v1.2.3 From 734d900207bf097f8778aa31bcbf008f4372b14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 25 Jun 2013 12:54:52 +0200 Subject: [REM] Removed patches. bzr revid: tde@openerp.com-20130625105452-u7uqmvo73pqjzsp6 --- addons/idea/doc/apply.txt | 20 ----------- addons/idea/doc/patch1_mailthread.txt | 29 ---------------- addons/idea/doc/patch2_needaction.txt | 27 --------------- addons/idea/doc/patch3_treebold.txt | 20 ----------- addons/idea/doc/patch4_chatterkanban.txt | 27 --------------- addons/idea/doc/patch5_trackvisibility.txt | 28 --------------- addons/idea/doc/patch6_subtypes.txt | 55 ------------------------------ addons/idea/doc/patch7_messagepost.txt | 31 ----------------- 8 files changed, 237 deletions(-) delete mode 100644 addons/idea/doc/apply.txt delete mode 100644 addons/idea/doc/patch1_mailthread.txt delete mode 100644 addons/idea/doc/patch2_needaction.txt delete mode 100644 addons/idea/doc/patch3_treebold.txt delete mode 100644 addons/idea/doc/patch4_chatterkanban.txt delete mode 100644 addons/idea/doc/patch5_trackvisibility.txt delete mode 100644 addons/idea/doc/patch6_subtypes.txt delete mode 100644 addons/idea/doc/patch7_messagepost.txt (limited to 'addons/idea') diff --git a/addons/idea/doc/apply.txt b/addons/idea/doc/apply.txt deleted file mode 100644 index 5af4f0582ae..00000000000 --- a/addons/idea/doc/apply.txt +++ /dev/null @@ -1,20 +0,0 @@ -bzr patch idea/doc/patch1_mailthread.txt -bzr ci -m "[IMP] Patch1: added mail_thread inheritance + widgets" - -bzr patch idea/doc/patch2_needaction.txt -bzr ci -m "[IMP] Patch2: added ir_needactionmixin inheritance + unread filter" - -bzr patch idea/doc/patch3_treebold.txt -bzr ci -m "[IMP] Patch3: use message_unread in tree view to put ideas in bold" - -bzr patch idea/doc/patch4_chatterkanban.txt -bzr ci -m "[IMP] Patch4: add chatter data in kanban view" - -bzr patch idea/doc/patch5_trackvisibility.txt -bzr ci -m "[IMP] Patch5: track user_id and state to automatically generate logs." - -bzr patch idea/doc/patch6_subtypes.txt -bzr ci -m "[IMP] Patch6: add a subtype on messages about state changed and idea approved, using automatic tracking." - -bzr patch idea/doc/patch7_messagepost.txt -bzr ci -m "[IMP] Patch7: add a message_post with a subtype" diff --git a/addons/idea/doc/patch1_mailthread.txt b/addons/idea/doc/patch1_mailthread.txt deleted file mode 100644 index 7aeecd54a1f..00000000000 --- a/addons/idea/doc/patch1_mailthread.txt +++ /dev/null @@ -1,29 +0,0 @@ -=== modified file 'idea/models/idea.py' ---- idea/models/idea.py 2013-06-18 10:16:21 +0000 -+++ idea/models/idea.py 2013-06-18 10:16:39 +0000 -@@ -47,6 +47,7 @@ - """ Model of an Idea """ - _name = 'idea.idea' - _description = 'Propose and Share your Ideas' -+ _inherit = ['mail.thread'] - - _rec_name = 'name' - _order = 'name asc' - -=== modified file 'idea/views/idea.xml' ---- idea/views/idea.xml 2013-06-18 10:16:21 +0000 -+++ idea/views/idea.xml 2013-06-18 10:16:47 +0000 -@@ -56,6 +56,12 @@ - - - -+
-+ -+ -+
- -
- - diff --git a/addons/idea/doc/patch2_needaction.txt b/addons/idea/doc/patch2_needaction.txt deleted file mode 100644 index 6897d597fd3..00000000000 --- a/addons/idea/doc/patch2_needaction.txt +++ /dev/null @@ -1,27 +0,0 @@ -=== modified file 'idea/models/idea.py' ---- idea/models/idea.py 2013-06-18 10:34:31 +0000 -+++ idea/models/idea.py 2013-06-18 10:36:26 +0000 -@@ -47,7 +47,7 @@ - """ Model of an Idea """ - _name = 'idea.idea' - _description = 'Propose and Share your Ideas' -- _inherit = ['mail.thread'] -+ _inherit = ['mail.thread', 'ir.needaction_mixin'] - - _rec_name = 'name' - _order = 'name asc' - -=== modified file 'idea/views/idea.xml' ---- idea/views/idea.xml 2013-06-18 10:34:31 +0000 -+++ idea/views/idea.xml 2013-06-18 10:36:08 +0000 -@@ -92,6 +92,9 @@ - help="Open Ideas"/> - -+ - - - - diff --git a/addons/idea/doc/patch3_treebold.txt b/addons/idea/doc/patch3_treebold.txt deleted file mode 100644 index 9521837750a..00000000000 --- a/addons/idea/doc/patch3_treebold.txt +++ /dev/null @@ -1,20 +0,0 @@ -=== modified file 'idea/views/idea.xml' ---- idea/views/idea.xml 2013-06-18 13:17:10 +0000 -+++ idea/views/idea.xml 2013-06-18 13:17:57 +0000 -@@ -75,11 +75,14 @@ - idea.idea.tree - idea.idea - -- -+ - - - - -+ - - - - diff --git a/addons/idea/doc/patch4_chatterkanban.txt b/addons/idea/doc/patch4_chatterkanban.txt deleted file mode 100644 index ccce81db7a6..00000000000 --- a/addons/idea/doc/patch4_chatterkanban.txt +++ /dev/null @@ -1,27 +0,0 @@ -=== modified file 'idea/views/idea.xml' ---- idea/views/idea.xml 2013-06-18 10:58:33 +0000 -+++ idea/views/idea.xml 2013-06-18 11:03:38 +0000 -@@ -8,6 +8,9 @@ - - - -+ -+ -+ - - -
-@@ -27,6 +30,12 @@ -
- -
-+ -+ -
-
-
- diff --git a/addons/idea/doc/patch5_trackvisibility.txt b/addons/idea/doc/patch5_trackvisibility.txt deleted file mode 100644 index dd62f44710a..00000000000 --- a/addons/idea/doc/patch5_trackvisibility.txt +++ /dev/null @@ -1,28 +0,0 @@ -=== modified file 'idea/models/idea.py' ---- idea/models/idea.py 2013-06-18 13:29:15 +0000 -+++ idea/models/idea.py 2013-06-18 13:29:38 +0000 -@@ -63,7 +63,8 @@ - return res - - _columns = { -- 'user_id': fields.many2one('res.users', 'Responsible', required=True), -+ 'user_id': fields.many2one('res.users', 'Responsible', required=True, -+ track_visibility='onchange'), - 'name': fields.char('Summary', required=True, readonly=True, - states={'draft': [('readonly', False)]}, - oldname='title'), -@@ -71,9 +72,11 @@ - states={'draft': [('readonly', False)]}, - help='Content of the idea'), - 'category_ids': fields.many2many('idea.category', string='Tags'), -- 'state': fields.selection(_get_state_list, string='Status', required=True), -+ 'state': fields.selection(_get_state_list, string='Status', required=True, -+ track_visibility='onchange'), - 'priority': fields.selection([('low', 'Low'), ('normal', 'Normal'), ('high', 'High')], -- string='Priority', required=True), -+ string='Priority', required=True, -+ track_visibility='always'), - 'color': fields.function(_get_color, type='integer', string='Color Index'), - } - - diff --git a/addons/idea/doc/patch6_subtypes.txt b/addons/idea/doc/patch6_subtypes.txt deleted file mode 100644 index 429b95d57d1..00000000000 --- a/addons/idea/doc/patch6_subtypes.txt +++ /dev/null @@ -1,55 +0,0 @@ -=== modified file 'idea/__openerp__.py' ---- idea/__openerp__.py 2013-06-18 10:16:21 +0000 -+++ idea/__openerp__.py 2013-06-18 13:23:42 +0000 -@@ -41,6 +41,7 @@ - 'security/ir.model.access.csv', - 'views/idea.xml', - 'views/category.xml', -+ 'data/idea.xml', - 'data/idea_workflow.xml', - ], - 'demo': [ - -=== modified file 'idea/data/idea.xml' ---- idea/data/idea.xml 2013-06-18 13:23:19 +0000 -+++ idea/data/idea.xml 2013-06-18 13:23:56 +0000 -@@ -2,5 +2,19 @@ - - - -+ -+ -+ State Changed -+ idea.idea -+ -+ State changed -+ -+ -+ Idea Approved -+ idea.idea -+ -+ Idea approved -+ -+ - - -\ No newline at end of file - -=== modified file 'idea/models/idea.py' ---- idea/models/idea.py 2013-06-18 13:23:37 +0000 -+++ idea/models/idea.py 2013-06-18 13:23:42 +0000 -@@ -47,6 +47,13 @@ - _rec_name = 'name' - _order = 'name asc' - -+ _track = { -+ 'state': { -+ 'idea.mt_state_approved': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'close', -+ 'idea.mt_state_change': lambda self, cr, uid, obj, ctx=None: obj['state'] != 'close', -+ }, -+ } -+ - def _get_state_list(self, cr, uid, context=None): - return [('draft', 'New'), - ('open', 'In discussion'), - diff --git a/addons/idea/doc/patch7_messagepost.txt b/addons/idea/doc/patch7_messagepost.txt deleted file mode 100644 index 492fef88bdd..00000000000 --- a/addons/idea/doc/patch7_messagepost.txt +++ /dev/null @@ -1,31 +0,0 @@ -=== modified file 'idea/data/idea.xml' ---- idea/data/idea.xml 2013-06-18 13:25:00 +0000 -+++ idea/data/idea.xml 2013-06-18 13:27:58 +0000 -@@ -15,6 +15,11 @@ - - Idea approved - -+ -+ Priority High -+ idea.idea -+ Priority set to high -+ - - - -\ No newline at end of file - -=== modified file 'idea/models/idea.py' ---- idea/models/idea.py 2013-06-18 13:25:00 +0000 -+++ idea/models/idea.py 2013-06-18 13:26:50 +0000 -@@ -136,4 +136,9 @@ - return self.write(cr, uid, ids, {'priority': 'normal'}, context=context) - - def idea_set_high_priority(self, cr, uid, ids, context={}): -+ for idea in self.browse(cr, uid, ids, context=context): -+ self.message_post(cr, uid, ids, body='Your idea has been set as high priority. Congratulations!', -+ subtype='idea.mt_priority_high', -+ partner_ids=[idea.user_id.partner_id.id], -+ context=context) - return self.write(cr, uid, ids, {'priority': 'high'}, context=context) - -- cgit v1.2.3 From 3e6693e7311452d51a744ce4e172ab631880f83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 25 Jun 2013 13:11:10 +0200 Subject: [CLEAN] Misc cleaning bzr revid: tde@openerp.com-20130625111110-awwcjpq00xhohz93 --- addons/idea/__openerp__.py | 1 + addons/idea/models/idea.py | 1 + 2 files changed, 2 insertions(+) (limited to 'addons/idea') diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index 8d87416fcfe..7d8560a2cf4 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -41,6 +41,7 @@ Once installed, check the menu 'Ideas' in the 'Tools' main menu.""", 'security/ir.model.access.csv', 'views/idea.xml', 'views/category.xml', + 'data/idea.xml', 'data/idea_workflow.xml', ], 'demo': [ diff --git a/addons/idea/models/idea.py b/addons/idea/models/idea.py index 910a0de483d..61934cfc3b2 100644 --- a/addons/idea/models/idea.py +++ b/addons/idea/models/idea.py @@ -27,6 +27,7 @@ class IdeaCategory(osv.Model): """ Category of Idea """ _name = "idea.category" _description = "Idea Category" + _order = 'name asc' _columns = { -- cgit v1.2.3 From 3f03d663541396fbba82d914ea8860938c2becab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 25 Jun 2013 13:15:08 +0200 Subject: [IMP] Idea: small imp of kanban view bzr revid: tde@openerp.com-20130625111508-2man23lschgqm427 --- addons/idea/views/idea.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/idea') diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index 87094a29ace..b228af2da45 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -23,11 +23,10 @@

- -
+
-- cgit v1.2.3