diff --git a/addons/idea/idea.py b/addons/idea/idea.py
index a60e7d9b17f..74c6de9f721 100644
--- a/addons/idea/idea.py
+++ b/addons/idea/idea.py
@@ -22,6 +22,7 @@
from osv import osv
from osv import fields
from tools.translate import _
+import time
VoteValues = [('-1', 'Not Voted'), ('0', 'Very Bad'), ('25', 'Bad'), \
('50', 'Normal'), ('75', 'Good'), ('100', 'Very Good') ]
@@ -155,7 +156,7 @@ class idea_idea(osv.osv):
'title': fields.char('Idea Summary', size=64, required=True),
'description': fields.text('Description', required=True, help='Content of the idea'),
'comment_ids': fields.one2many('idea.comment', 'idea_id', 'Comments'),
- 'create_date': fields.datetime('Creation date', readonly=True),
+ 'created_date': fields.datetime('Creation date', readonly=True),
'vote_ids': fields.one2many('idea.vote', 'idea_id', 'Vote'),
'my_vote': fields.function(_vote_read, fnct_inv = _vote_save, string="My Vote", method=True, type="selection", selection=VoteValues),
'vote_avg': fields.function(_vote_avg_compute, method=True, string="Average Score", type="float"),
diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml
index 8cf96e3348d..18a268a410b 100644
--- a/addons/idea/idea_view.xml
+++ b/addons/idea/idea_view.xml
@@ -216,9 +216,6 @@
-
@@ -234,12 +231,12 @@
-
+
-
+
diff --git a/addons/idea/security/ir.model.access.csv b/addons/idea/security/ir.model.access.csv
index 16fc39aba10..0fe5dad9ac9 100644
--- a/addons/idea/security/ir.model.access.csv
+++ b/addons/idea/security/ir.model.access.csv
@@ -6,3 +6,4 @@
"access_idea_category_system","idea.category system","model_idea_category","base.group_system",1,1,1,1
"idea_post_vote","idea.post.vote","model_idea_post_vote","base.group_user",1,1,1,1
"access_idea_select","idea.select","model_idea_select","base.group_user",1,1,1,1
+"access_idea_comment","idea.comment","model_idea_comment","base.group_system",1,1,1,1
diff --git a/addons/idea/test/test_idea.yml b/addons/idea/test/test_idea.yml
index cc1b36e2737..4c3f5301a5a 100644
--- a/addons/idea/test/test_idea.yml
+++ b/addons/idea/test/test_idea.yml
@@ -44,13 +44,16 @@
!record {model: res.users, id: res_users_user1}:
company_id: base.main_company
context_lang: en_US
+ groups_id:
+ - base.group_system
+ - base.group_user
login: user2
name: user2
password: user2
- |
In order to post vote I connect as user1 and open the idea page
- I click on "Give Vote" wizard button and vote the idea as "Normal"
+ I click on "Submit Vote" wizard button and vote the idea as "Normal"
-
!record {model: idea.post.vote, id: idea_post_vote_0}:
vote: 50
@@ -63,15 +66,16 @@
self.do_vote(cr, uid, [ref("idea_post_vote_0")], {'active_ids': [ref('idea_idea_0')]})
- |
- To add other vote I connect as user2 and open the idea page
- I click on "Give Vote" wizard and vote the idea as "Very Good" and put comment "We can learn many things from technical presentation".
+ To add other vote I connect as user2 and open the idea page.
+
+ I click on "Submit Vote" wizard button and vote the idea as "Very Good".
+
+ and put comment "We can learn many things from technical presentation".
-
!record {model: idea.post.vote, id: idea_post_vote_1}:
vote: 100
- content: We can learn many things from technical presentation
-
-
+ note: 'We can learn many things from technical presentation'
- |
I click on "Post" button of this wizard.
-
@@ -84,15 +88,6 @@
-
!record {model: idea.idea, id: idea_idea_0}:
vote_avg: 75
-
-- |
- I put one comment "We can learn many things from technical presentation" for the idea.
--
- !record {model: idea.idea, id: idea.idea_idea_0}:
- comment_ids:
- - content: "We can learn many things from technical presentation"
- idea_id: idea.idea_idea_0
- user_id: res_users_user1
- |
I connect as Manager and close this idea by click on "Close" button.
diff --git a/addons/idea/wizard/idea_post_vote.py b/addons/idea/wizard/idea_post_vote.py
index 478cfa13b38..20ef22a5f2d 100644
--- a/addons/idea/wizard/idea_post_vote.py
+++ b/addons/idea/wizard/idea_post_vote.py
@@ -100,29 +100,31 @@ class idea_post_vote(osv.osv_memory):
@return: Dictionary {}
"""
- vote_id = context and context.get('active_id', False) or False
+ vote_ids = context and context.get('active_ids', []) or []
vote_pool = self.pool.get('idea.vote')
comment_pool = self.pool.get('idea.comment')
-
for do_vote_obj in self.read(cr, uid, ids):
score = str(do_vote_obj['vote'])
comment = do_vote_obj.get('note', False)
- vote = {
- 'idea_id': vote_id,
- 'user_id': uid,
- 'score': score
- }
- if comment:
- comment = {
- 'user_id':uid,
- 'idea_id':vote_id,
- 'content': comment,
- }
- comment = comment_pool.create(cr, uid, comment)
+
+ for vote_id in vote_ids:
- vote = vote_pool.create(cr, uid, vote)
- return {}
+ vote = {
+ 'idea_id': vote_id,
+ 'user_id': uid,
+ 'score': score
+ }
+ if comment:
+ comment = {
+ 'user_id':uid,
+ 'idea_id':vote_id,
+ 'content': comment,
+ }
+ comment = comment_pool.create(cr, uid, comment)
+
+ vote = vote_pool.create(cr, uid, vote)
+ return {}
idea_post_vote()
diff --git a/addons/idea/wizard/idea_post_vote_view.xml b/addons/idea/wizard/idea_post_vote_view.xml
index e8a9ca69884..ef1a338dcd4 100644
--- a/addons/idea/wizard/idea_post_vote_view.xml
+++ b/addons/idea/wizard/idea_post_vote_view.xml
@@ -17,12 +17,33 @@
-
+
+
+
+ idea.select.form
+ idea.select
+ form
+
+
+
+
+