diff --git a/addons/idea/__init__.py b/addons/idea/__init__.py index e6f7333e055..2b8966f9e7a 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 @@ -19,5 +19,4 @@ # ############################################################################## -import idea - +import models diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index 8f32e1e91c4..7d8560a2cf4 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 @@ -22,29 +22,39 @@ { 'name': 'Ideas', - 'version': '0.1', + 'summary': 'Share and Discuss 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 Ideas module give users a way to express and discuss ideas, allowing everybody +to participate in enterprise innovation. Every user can suggest, comment ideas. 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', + 'website': 'http://www.openerp.com', 'depends': ['mail'], 'data': [ - 'security/idea_security.xml', + 'security/idea.xml', 'security/ir.model.access.csv', - 'idea_view.xml', - 'idea_workflow.xml', + 'views/idea.xml', + 'views/category.xml', + 'data/idea.xml', + 'data/idea_workflow.xml', + ], + 'demo': [ + 'demo/idea.xml', ], - 'demo': ['idea_data.xml'], - 'test':[], 'installable': True, + 'application': True, 'images': [], + 'css': [ + 'static/src/css/idea_idea.css', + ], + 'js': [], + 'qweb': [], } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/idea/data/idea.xml b/addons/idea/data/idea.xml new file mode 100644 index 00000000000..c057868d6de --- /dev/null +++ b/addons/idea/data/idea.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/addons/idea/data/idea_workflow.xml b/addons/idea/data/idea_workflow.xml new file mode 100644 index 00000000000..b460c73a6ed --- /dev/null +++ b/addons/idea/data/idea_workflow.xml @@ -0,0 +1,57 @@ + + + + + idea.wkf + idea.idea + True + + + + + True + normal + function + idea_set_normal_priority() + + + + + low + function + idea_set_low_priority() + + + + + high + function + idea_set_high_priority() + + + + + + idea_set_low_priority + + + + + + idea_set_normal_priority + + + + + + idea_set_high_priority + + + + + + idea_set_normal_priority + + + + diff --git a/addons/idea/demo/idea.xml b/addons/idea/demo/idea.xml new file mode 100644 index 00000000000..2b4ff58b973 --- /dev/null +++ b/addons/idea/demo/idea.xml @@ -0,0 +1,68 @@ + + + + + + Sales + + + Organization + + + 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). + + + + + + 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/idea.py b/addons/idea/idea.py deleted file mode 100644 index d1e250ce9a5..00000000000 --- a/addons/idea/idea.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 -from openerp.tools.translate import _ -import time - -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): - """ 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)]}), - '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 53734d53919..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..61934cfc3b2 --- /dev/null +++ b/addons/idea/models/idea.py @@ -0,0 +1,130 @@ +# -*- 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 + + +class IdeaCategory(osv.Model): + """ 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 IdeaIdea(osv.Model): + """ Model of an Idea """ + _name = 'idea.idea' + _description = 'Propose and Share your Ideas' + + _rec_name = 'name' + _order = 'name asc' + + def _get_state_list(self, cr, uid, context=None): + return [('draft', 'New'), + ('open', 'In discussion'), + ('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, + states={'draft': [('readonly', False)]}, + oldname='title'), + 'description': fields.text('Description', required=True, + 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), + '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 = [ + ('name', 'unique(name)', 'The name of the idea must be unique') + ] + + _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', + } + + #------------------------------------------------------ + # 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. """ + 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_set_low_priority(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'priority': 'low'}, context=context) + + def idea_set_normal_priority(self, cr, uid, ids, context={}): + return self.write(cr, uid, ids, {'priority': 'normal'}, 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/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 8743252c9e5..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/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/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/category.xml b/addons/idea/views/category.xml new file mode 100644 index 00000000000..79725fad73f --- /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 new file mode 100644 index 00000000000..b228af2da45 --- /dev/null +++ b/addons/idea/views/idea.xml @@ -0,0 +1,118 @@ + + + + + + idea.idea.kanban + idea.idea + + + + + + +
+
+ í + +
+
+

+
+ +
+ +
+
+
+
+
+
+
+
+ + + idea.idea.form + idea.idea + +
+
+
+ + +
+
+
+ + + idea.idea.tree + idea.idea + + + + + + + + + + + + idea.idea.search + idea.idea + + + + + + + + + + + + + + + + + + + Ideas + idea.idea + form + kanban,tree,form + + + + + + + +
+