openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #05496
[Merge] lp:~openerp-dev/openobject-addons/trunk-bugfixes-idea-vro into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind
Valencia Rodrigues (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bugfixes-idea-vro into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bugfixes-idea-vro/+merge/57675
Contains two bug fixes for idea module:
1. Idea parent category bug.
2. Idea module typos.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bugfixes-idea-vro/+merge/57675
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-bugfixes-idea-vro into lp:~openerp-dev/openobject-addons/trunk-bugfixes-Ind.
=== modified file 'idea/idea.py'
--- idea/idea.py 2011-01-14 00:11:01 +0000
+++ idea/idea.py 2011-04-14 13:21:05 +0000
@@ -31,11 +31,28 @@
class idea_category(osv.osv):
""" Category of Idea """
+ def name_get(self, cr, uid, ids, context=None):
+ if not len(ids):
+ return []
+ reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
+ res = []
+ for record in reads:
+ name = record['name']
+ if record['parent_id']:
+ name = record['parent_id'][1]+' / '+name
+ res.append((record['id'], name))
+ return res
+
+ def _categ_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
+ res = self.name_get(cr, uid, ids, context=context)
+ return dict(res)
+
_name = "idea.category"
_description = "Idea Category"
_columns = {
'name': fields.char('Category', size=64, required=True),
+ 'complete_name': fields.function(_categ_name_get_fnc, method=True, type="char", string='Name'),
'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'),
@@ -46,6 +63,10 @@
]
_order = 'parent_id,name asc'
+ _constraints = [
+ (osv.osv._check_recursion, 'Error ! You can not create recursive categories.', ['parent_id'])
+ ]
+
idea_category()
class idea_idea(osv.osv):
=== modified file 'idea/idea_view.xml'
--- idea/idea_view.xml 2011-01-14 00:11:01 +0000
+++ idea/idea_view.xml 2011-04-14 13:21:05 +0000
@@ -46,7 +46,7 @@
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<tree string="Category of ideas">
- <field name="name"/>
+ <field name="complete_name"/>
<field name="parent_id" invisible="1"/>
</tree>
</field>
@@ -234,11 +234,11 @@
<field name="count_votes" />
</group>
<field name="stat_vote_ids" colspan="4" mode="graph,tree" nolabel="1">
- <graph string="Vots Statistics" type="bar">
+ <graph string="Votes Statistics" type="bar">
<field name="score"/>
<field name="nbr"/>
</graph>
- <tree string="Vots Statistics">
+ <tree string="Votes Statistics">
<field name="score"/>
<field name="nbr"/>
</tree>
Follow ups