Commit e286928a authored by Julien Muchembled's avatar Julien Muchembled

Add 'causality' category to Amount

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37928 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 426eb295
......@@ -104,13 +104,13 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
amount_generator_type_list=('Purchase Trade Condition',
'Sale Trade Condition',
'Trade Model Line')):
# FIXME: Is it the right way to have source/destination and other
# non-Amount properties set on the generated movement ?
movement = input_movement.asContext(**dict((k, v)
for k, v in amount.__dict__.iteritems()
if k[0] != '_' and k != 'categories'))
base_category_set = set(amount.getBaseCategoryList())
base_category_set.remove('price_currency') # XXX
# XXX 'causality' category should be added to Amount
base_category_set.add('causality')
movement._setCategoryMembership(base_category_set,
amount.getCategoryList(),
base=True)
......
......@@ -105,6 +105,8 @@ class Amount:
_categories = ('resource', 'quantity_unit',
'base_application', 'base_contribution', 'use', 'trade_phase',
# used to link to amount generator line/cells
'causality',
# Acquired categories
'product_line', )
'product_line',
)
......@@ -69,8 +69,11 @@ class Simulation:
'mode' : 'w' },
)
_categories = ('order', 'delivery', 'delivery_mode', 'incoterm', 'payment_mode', 'solver',
'specialise',
'property_mapping', # XXX-JPS I doubt that this is really required (here)
'causality' # this is required really
_categories = ('order', 'delivery', 'delivery_mode', 'incoterm',
'payment_mode', 'solver', 'specialise',
# XXX-JPS I doubt that this is really required (here)
'property_mapping',
# used to link to Business Links and Trade Model Paths
# (but this is redundant with Amount property sheet)
'causality',
)
......@@ -249,7 +249,6 @@ class AmountGeneratorMixin:
# base_contribution_list MUST be defined
property_dict['base_contribution_list'] = base_contribution_list
for property_dict in resource_amount_aggregate.itervalues():
causality_value_list = property_dict.pop('causality_value_list')
base_application_set = property_dict['base_application_set']
# property_dict should include
# resource - VAT service or a Component in MRP
......@@ -281,7 +280,8 @@ class AmountGeneratorMixin:
# XXX-JPS Could we use a movement for safety ?
amount = newTempAmount(portal,
# we only want the id to be unique
causality_value_list[0].getRelativeUrl().replace('/', '_'))
property_dict['causality_value_list'][0]
.getRelativeUrl().replace('/', '_'))
amount._setCategoryList(property_dict.pop('category_list', ()))
amount._edit(
# XXX If they are several cells, we may have duplicate references.
......@@ -291,7 +291,6 @@ class AmountGeneratorMixin:
int_index=self.getIntIndex(),
description=self.getDescription(),
**property_dict)
amount._setValueList('causality', causality_value_list)
if rounding:
# We hope here that rounding is sufficient at line level
amount = getRoundingProxy(amount, context=self)
......
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