[IMP]: idea: code optimization and apply csv file and doc string
bzr revid: ksa@tinyerp.co.in-20100317104402-7ea5pgzk4z6q9p26
This commit is contained in:
parent
da226e3078
commit
9089edc031
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,11 +15,12 @@
|
|||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import idea
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
|||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
@ -24,7 +24,16 @@
|
|||
'name': 'Idea Manager',
|
||||
'version': '0.1',
|
||||
'category': 'Tools',
|
||||
'description': """This module allows your user to easily and efficiently participate in the innovation of the enterprise. It allows everybody to express ideas about different subjects. Then, others users can comment these ideas and vote for particular ideas. Each idea as a score based on the different votes. The managers can obtain an easy view on best ideas from all the users. Once installed, check the menu 'Ideas' in the 'Tools' main menu.""",
|
||||
'description': """This module allows your user to easily and efficiently
|
||||
participate in the innovation of the enterprise.
|
||||
It allows everybody to express ideas about different subjects.
|
||||
Then, others users can comment these ideas and vote for
|
||||
particular ideas. Each idea as a score based on the
|
||||
different votes.
|
||||
The managers can obtain an easy view on best ideas from all
|
||||
the users. Once installed, check the menu 'Ideas' in the 'Tools' main menu.""",
|
||||
|
||||
|
||||
'author': 'Tiny',
|
||||
'website': 'http://openerp.com',
|
||||
'depends': ['base'],
|
||||
|
@ -34,7 +43,7 @@
|
|||
'idea_view.xml',
|
||||
'idea_workflow.xml',
|
||||
'security/idea_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
|
|
|
@ -27,13 +27,15 @@ DefaultVoteValue = '50'
|
|||
|
||||
class idea_category(osv.osv):
|
||||
""" Category of Idea """
|
||||
|
||||
_name = "idea.category"
|
||||
_description = "Category for an idea"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Category', size=64, required=True),
|
||||
'summary': fields.text('Summary'),
|
||||
'parent_id': fields.many2one('idea.category','Parent Categories', ondelete='set null'),
|
||||
'child_ids': fields.one2many('idea.category','parent_id','Child Categories')
|
||||
'parent_id': fields.many2one('idea.category', 'Parent Categories', ondelete='set null'),
|
||||
'child_ids': fields.one2many('idea.category', 'parent_id', 'Child Categories')
|
||||
}
|
||||
_sql_constraints = [
|
||||
('name', 'unique(parent_id,name)', 'The name of the category must be unique' )
|
||||
|
@ -44,11 +46,18 @@ idea_category()
|
|||
|
||||
|
||||
class idea_idea(osv.osv):
|
||||
""" Idea """
|
||||
_name = 'idea.idea'
|
||||
_rec_name = 'title'
|
||||
|
||||
def _vote_avg_compute(self, cr, uid, ids, name, arg, context = None):
|
||||
""" compute average for voting """
|
||||
|
||||
""" compute average for voting
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of voting’s IDs
|
||||
@return: dictionay of Idea """
|
||||
|
||||
if not ids:
|
||||
return {}
|
||||
|
||||
|
@ -61,8 +70,14 @@ class idea_idea(osv.osv):
|
|||
cr.execute(sql, (ids,))
|
||||
return dict(cr.fetchall())
|
||||
|
||||
def _vote_count(self,cr,uid,ids,name,arg,context=None):
|
||||
""" count number of vote """
|
||||
def _vote_count(self, cr, uid, ids, name, arg, context=None):
|
||||
|
||||
""" count number of vote
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of voting count’s IDs
|
||||
@return: dictionay of Idea """
|
||||
|
||||
if not ids:
|
||||
return {}
|
||||
|
||||
|
@ -75,8 +90,14 @@ class idea_idea(osv.osv):
|
|||
cr.execute(sql, (ids,))
|
||||
return dict(cr.fetchall())
|
||||
|
||||
def _comment_count(self,cr,uid,ids,name,arg,context=None):
|
||||
""" count number of comment """
|
||||
def _comment_count(self, cr, uid, ids, name, arg, context=None):
|
||||
|
||||
""" count number of comment
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of comment’s IDs
|
||||
@return: dictionay of Idea """
|
||||
|
||||
if not ids:
|
||||
return {}
|
||||
|
||||
|
@ -86,32 +107,46 @@ class idea_idea(osv.osv):
|
|||
GROUP BY i.id
|
||||
"""
|
||||
|
||||
cr.execute(sql,(ids,))
|
||||
cr.execute(sql, (ids,))
|
||||
return dict(cr.fetchall())
|
||||
|
||||
def _vote_read(self, cr, uid, ids, name, arg, context = None):
|
||||
|
||||
""" Read Vote
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of vote read’s IDs """
|
||||
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = '-1'
|
||||
vote_obj = self.pool.get('idea.vote')
|
||||
votes_ids = vote_obj.search(cr, uid, [('idea_id', 'in', ids), ('user_id', '=', uid)])
|
||||
vote_obj_id = vote_obj.browse(cr, uid, votes_ids, context)
|
||||
|
||||
for vote in vote_obj_id:
|
||||
res[vote.idea_id.id] = vote.score
|
||||
return res
|
||||
|
||||
def _vote_save(self, cr, uid, id, field_name, field_value, arg, context = None):
|
||||
|
||||
""" save Vote
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of vote save’s IDs """
|
||||
|
||||
vote_obj = self.pool.get('idea.vote')
|
||||
vote = vote_obj.search(cr,uid,[('idea_id', '=', id),('user_id', '=', uid)])
|
||||
vote = vote_obj.search(cr, uid, [('idea_id', '=', id), ('user_id', '=', uid)])
|
||||
textual_value = str(field_value)
|
||||
|
||||
if vote:
|
||||
if int(field_value)>=0:
|
||||
vote_obj.write(cr,uid,vote,{'score': textual_value })
|
||||
if int(field_value) >= 0:
|
||||
vote_obj.write(cr, uid, vote, {'score': textual_value })
|
||||
else:
|
||||
vote_obj.unlink(cr,uid,vote)
|
||||
vote_obj.unlink(cr, uid, vote)
|
||||
else:
|
||||
if int(field_value)>=0:
|
||||
vote_obj.create(cr,uid, {'idea_id': id,'user_id': uid,'score': textual_value })
|
||||
if int(field_value) >= 0:
|
||||
vote_obj.create(cr, uid, {'idea_id': id, 'user_id': uid, 'score': textual_value })
|
||||
|
||||
|
||||
_columns = {
|
||||
|
@ -119,15 +154,20 @@ 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),
|
||||
'create_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),
|
||||
'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"),
|
||||
'count_votes': fields.function(_vote_count, method=True, string="Count of votes", type="integer"),
|
||||
'count_comments': fields.function(_comment_count, method=True, string="Count of comments", type="integer"),
|
||||
'category_id': fields.many2one('idea.category', 'Category', required=True ),
|
||||
'state': fields.selection([('draft','Draft'),('open','Opened'),('close','Accepted'),('cancel','Cancelled')], 'State', readonly=True,
|
||||
help='When the Idea is created the state is \'Draft\'.\n It is opened by the user, the state is \'Opened\'.\
|
||||
'count_comments': fields.function(_comment_count, method=True, \
|
||||
string="Count of comments", type="integer"),
|
||||
'category_id': fields.many2one('idea.category', 'Category', required=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('open', 'Opened'), \
|
||||
('close', 'Accepted'), ('cancel', 'Cancelled')], \
|
||||
'State', readonly=True,
|
||||
help='When the Idea is created the state is \'Draft\'.\n It is \
|
||||
opened by the user, the state is \'Opened\'.\
|
||||
\nIf the idea is accepted, the state is \'Accepted\'.'),
|
||||
'stat_vote_ids': fields.one2many('idea.vote.stat', 'idea_id', 'Statistics', readonly=True),
|
||||
}
|
||||
|
@ -159,51 +199,61 @@ idea_idea()
|
|||
|
||||
class idea_comment(osv.osv):
|
||||
""" Apply Idea for Comment """
|
||||
|
||||
_name = 'idea.comment'
|
||||
_description = 'Comments'
|
||||
_rec_name = 'content'
|
||||
|
||||
_columns = {
|
||||
'idea_id': fields.many2one('idea.idea', 'Idea', required=True, ondelete='cascade' ),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True ),
|
||||
'content': fields.text('Comment', required=True ),
|
||||
'create_date' : fields.datetime('Creation date', readonly=True),
|
||||
'idea_id': fields.many2one('idea.idea', 'Idea', required=True, ondelete='cascade'),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True),
|
||||
'content': fields.text('Comment', required=True),
|
||||
'create_date': fields.datetime('Creation date', readonly=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'user_id': lambda self, cr, uid, context: uid
|
||||
}
|
||||
|
||||
_order = 'id desc'
|
||||
|
||||
idea_comment()
|
||||
|
||||
|
||||
class idea_vote(osv.osv):
|
||||
""" Apply Idea for Vote """
|
||||
|
||||
_name = 'idea.vote'
|
||||
_description = 'Vote for Idea'
|
||||
_rec_name = 'score'
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one( 'res.users', 'User'),
|
||||
'user_id': fields.many2one('res.users', 'User'),
|
||||
'idea_id': fields.many2one('idea.idea', 'Idea', required=True, ondelete='cascade'),
|
||||
'score': fields.selection( VoteValues, 'Score', required=True)
|
||||
'score': fields.selection(VoteValues, 'Score', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'score': lambda *a: DefaultVoteValue,
|
||||
}
|
||||
|
||||
idea_vote()
|
||||
|
||||
|
||||
class idea_vote_stat(osv.osv):
|
||||
""" Idea votes Statistics """
|
||||
|
||||
_name = 'idea.vote.stat'
|
||||
_description = 'Idea Votes Statistics'
|
||||
_auto = False
|
||||
_rec_name = 'idea_id'
|
||||
|
||||
_columns = {
|
||||
'idea_id': fields.many2one('idea.idea', 'Idea', readonly=True),
|
||||
'score': fields.selection(VoteValues, 'Score', readonly=True),
|
||||
'nbr': fields.integer('Number of Votes', readonly=True),
|
||||
}
|
||||
|
||||
def init(self,cr):
|
||||
def init(self, cr):
|
||||
"""
|
||||
initialize the sql view for the stats
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Idea Category -->
|
||||
<!-- Idea Category Form View -->
|
||||
|
||||
<menuitem name="Tools" id="base.menu_tools" icon="STOCK_PREFERENCES" sequence="15"/>
|
||||
<record model="ir.ui.view" id="view_idea_category_form">
|
||||
|
@ -18,6 +18,9 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Category Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_category_tree">
|
||||
<field name="name">idea.category.tree</field>
|
||||
<field name="model">idea.category</field>
|
||||
|
@ -29,12 +32,16 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Category Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_category">
|
||||
<field name="name">Categories</field>
|
||||
<field name="res_model">idea.category</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Configuration" parent="base.menu_tools"
|
||||
id="base.menu_lunch_survey_root" sequence="6"/>
|
||||
|
||||
|
@ -43,6 +50,8 @@
|
|||
<menuitem name="Categories" parent="menu_ideas"
|
||||
id="menu_idea_category" action="action_idea_category" />
|
||||
|
||||
<!-- Idea Category Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_category_tree">
|
||||
<field name="name">Ideas by Categories</field>
|
||||
<field name="res_model">idea.category</field>
|
||||
|
@ -57,7 +66,7 @@
|
|||
id="menu_idea_category_tree"
|
||||
action="action_idea_category_tree"/>
|
||||
|
||||
<!-- Oepn Ideas -->
|
||||
<!-- Oepn Ideas Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_idea_categ_open">
|
||||
<field name="name">Open Ideas</field>
|
||||
|
@ -66,6 +75,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','open'),('category_id','child_of',[active_id])]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_idea_idea_categ_open_val">
|
||||
<field name="key2" eval=" 'tree_but_open'" />
|
||||
<field name="model" eval="'idea.category'" />
|
||||
|
@ -74,7 +84,7 @@
|
|||
<field name="object" eval="True" />
|
||||
</record>
|
||||
|
||||
<!-- Idea statistics -->
|
||||
<!-- Idea statistics Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_stat_form">
|
||||
<field name="name">idea.stat.form</field>
|
||||
|
@ -89,7 +99,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Vote -->
|
||||
<!--Vote For Idea Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_vote_tree">
|
||||
<field name="name">idea.vote.tree</field>
|
||||
|
@ -103,6 +113,9 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Vote For Idea Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_vote_form">
|
||||
<field name="name">idea.vote.form</field>
|
||||
<field name="model">idea.vote</field>
|
||||
|
@ -116,7 +129,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- New Idea -->
|
||||
<!-- New Idea Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_idea_form">
|
||||
<field name="name">idea.idea.form</field>
|
||||
|
@ -166,6 +179,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- New Idea Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_idea_tree">
|
||||
<field name="name">idea.idea.tree</field>
|
||||
<field name="model">idea.idea</field>
|
||||
|
@ -179,7 +194,8 @@
|
|||
<field name="vote_avg" />
|
||||
<field name="count_comments" />
|
||||
<field name="count_votes" />
|
||||
<button name="%(action_idea_post_vote)d" icon="gtk-execute" type="action" states="draft,open" string="Vote"/>
|
||||
<button name="%(action_idea_post_vote)d" icon="gtk-execute"
|
||||
type="action" states="draft,open" string="Vote" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -208,7 +224,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Comments on Idea -->
|
||||
<!-- Comments on Idea Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_comment_tree">
|
||||
<field name="name">idea.comment.tree</field>
|
||||
|
@ -222,6 +238,9 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_idea">
|
||||
<field name="name">Ideas</field>
|
||||
<field name="res_model">idea.idea</field>
|
||||
|
@ -229,8 +248,11 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_idea_idea_search"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Ideas" parent="menu_ideas1" id="menu_idea_idea" action="action_idea_idea"/>
|
||||
|
||||
<!-- Open Idea Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_idea_open">
|
||||
<field name="name">Open Ideas</field>
|
||||
<field name="res_model">idea.idea</field>
|
||||
|
@ -240,6 +262,8 @@
|
|||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Idea Votes Statistics Graph View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_vote_stat_graph">
|
||||
<field name="name">idea.vote_stat.graph</field>
|
||||
<field name="model">idea.vote.stat</field>
|
||||
|
@ -252,6 +276,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Votes Statistics Form View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_vote_stat_form">
|
||||
<field name="name">idea.vote.stat.form</field>
|
||||
<field name="model">idea.vote.stat</field>
|
||||
|
@ -264,6 +290,9 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Votes Statistics Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_idea_vote_stat_tree">
|
||||
<field name="name">idea.vote.stat.tree</field>
|
||||
<field name="model">idea.vote.stat</field>
|
||||
|
@ -277,6 +306,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Idea Votes Statistics Action -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_idea_vote_stat">
|
||||
<field name="name">Statistics on Votes</field>
|
||||
<field name="res_model">idea.vote.stat</field>
|
||||
|
@ -290,6 +321,7 @@
|
|||
<menuitem name="Vote Statistics" parent="menu_idea_reporting"
|
||||
id="menu_idea_vote_stat" action="action_idea_vote_stat" />
|
||||
|
||||
<!-- Vote For Idea Action -->
|
||||
<record model="ir.actions.act_window" id="action_idea_vote">
|
||||
<field name="name">Idea's vote</field>
|
||||
<field name="res_model">idea.vote</field>
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
"access_idea_vote","idea.vote","model_idea_vote","base.group_user",1,1,1,1
|
||||
"access_idea_vote_stat","idea.vote.stat","model_idea_vote_stat","base.group_user",1,0,0,0
|
||||
"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
|
||||
|
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,8 +15,10 @@
|
|||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import idea_post_vote
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -18,12 +18,15 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class idea_post_vote(osv.osv_memory):
|
||||
""" Post Vote For Idea """
|
||||
|
||||
_name = "idea.post.vote"
|
||||
_description = "Post vote"
|
||||
|
||||
_columns = {
|
||||
'vote': fields.selection([('-1', 'Not Voted'),
|
||||
('0', 'Very Bad'),
|
||||
|
@ -34,6 +37,7 @@ class idea_post_vote(osv.osv_memory):
|
|||
}
|
||||
|
||||
def do_vote(self, cr, uid, ids, context):
|
||||
|
||||
"""
|
||||
Create idea vote.
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
@ -41,10 +45,12 @@ class idea_post_vote(osv.osv_memory):
|
|||
@param ids: List of Idea Post vote’s IDs.
|
||||
@return: Dictionary {}
|
||||
"""
|
||||
|
||||
data = context and context.get('active_id', False) or False
|
||||
vote_obj = self.pool.get('idea.vote')
|
||||
for dovote_obj in self.read(cr, uid, ids):
|
||||
score = str(dovote_obj['vote'])
|
||||
|
||||
for do_vote_obj in self.read(cr, uid, ids):
|
||||
score = str(do_vote_obj['vote'])
|
||||
dic = {'idea_id': data, 'user_id': uid, 'score': score }
|
||||
vote = vote_obj.create(cr, uid, dic)
|
||||
return {}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Post Idea for vote -->
|
||||
<!-- Post Idea for vote Form View -->
|
||||
|
||||
<record id="view_idea_post_vote" model="ir.ui.view">
|
||||
<field name="name">idea.post.vote.form</field>
|
||||
|
@ -22,6 +22,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Post Idea for vote Action -->
|
||||
|
||||
<record id="action_idea_post_vote" model="ir.actions.act_window">
|
||||
<field name="name">Vote</field>
|
||||
<field name="res_model">idea.post.vote</field>
|
||||
|
@ -32,11 +34,12 @@
|
|||
<field name="context">{'record_id':active_id}</field>
|
||||
</record>
|
||||
|
||||
<!-- Post Idea for vote Action Window -->
|
||||
|
||||
<act_window id="action_idea_post_vote_values"
|
||||
key2="client_action_multi" name="vote"
|
||||
res_model="idea.post.vote" src_model="idea.idea"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue