[IMP] idea : add wizard to give vote from list view of idea
bzr revid: hmo@tinyerp.com-20100121140745-b6wfwlpqor5g5n0q
This commit is contained in:
@@ -20,5 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
import idea
|
||||
import wizard
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -30,10 +30,11 @@
|
||||
'depends': ['base'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'idea_wizard.xml',
|
||||
'idea_view.xml',
|
||||
'idea_workflow.xml',
|
||||
'security/idea_security.xml',
|
||||
'security/ir.model.access.csv'
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
||||
@@ -174,6 +174,7 @@ class idea_vote(osv.osv):
|
||||
'score': fields.selection( VoteValues, 'Score', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
#'user_id': lambda self, cr, uid, context: uid,
|
||||
'score': lambda *a: DefaultVoteValue,
|
||||
}
|
||||
idea_vote()
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<field name="title" select="1" />
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="my_vote"/>
|
||||
<!--<field name="my_vote"/>-->
|
||||
<field name="vote_avg" />
|
||||
<field name="description" colspan="4" select="2" widget="text_wiki"/>
|
||||
<field name="state" select="2"/>
|
||||
@@ -131,6 +131,9 @@
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Vote">
|
||||
<field name="vote_ids" nolabel="1" colspan="4" />
|
||||
</page>
|
||||
<page string="Statistics">
|
||||
<field name="stat_vote_ids" colspan="4" mode="graph,tree" nolabel="1">
|
||||
<graph string="vote_stat of ideas" type="bar">
|
||||
@@ -161,6 +164,7 @@
|
||||
<field name="vote_avg" />
|
||||
<field name="count_comments" />
|
||||
<field name="count_votes" />
|
||||
<button name="%(wizard_idea_post_vote)d" icon="gtk-execute" type="action" states="draft,open" string="Vote"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -204,7 +208,7 @@
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_idea_idea_search"/>
|
||||
</record>
|
||||
<menuitem name="All Ideas" parent="menu_ideas1" id="menu_idea_idea" action="action_idea_idea"/>
|
||||
<menuitem name="Ideas" parent="menu_ideas1" id="menu_idea_idea" action="action_idea_idea"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_idea_open">
|
||||
<field name="name">Open Ideas</field>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<wizard
|
||||
id="wizard_idea_post_vote"
|
||||
model="idea.idea"
|
||||
name="idea.post.vote"
|
||||
menu="True"
|
||||
string="Vote"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import idea_vote
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import ir
|
||||
from mx.DateTime import now
|
||||
import pooler
|
||||
import netsvc
|
||||
|
||||
vote_form = """<?xml version="1.0" ?>
|
||||
<form string="Create Tasks">
|
||||
<field name="vote"/>
|
||||
</form>"""
|
||||
|
||||
vote_fields = {
|
||||
'vote': {'string': 'Post Vote', 'type': 'selection',
|
||||
'selection': [('-1','Not Voted'),('0','Very Bad'),('25', 'Bad'),('50','Normal'),('75','Good'),('100','Very Good') ]},
|
||||
}
|
||||
|
||||
|
||||
|
||||
class idea_vote(wizard.interface):
|
||||
def _do_vote(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
vote_obj = pool.get('idea.vote')
|
||||
score=str(data['form']['vote'])
|
||||
dic={'idea_id' : data['id'], 'user_id' : uid, 'score' : score }
|
||||
vote=vote_obj.create(cr,uid,dic)
|
||||
return True
|
||||
|
||||
states = {
|
||||
'init':{
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':vote_form, 'fields':vote_fields, 'state':[('end', 'Cancel'), ('post', 'Post Vote')] },
|
||||
},
|
||||
'post':{
|
||||
'actions': [],
|
||||
'result': {'type':'action', 'action': _do_vote, 'state':'end'},
|
||||
},
|
||||
}
|
||||
idea_vote('idea.post.vote')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user