summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonin Bourguignon <abo@openerp.com>2012-10-25 15:53:59 +0200
committerAntonin Bourguignon <abo@openerp.com>2012-10-25 15:53:59 +0200
commiteeec8c2f89bbd5849d32eef43daf93090cf01ccb (patch)
tree5d4504f42a9e1049ba78c6e61794a105140fbb9d
parent1ab9b0449383741c5d3c837b8f1091d2a64a32c2 (diff)
[IMP] define a name_get() that includes the complete hierarchy of analytic accounts
also improve code style (var names) bzr revid: abo@openerp.com-20121025135359-1b1xhqznmkx8p07z
-rw-r--r--addons/analytic/analytic.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 11634dc4fb7..3b9bd94ac22 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -96,22 +96,29 @@ class account_analytic_account(osv.osv):
res[row['id']][field] = row[field]
return self._compute_level_tree(cr, uid, ids, child_ids, res, fields, context)
+ def name_get(self, cr, uid, ids, context=None):
+ res = []
+ for id in ids:
+ elmt = self.browse(cr, uid, id, context=context)
+ res.append((id, self._get_one_full_name(elmt)))
+ return res
+
def _get_full_name(self, cr, uid, ids, name=None, args=None, context=None):
if context == None:
context = {}
res = {}
- for m in self.browse(cr, uid, ids, context=context):
- res[m.id] = self._get_one_full_name(m)
+ for elmt in self.browse(cr, uid, ids, context=context):
+ res[elmt.id] = self._get_one_full_name(elmt)
return res
- def _get_one_full_name(self, menu, level=6):
+ def _get_one_full_name(self, elmt, level=6):
if level<=0:
return '...'
- if menu.parent_id:
- parent_path = self._get_one_full_name(menu.parent_id, level-1) + "/"
+ if elmt.parent_id:
+ parent_path = self._get_one_full_name(elmt.parent_id, level-1) + "/"
else:
parent_path = ''
- return parent_path + menu.name
+ return parent_path + elmt.name
def _child_compute(self, cr, uid, ids, name, arg, context=None):
result = {}