diff --git a/product/ERP5/Document/TradeModelSimulationRule.py b/product/ERP5/Document/TradeModelSimulationRule.py index cca3d9b59137219b3517551dc11bd11cc7c6b3af..f17f7a3e43cff048498d1a74c0cdf9f8e935588f 100644 --- a/product/ERP5/Document/TradeModelSimulationRule.py +++ b/product/ERP5/Document/TradeModelSimulationRule.py @@ -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) diff --git a/product/ERP5/PropertySheet/Amount.py b/product/ERP5/PropertySheet/Amount.py index 8c04bc90ea7b2ca051e95820eed7f6fc68a07086..ca3bd20d8024285c9415028f6195dbd6b4739d96 100644 --- a/product/ERP5/PropertySheet/Amount.py +++ b/product/ERP5/PropertySheet/Amount.py @@ -104,7 +104,9 @@ class Amount: ) _categories = ('resource', 'quantity_unit', - 'base_application', 'base_contribution', 'use', 'trade_phase', + 'base_application', 'base_contribution', 'use', 'trade_phase', + # used to link to amount generator line/cells + 'causality', # Acquired categories - 'product_line', ) - + 'product_line', + ) diff --git a/product/ERP5/PropertySheet/Simulation.py b/product/ERP5/PropertySheet/Simulation.py index c2b8832f7736122a7f9d819e322a034d8b9badd4..12205db945dfbd1b25a6fbc7b8674df86d1095ab 100644 --- a/product/ERP5/PropertySheet/Simulation.py +++ b/product/ERP5/PropertySheet/Simulation.py @@ -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 - ) \ No newline at end of file + _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', + ) diff --git a/product/ERP5/mixin/amount_generator.py b/product/ERP5/mixin/amount_generator.py index 76bfd82d6ab5dfcdea10badfc718c679241093b2..eda9096bd976e013a71d29e3f3c6420306969104 100644 --- a/product/ERP5/mixin/amount_generator.py +++ b/product/ERP5/mixin/amount_generator.py @@ -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)