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

budget: py3

parent 305d07cf
...@@ -207,7 +207,7 @@ class CategoryBudgetVariation(BudgetVariation): ...@@ -207,7 +207,7 @@ class CategoryBudgetVariation(BudgetVariation):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getBudgetVariationRangeCategoryList') 'getBudgetVariationRangeCategoryList')
def getBudgetVariationRangeCategoryList(self, context): def getBudgetVariationRangeCategoryList(self, budget):
"""Returns the Variation Range Category List that can be applied to this """Returns the Variation Range Category List that can be applied to this
budget. budget.
""" """
......
editable_property_list = zip(*context.BudgetLine_getEditablePropertyList())[0] editable_property_list = list(zip(*context.BudgetLine_getEditablePropertyList()))[0]
if 'destination_credit' in editable_property_list: if 'destination_credit' in editable_property_list:
return -1 return -1
......
import six
from pprint import pformat from pprint import pformat
portal = context.getPortalObject() portal = context.getPortalObject()
request= portal.REQUEST request= portal.REQUEST
...@@ -89,7 +90,7 @@ for budget in budget_list: ...@@ -89,7 +90,7 @@ for budget in budget_list:
conversion_ratio = 1 conversion_ratio = 1
line_list.append(dict(is_budget=True, line_list.append(dict(is_budget=True,
title=budget.getTitle().decode('utf8'), title=six.text_type(budget.getTitle()),
target_currency_title=target_currency_title, target_currency_title=target_currency_title,
conversion_ratio=conversion_ratio, conversion_ratio=conversion_ratio,
resource_title=budget.getResource() and resource_title=budget.getResource() and
...@@ -149,9 +150,9 @@ for budget in budget_list: ...@@ -149,9 +150,9 @@ for budget in budget_list:
# we use BudgetLine_asCellRange to get cell names, and have a default value # we use BudgetLine_asCellRange to get cell names, and have a default value
# for "virtual level 2" # for "virtual level 2"
title = budget_line.getTitle().decode('utf8') title = six.text_type(budget_line.getTitle())
cell_name_dict = {budget_line.getResource(base=1): cell_name_dict = {budget_line.getResource(base=1):
budget_line.getTitle().decode('utf8')} six.text_type(budget_line.getTitle())}
cell_style_dict = {budget_line.getResource(base=1): 'Level2'} cell_style_dict = {budget_line.getResource(base=1): 'Level2'}
cell_depth_dict = {budget_line.getResource(base=1): 0} cell_depth_dict = {budget_line.getResource(base=1): 0}
...@@ -168,7 +169,7 @@ for budget in budget_list: ...@@ -168,7 +169,7 @@ for budget in budget_list:
for cell_range_list in budget_line_as_cell_range_matrixbox: for cell_range_list in budget_line_as_cell_range_matrixbox:
for category, title in cell_range_list: for category, title in cell_range_list:
cell_name_dict[category] = title.decode('utf8').replace(u'\xA0', '') cell_name_dict[category] = six.text_type(title).replace(u'\xA0', '')
if category in level_2_variation_category_list: if category in level_2_variation_category_list:
depth = -min_depth + (title.count('\xA0') / 4) or title.count('/') depth = -min_depth + (title.count('\xA0') / 4) or title.count('/')
cell_depth_dict[category] = depth cell_depth_dict[category] = depth
...@@ -323,7 +324,7 @@ for budget in budget_list: ...@@ -323,7 +324,7 @@ for budget in budget_list:
if total_level_1_current_budget: if total_level_1_current_budget:
consumed_ratio = total_level_1_consumed_budget / total_level_1_current_budget consumed_ratio = total_level_1_consumed_budget / total_level_1_current_budget
line_list.append(dict(is_level_1=True, line_list.append(dict(is_level_1=True,
title=budget_line.getTitle().decode('utf8'), title=six.text_type(budget_line.getTitle()),
initial_budget=total_level_1_initial_budget, initial_budget=total_level_1_initial_budget,
current_budget=total_level_1_current_budget, current_budget=total_level_1_current_budget,
engaged_budget=total_level_1_engaged_budget, engaged_budget=total_level_1_engaged_budget,
......
...@@ -1190,23 +1190,6 @@ class TestBudget(ERP5TypeTestCase): ...@@ -1190,23 +1190,6 @@ class TestBudget(ERP5TypeTestCase):
self.assertEqual(default_cell_range, self.assertEqual(default_cell_range,
budget_line.BudgetLine_asCellRange('available')) budget_line.BudgetLine_asCellRange('available'))
if 0 :self.assertEqual(
dict(from_date=DateTime(2000, 1, 1),
at_date=DateTime(2000, 12, 31).latestTime(),
#node_category_strict_membership=['account_type/expense',
# 'account_type/asset'],
node_category_strict_membership='account_type',
section_category_strict_membership=['group/demo_group/sub1'],
group_by_node_category_strict_membership=True,
group_by_node=True,
node_uid=[self.portal.account_module.goods_purchase.getUid(),
self.portal.account_module.fixed_assets.getUid()],
group_by_section_category_strict_membership=True,
),
budget_model.getInventoryListQueryDict(budget_line))
atransaction = self.portal.accounting_module.newContent( atransaction = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
resource_value=self.portal.currency_module.euro, resource_value=self.portal.currency_module.euro,
......
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