summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2012-07-13 16:40:30 +0200
committerFabien Pinckaers <fp@tinyerp.com>2012-07-13 16:40:30 +0200
commitf004544c4b80bd40fc102090d03e084e7b1dbf0e (patch)
tree7d27b9f1653af195694231842dedf50449abe7ff /addons
parent08d2eb4828398b2deae80bb7d7bcd7436db1bb57 (diff)
[FIX] account: clean account.move.line tree view generation + ensure "state" is always shown
bzr revid: chs@openerp.com-20120713144030-nmmkmw6mh7emex1r
Diffstat (limited to 'addons')
-rw-r--r--addons/account/account_move_line.py43
1 files changed, 18 insertions, 25 deletions
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 95b53b51339..57cc125bb5b 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -19,6 +19,7 @@
#
##############################################################################
+import sys
import time
from datetime import datetime
from operator import itemgetter
@@ -985,37 +986,32 @@ class account_move_line(osv.osv):
if context.get('view_mode', False):
return result
fld = []
- fields = {}
flds = []
- title = _("Accounting Entries") #self.view_header_get(cr, uid, view_id, view_type, context)
+ title = _("Accounting Entries") # self.view_header_get(cr, uid, view_id, view_type, context)
- ids = journal_pool.search(cr, uid, [])
+ ids = journal_pool.search(cr, uid, [], context=context)
journals = journal_pool.browse(cr, uid, ids, context=context)
- all_journal = [None]
- common_fields = {}
- total = len(journals)
for journal in journals:
- all_journal.append(journal.id)
for field in journal.view_id.columns_id:
- # sometimes, it's possible that a defined column is not loaded (the module containing
+ # sometimes, it's possible that a defined column is not loaded (the module containing
# this field is not loaded) when we make an update.
- if field.name not in self._columns:
+ if field.field not in self._columns:
continue
- if not field.field in fields:
- fields[field.field] = [journal.id]
+ if not field.field in flds:
fld.append((field.field, field.sequence))
flds.append(field.field)
- common_fields[field.field] = 1
- else:
- fields.get(field.field).append(journal.id)
- common_fields[field.field] = common_fields[field.field] + 1
- fld.append(('period_id', 3))
- fld.append(('journal_id', 10))
- flds.append('period_id')
- flds.append('journal_id')
- fields['period_id'] = all_journal
- fields['journal_id'] = all_journal
+
+ default_columns = {
+ 'period_id': 3,
+ 'journal_id': 10,
+ 'state': sys.maxint,
+ }
+ for d in default_columns:
+ if d not in flds:
+ fld.append((d, default_columns[d]))
+ flds.append(d)
+
fld = sorted(fld, key=itemgetter(1))
widths = {
'statement_id': 50,
@@ -1029,10 +1025,7 @@ class account_move_line(osv.osv):
colors="red:state=='draft';black:state=='valid'")
fields_get = self.fields_get(cr, uid, flds, context)
for field, _seq in fld:
- if common_fields.get(field) == total:
- fields.get(field).append(None)
- # if field=='state':
- # state = 'colors="red:state==\'draft\'"'
+ # TODO add string to element
f = etree.SubElement(document, 'field', name=field)
if field == 'debit':