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

- fix a bug with CategoryBudgetVariation of type movement, it was returning the

  first category when using movement axis, even if this category was not for
  this base_category
- calculate axis only once
- remove wrong XXX


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25663 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent de136f96
......@@ -74,24 +74,21 @@ class CategoryBudgetVariation(BudgetVariation):
def getInventoryQueryDict(self, budget_cell):
""" Query dict to pass to simulation query
"""
if not self.getInventoryAxis():
axis = self.getInventoryAxis()
if not axis:
return dict()
base_category = self.getProperty('variation_base_category')
if not base_category:
return dict()
# XXX pass base_category= ...
for criterion_category in budget_cell.getMembershipCriterionCategoryList():
if '/' not in criterion_category: # safe ...
continue
criterion_base_category, category_url = criterion_category.split('/', 1)
if criterion_base_category == base_category:
# Different possible inventory axis here
axis = self.getInventoryAxis()
if axis == 'movement':
return {'default_%s_uid' % base_category:
self.getPortalObject().portal_categories.getCategoryUid(criterion_category)}
if criterion_base_category == base_category:
return {axis: criterion_category}
return dict()
......
......@@ -99,18 +99,17 @@ class NodeBudgetVariation(BudgetVariation):
def getInventoryQueryDict(self, budget_cell):
""" Query dict to pass to simulation query
"""
if not self.getInventoryAxis():
axis = self.getInventoryAxis()
if not axis:
return dict()
base_category = self.getProperty('variation_base_category')
if not base_category:
return dict()
# TODO: pass base_category_list instead of stupidly iterating !
for criterion_category in budget_cell.getMembershipCriterionCategoryList():
if '/' not in criterion_category: # safe ...
continue
criterion_base_category, node_url = criterion_category.split('/', 1)
if criterion_base_category == base_category:
axis = self.getInventoryAxis()
if axis == 'movement':
axis = 'default_%s' % base_category
axis = '%s_uid' % axis
......
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