[IMP]: idea: useability Improvement in idea

bzr revid: atp@tinyerp.co.in-20100520142257-eaqz1tcxe47a41y2
This commit is contained in:
atp (Open ERP) 2010-05-20 19:52:57 +05:30
parent 90f1e9d101
commit bd18cee28a
6 changed files with 55 additions and 38 deletions

View File

@ -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"),

View File

@ -216,9 +216,6 @@
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" states="open" type="action" string="Submit Vote"/>
<button name="idea_close" string="Accept" states="open" icon="gtk-jump-to"/>
<button name="idea_cancel" string="Refuse" states="open" icon="gtk-cancel"/>
<button name="%(action_idea_post_vote)d"
icon="gtk-execute" type="action" states="draft,open"
string="Give vote" />
</group>
</form>
</field>
@ -234,12 +231,12 @@
<tree string="Ideas">
<field name="title"/>
<field name="category_id" />
<field name="create_date"/>
<field name="created_date"/>
<field name="vote_avg" widget="progressbar"/>
<field name="count_comments" />
<field name="count_votes" />
<field name="state"/>
<button name="%(action_idea_post_vote)d" icon="gtk-execute" type="action" states="draft,open" string="Vote"/>
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" type="action" states="open" string="Submit Vote"/>
<button name="idea_close" string="Accept" states="open" icon="gtk-jump-to"/>
<button name="idea_cancel" string="Refuse" states="open" icon="gtk-cancel"/>
</tree>

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_idea_category_system idea.category system model_idea_category base.group_system 1 1 1 1
7 idea_post_vote idea.post.vote model_idea_post_vote base.group_user 1 1 1 1
8 access_idea_select idea.select model_idea_select base.group_user 1 1 1 1
9 access_idea_comment idea.comment model_idea_comment base.group_system 1 1 1 1

View File

@ -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.

View File

@ -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()

View File

@ -17,12 +17,33 @@
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="do_vote" string="Post Vote" type="object"/>
<button icon="gtk-ok" name="do_vote" string="Post" type="object"/>
</group>
</form>
</field>
</record>
<record id="view_idea_select" model="ir.ui.view">
<field name="name">idea.select.form</field>
<field name="model">idea.select</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Idea for Vote">
<group colspan="4" >
<separator string="Select Idea for Vote" colspan="4"/>
<field name="idea_id"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<label string="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Close"/>
<button icon="gtk-go-forward" name="open_vote" string="Next" type="object"/>
</group>
</form>
</field>
</record>
<!-- Post Idea for vote Action -->
<record id="action_idea_post_vote" model="ir.actions.act_window">