Commit e4767f2f authored by Jérome Perrin's avatar Jérome Perrin

accounting py3

parent 1dee50a7
......@@ -50,9 +50,6 @@ def display(x):
display_cache[x] = display_funct(x)
return display_cache[x]
def sort(x,y):
return cmp(display(x), display(y))
def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,
simulation_state=None):
"""Returns a list of Account path items. """
......@@ -71,7 +68,7 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,
portal_type='Account',
base=0,
display_method=display,
sort_method=sort,
sort_key=display,
filter=filter_dict)
return item_list
......
......@@ -118,7 +118,7 @@ for brain in portal.portal_simulation.getMovementHistoryList(
if by_mirror_section_list_dict:
for row in portal_catalog(
select_list=['title'],
uid=by_mirror_section_list_dict.keys(),
uid=list(by_mirror_section_list_dict.keys()),
):
title = row.title
for line in by_mirror_section_list_dict[row.uid]:
......
import six
from Products.ERP5Type.Message import translateString
from Products.ERP5Form.Report import ReportSection
if six.PY2:
def translate(*args, **kw):
return unicode(translateString(*args, **kw))
else:
def translate(*args, **kw):
return str(translateString(*args, **kw))
request = container.REQUEST
section_category = request['section_category']
section_category_strict = request['section_category_strict']
......@@ -30,16 +38,16 @@ previous_period = 0
for idx, period in enumerate(period_list):
if idx != 0:
previous_period = period_list[idx - 1]
selection_columns.append(('period_%s' % idx, unicode(translateString(
selection_columns.append(('period_%s' % idx, translate(
'Period ${period_number} (from ${from} to ${to} days)',
mapping={'period_number': 1 + idx,
'from': previous_period,
'to': period} ))))
'to': period} )))
editable_columns.append(('period_%s' % idx, ''))
selection_columns.append(('period_%s' % (idx + 1),
unicode(translateString('Older (more than ${day_count} days)',
mapping={'day_count': period_list[-1]}))))
translate('Older (more than ${day_count} days)',
mapping={'day_count': period_list[-1]})))
editable_columns.append(('period_%s' % (idx + 1), ''))
selection_params = dict(section_category=section_category,
......
......@@ -9,6 +9,6 @@ sort_dict = { 'income': 0,
'refundable_vat': -1 }
def getAccountingTransactionLineSortKey(line):
return sort_dict.get(line.getId(), line.getIntIndex() or line.getIntId())
return sort_dict.get(line.getId(), (line.getIntIndex() or line.getIntId() or 0))
return sorted(context.contentValues(portal_type=portal_type, checked_permission="View"), key=getAccountingTransactionLineSortKey)
......@@ -3394,9 +3394,9 @@ class TestAccountingExport(AccountingTestCase):
'40 - Payable',
self.account_module.payable.Account_getFormattedTitle())
# check that this account name can be found in the content
self.assertIn('40 - Payable', content_xml)
self.assertIn(b'40 - Payable', content_xml)
# check that we don't have unknown categories
self.assertNotIn('???', content_xml)
self.assertNotIn(b'???', content_xml)
class TestTransactions(AccountingTestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment