diff options
| author | sgo@tinyerp.com <> | 2013-06-26 16:40:29 +0530 |
|---|---|---|
| committer | sgo@tinyerp.com <> | 2013-06-26 16:40:29 +0530 |
| commit | 2e272a76872cee16de1ecbdc8f67fdf4a84f27e4 (patch) | |
| tree | 73883be0a6ba0f3ad7f0ee6299db56279d471c6b /addons/idea | |
| parent | 2ed45d19d31344e332ae3632abec8c791efab1f0 (diff) | |
| parent | c180afab26171617c1c7c22db5d9836b159e5e7d (diff) | |
[MERGE]sync with trunk
bzr revid: sgo@tinyerp.com-20130626111029-e6szwugpewn3cd2g
Diffstat (limited to 'addons/idea')
| -rw-r--r-- | addons/idea/__init__.py | 5 | ||||
| -rw-r--r-- | addons/idea/__openerp__.py | 36 | ||||
| -rw-r--r-- | addons/idea/data/idea.xml | 6 | ||||
| -rw-r--r-- | addons/idea/data/idea_workflow.xml | 57 | ||||
| -rw-r--r-- | addons/idea/demo/idea.xml | 68 | ||||
| -rw-r--r-- | addons/idea/idea.py | 78 | ||||
| -rw-r--r-- | addons/idea/idea_data.xml | 21 | ||||
| -rw-r--r-- | addons/idea/idea_view.xml | 135 | ||||
| -rw-r--r-- | addons/idea/idea_workflow.xml | 60 | ||||
| -rw-r--r-- | addons/idea/models/__init__.py | 22 | ||||
| -rw-r--r-- | addons/idea/models/idea.py | 130 | ||||
| -rw-r--r-- | addons/idea/security/idea.xml | 7 | ||||
| -rw-r--r-- | addons/idea/security/idea_security.xml | 12 | ||||
| -rw-r--r-- | addons/idea/security/ir.model.access.csv | 4 | ||||
| -rw-r--r-- | addons/idea/static/src/css/idea_idea.css | 21 | ||||
| -rw-r--r-- | addons/idea/static/src/img/icon.png | bin | 0 -> 142095 bytes | |||
| -rw-r--r-- | addons/idea/tests/__init__.py | 28 | ||||
| -rw-r--r-- | addons/idea/tests/test_idea.py | 39 | ||||
| -rw-r--r-- | addons/idea/views/category.xml | 56 | ||||
| -rw-r--r-- | addons/idea/views/idea.xml | 118 |
20 files changed, 579 insertions, 324 deletions
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 (<http://tiny.be>). +# Copyright (C) 2004-Today OpenERP S.A. (<http://openerp.com>). # # 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 (<http://tiny.be>). +# Copyright (C) 2004-Today OpenERP S.A. (<http://openerp.com>). # # 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 @@ +<?xml version="1.0"?> +<openerp> + <data> + + </data> +</openerp>
\ 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 @@ +<?xml version="1.0"?> +<openerp> + <data> + <record model="workflow" id="wkf_idea"> + <field name="name">idea.wkf</field> + <field name="osv">idea.idea</field> + <field name="on_create">True</field> + </record> + + <record model="workflow.activity" id="act_normal"> + <field name="wkf_id" ref="wkf_idea" /> + <field name="flow_start">True</field> + <field name="name">normal</field> + <field name="kind">function</field> + <field name="action">idea_set_normal_priority()</field> + </record> + + <record model="workflow.activity" id="act_low"> + <field name="wkf_id" ref="wkf_idea" /> + <field name="name">low</field> + <field name="kind">function</field> + <field name="action">idea_set_low_priority()</field> + </record> + + <record model="workflow.activity" id="act_high"> + <field name="wkf_id" ref="wkf_idea" /> + <field name="name">high</field> + <field name="kind">function</field> + <field name="action">idea_set_high_priority()</field> + </record> + + <record model="workflow.transition" id="t1"> + <field name="act_from" ref="act_normal" /> + <field name="act_to" ref="act_low" /> + <field name="signal">idea_set_low_priority</field> + </record> + + <record model="workflow.transition" id="t2"> + <field name="act_from" ref="act_low" /> + <field name="act_to" ref="act_normal" /> + <field name="signal">idea_set_normal_priority</field> + </record> + + <record model="workflow.transition" id="t3"> + <field name="act_from" ref="act_normal" /> + <field name="act_to" ref="act_high" /> + <field name="signal">idea_set_high_priority</field> + </record> + + <record model="workflow.transition" id="t4"> + <field name="act_from" ref="act_high" /> + <field name="act_to" ref="act_normal" /> + <field name="signal">idea_set_normal_priority</field> + </record> + + </data> +</openerp> 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 @@ +<?xml version="1.0"?> +<openerp> + <data> + + <record model="idea.category" id="idea_cat_0"> + <field name="name">Sales</field> + </record> + <record model="idea.category" id="idea_cat_1"> + <field name="name">Organization</field> + </record> + <record model="idea.category" id="idea_cat_2"> + <field name="name">Technical</field> + </record> + + <record model="idea.idea" id="idea_idea_0"> + <field name="name">Docking station along with tablet PC</field> + <field name="description">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).</field> + <field name="user_id" eval="ref('base.user_demo')"/> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_0')])]"/> + </record> + + <record model="idea.idea" id="idea_idea_1"> + <field name="name">Communicate using emails</field> + <field name="description">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.</field> + <field name="user_id" eval="ref('base.user_demo')"/> + <field name="state">open</field> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_0'), ref('idea.idea_cat_1')])]"/> + </record> + <workflow action="idea_set_high_priority" model="idea.idea" ref="idea_idea_1"/> + + <record model="idea.idea" id="idea_idea_2"> + <field name="name">Use a two-stages testing phase</field> + <field name="description">We should perform testing using two levels of validation.</field> + <field name="user_id" eval="ref('base.user_root')"/> + <field name="state">open</field> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_1'), ref('idea.idea_cat_2')])]"/> + </record> + <workflow action="idea_set_high_priority" model="idea.idea" ref="idea_idea_2"/> + + <record model="idea.idea" id="idea_idea_3"> + <field name="name">Write some functional documentation about procurements</field> + <field name="description">We receive many questions about OpenChatter. Maybe some functional doc could save us some time.</field> + <field name="user_id" eval="ref('base.user_demo')"/> + <field name="state">open</field> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_0'), ref('idea.idea_cat_1')])]"/> + </record> + + <record model="idea.idea" id="idea_idea_4"> + <field name="name">Better management of smtp errors</field> + <field name="description">There should be away to store the reason why some emails are not sent.</field> + <field name="user_id" eval="ref('base.user_root')"/> + <field name="state">close</field> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_2')])]"/> + </record> + <workflow action="idea_set_low_priority" model="idea.idea" ref="idea_idea_4"/> + + <record model="idea.idea" id="idea_idea_5"> + <field name="name">Kitten mode enabled by default</field> + <field name="description">As this is the most loved feature, the kitten mode should be enabled by default. And maybe even impossible to remove.</field> + <field name="user_id" eval="ref('base.user_root')"/> + <field name="state">cancel</field> + <field name="category_ids" eval="[(6, 0, [ref('idea.idea_cat_2')])]"/> + </record> + <workflow action="idea_set_low_priority" model="idea.idea" ref="idea_idea_4"/> + + </data> +</openerp> + 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 (<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/>. -# -############################################################################## - -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 @@ -<?xml version="1.0"?> -<openerp> - <data> - - <record model="idea.category" id="idea_category_sales"> - <field name="name">Sales</field> - </record> - <record model="idea.category" id="idea_category_general"> - <field name="name">Organization</field> - </record> - <record model="idea.category" id="idea_category_technical"> - <field name="name">Technical</field> - </record> - - <record id="base.user_demo" model="res.users"> - <field name="groups_id" eval="[(4,ref('base.group_tool_user'))]"/> - </record> - - </data> -</openerp> - 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 @@ -<?xml version="1.0"?> -<openerp> - <data> - <!-- Top menu item --> - <menuitem name="Tools" id="base.menu_tools" sequence="120" groups="base.group_tool_user"/> - <!-- Idea Categories Search View--> - <record model="ir.ui.view" id="view_idea_category_search"> - <field name="name">idea.category.search</field> - <field name="model">idea.category</field> - <field name="arch" type="xml"> - <search string="Ideas Categories"> - <field name="name" string="Category"/> - </search> - </field> - </record> - - <!-- Idea Category Form View --> - <record model="ir.ui.view" id="view_idea_category_form"> - <field name="name">idea.category.form</field> - <field name="model">idea.category</field> - <field name="arch" type="xml"> - <form string="Category of Ideas" version="7.0"> - <group> - <field name="name"/> - </group> - </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> - <field name="field_parent"></field> - <field name="arch" type="xml"> - <tree string="Category of ideas"> - <field name="name"/> - </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> - <field name="search_view_id" ref="view_idea_category_search"/> - </record> - - <menuitem name="Configuration" parent="base.menu_tools" - id="base.menu_lunch_survey_root" sequence="20" /> - - <menuitem name="Ideas" parent="base.menu_lunch_survey_root" id="menu_ideas" sequence="3"/> - - <menuitem name="Categories" parent="menu_ideas" id="menu_idea_category" action="action_idea_category" /> - - -<!-- New Idea Form View --> - - <record model="ir.ui.view" id="view_idea_idea_form"> - <field name="name">idea.idea.form</field> - <field name="model">idea.idea</field> - <field name="arch" type="xml"> - <form string="Idea" version="7.0"> - <header> - <button name="idea_open" string="Open" states="draft" class="oe_highlight"/> - <button name="idea_close" string="Accept" states="open" class="oe_highlight"/> - <button name="idea_cancel" string="Refuse" states="open" class="oe_highlight"/> - <field name="state" widget="statusbar" statusbar_visible="draft,open,close"/> - </header> - <sheet> - <label for="name" class="oe_edit_only"/> - <h1><field name="name"/></h1> - <label for="category_ids" class="oe_edit_only"/> - <field name="category_ids" widget="many2many_tags"/> - <label for="description"/><newline/> - <field name="description"/> - </sheet> - <div class="oe_chatter"> - <field name="message_follower_ids" widget="mail_followers"/> - <field name="message_ids" widget="mail_thread"/> - </div> - </form> - </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> - <field name="arch" type="xml"> - <tree colors="blue:state == 'draft';black:state in ('open','close');gray:state == 'cancel'" string="Ideas"> - <field name="name"/> - <field name="create_uid"/> - <field name="state"/> - </tree> - </field> - </record> - - <!-- Search Idea --> - - <record model="ir.ui.view" id="view_idea_idea_search"> - <field name="name">idea.idea.search</field> - <field name="model">idea.idea</field> - <field name="arch" type="xml"> - <search string="Ideas"> - <field name="name" string="Idea"/> - <filter icon="terp-document-new" string="New" domain="[('state','=', 'draft')]" help="New Ideas"/> - <filter icon="terp-camera_test" string="In Progress" domain="[('state','=', 'open')]" help="Open Ideas"/> - <filter icon="terp-check" string="Accepted" domain="[('state','=','close')]" help="Accepted Ideas" /> - <field name="category_ids"/> - <group expand="0" string="Group By..."> - <filter icon="terp-personal" string="Creator" help="By Creators" context="{'group_by':'create_uid'}"/> - <filter icon="terp-stock_symbol-selection" string="Category" help="By Idea Category" context="{'group_by':'category_ids'}"/> - <filter icon="terp-stock_effects-object-colorize" string="Status" help="By States" context="{'group_by':'state'}"/> - </group> - </search> - </field> - </record> - - <record model="ir.actions.act_window" id="action_idea_idea"> - <field name="name">Ideas</field> - <field name="res_model">idea.idea</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - <field name="search_view_id" ref="view_idea_idea_search"/> - </record> - - <menuitem name="Ideas" parent="menu_ideas" id="menu_idea_idea" action="action_idea_idea" sequence="1"/> - - </data> -</openerp> 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 @@ -<?xml version="1.0"?> -<openerp> - <data> - <record model="workflow" id="wkf_idea"> - <field name="name">idea.wkf</field> - <field name="osv">idea.idea</field> - <field name="on_create">True</field> - </record> - - <record model="workflow.activity" id="act_draft"> - <field name="wkf_id" ref="wkf_idea" /> - <field name="flow_start">True</field> - <field name="name">draft</field> - <field name="kind">function</field> - <field name="action">idea_draft()</field> - </record> - - <record model="workflow.activity" id="act_open"> - <field name="wkf_id" ref="wkf_idea" /> - <field name="name">open</field> - <field name="kind">function</field> - <field name="action">idea_open()</field> - </record> - - <record model="workflow.activity" id="act_close"> - <field name="wkf_id" ref="wkf_idea" /> - <field name="name">close</field> - <field name="kind">function</field> - <field name="action">idea_close()</field> - <field name="flow_stop">True</field> - </record> - - <record model="workflow.activity" id="act_cancel"> - <field name="wkf_id" ref="wkf_idea" /> - <field name="name">cancel</field> - <field name="kind">function</field> - <field name="action">idea_cancel()</field> - <field name="flow_stop">True</field> - </record> - - <record model="workflow.transition" id="t1"> - <field name="act_from" ref="act_draft" /> - <field name="act_to" ref="act_open" /> - <field name="signal">idea_open</field> - </record> - - <record model="workflow.transition" id="t2"> - <field name="act_from" ref="act_open" /> - <field name="act_to" ref="act_close" /> - <field name="signal">idea_close</field> - </record> - - <record model="workflow.transition" id="t4"> - <field name="act_from" ref="act_open" /> - <field name="act_to" ref="act_cancel" /> - <field name="signal">idea_cancel</field> - </record> - - </data> -</openerp> 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. <http://openerp.com> +# +# 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 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. (<http://openerp.com>). +# +# 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/>. +# +############################################################################## + +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 @@ +<?xml version="1.0"?> +<openerp> + <data> + + </data> +</openerp> + 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 @@ -<?xml version="1.0"?> -<openerp> -<data> - - <record model="res.groups" id="base.group_tool_user"> - <field name="name">User</field> - <field name="category_id" ref="base.module_category_tools"/> - </record> - -</data> -</openerp> - 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 Binary files differnew file mode 100644 index 00000000000..1f0cba223bb --- /dev/null +++ b/addons/idea/static/src/img/icon.png 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. <http://openerp.com> +# +# 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/>. +# +############################################################################## + +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. <http://openerp.com> +# +# 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/>. +# +############################################################################## + +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 @@ +<?xml version="1.0"?> +<openerp> + <data> + + <!-- VIEWS DEFINITION + --> + + <record model="ir.ui.view" id="view_idea_category_search"> + <field name="name">idea.category.search</field> + <field name="model">idea.category</field> + <field name="arch" type="xml"> + <search string="Ideas Categories"> + <field name="name" string="Category"/> + </search> + </field> + </record> + + <record model="ir.ui.view" id="view_idea_category_form"> + <field name="name">idea.category.form</field> + <field name="model">idea.category</field> + <field name="arch" type="xml"> + <form string="Category of Ideas" version="7.0"> + <group> + <field name="name"/> + </group> + </form> + </field> + </record> + + <record model="ir.ui.view" id="view_idea_category_tree"> + <field name="name">idea.category.tree</field> + <field name="model">idea.category</field> + <field name="field_parent"></field> + <field name="arch" type="xml"> + <tree string="Category of ideas"> + <field name="name"/> + </tree> + </field> + </record> + + <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> + <field name="search_view_id" ref="view_idea_category_search"/> + </record> + + <!-- MENUS + --> + + <menuitem name="Idea Tags" parent="mail.mail_my_stuff" + id="menu_idea_category" action="action_idea_category" sequence="31"/> + + </data> +</openerp> 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 @@ +<?xml version="1.0"?> +<openerp> + <data> + + <record model="ir.ui.view" id="view_idea_idea_kanban"> + <field name="name">idea.idea.kanban</field> + <field name="model">idea.idea</field> + <field name="arch" type="xml"> + <kanban version="7.0" default_group_by="state" class="oe_background_grey"> + <field name="color"/> + <field name="user_id"/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_card oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_idea_idea oe_kanban_global_click"> + <div class="oe_dropdown_toggle oe_dropdown_kanban" + groups="base.group_user"> + <span class="oe_e">í</span> + <ul class="oe_dropdown_menu"> + <t t-if="widget.view.is_action_enabled('delete')"> + <li><a type="delete">Delete</a></li> + </t> + </ul> + </div> + <div class="oe_kanban_content"> + <h4><field name="name"/></h4> + <div class="oe_kanban_bottom_right"> + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar" t-if="record.user_id.value"/> + </div> + <field name="category_ids"/> + </div> + <div class="oe_clear"></div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <record model="ir.ui.view" id="view_idea_idea_form"> + <field name="name">idea.idea.form</field> + <field name="model">idea.idea</field> + <field name="arch" type="xml"> + <form string="Idea" version="7.0"> + <header> + <button name="idea_set_low_priority" string="Set Low Priority" class="oe_highlight" + attrs="{'invisible': [('priority', '!=', 'normal')]}"/> + <button name="idea_set_normal_priority" string="Set Normal Priority" class="oe_highlight" + attrs="{'invisible': [('priority', 'not in', ['low', 'high'])]}"/> + <button name="idea_set_high_priority" string="Set High Priority" class="oe_highlight" + attrs="{'invisible': [('priority', '!=', 'normal')]}"/> + <field name="state" widget="statusbar" clickable="True"/> + </header> + <sheet> + <label for="name" class="oe_edit_only"/> + <h1><field name="name"/></h1> + <group> + <field name="user_id"/> + <field name="priority" readonly="True"/> + <field name="category_ids" widget="many2many_tags"/> + <field name="description"/> + </group> + </sheet> + </form> + </field> + </record> + + <record model="ir.ui.view" id="view_idea_idea_tree"> + <field name="name">idea.idea.tree</field> + <field name="model">idea.idea</field> + <field name="arch" type="xml"> + <tree colors="blue:state == 'draft';black:state in ('open', 'close'); gray:state == 'cancel'" string="Ideas"> + <field name="name"/> + <field name="user_id"/> + <field name="priority"/> + <field name="state"/> + </tree> + </field> + </record> + + <record model="ir.ui.view" id="view_idea_idea_search"> + <field name="name">idea.idea.search</field> + <field name="model">idea.idea</field> + <field name="arch" type="xml"> + <search string="Ideas"> + <field name="name"/> + <field name="user_id"/> + <field name="category_ids"/> + <filter string="New" domain="[('state', '=', 'draft')]" + help="New Ideas"/> + <filter string="In Progress" domain="[('state','=', 'open')]" + help="Open Ideas"/> + <filter string="Accepted" domain="[('state','=', 'close')]" + help="Accepted Ideas" /> + <group expand="0" string="Group By..."> + <filter string="Creator" help="By Responsible" context="{'group_by': 'user_id'}"/> + <filter string="Category" help="By Category" context="{'group_by': 'category_ids'}"/> + <filter string="Status" help="By State" context="{'group_by': 'state'}"/> + </group> + </search> + </field> + </record> + + <record model="ir.actions.act_window" id="action_idea_idea"> + <field name="name">Ideas</field> + <field name="res_model">idea.idea</field> + <field name="view_type">form</field> + <field name="view_mode">kanban,tree,form</field> + <field name="search_view_id" ref="view_idea_idea_search"/> + </record> + + <!-- MENUS + --> + + <menuitem name="Ideas" parent="mail.mail_my_stuff" + id="menu_idea_idea" action="action_idea_idea" sequence="30"/> + + </data> +</openerp> |
