Commit df49fe3c authored by Romain Courteaud's avatar Romain Courteaud

Copy attributes and categories on SimulationMovement when expanding.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12049 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 933938c9
...@@ -115,6 +115,7 @@ class DeliveryRule(Rule): ...@@ -115,6 +115,7 @@ class DeliveryRule(Rule):
# Weare on a cell # Weare on a cell
new_id = "%s_%s" % (deliv_mvt.getParentId(), deliv_mvt.getId()) new_id = "%s_%s" % (deliv_mvt.getParentId(), deliv_mvt.getId())
# Generate the simulation deliv_mvt # Generate the simulation deliv_mvt
# XXX Hardcoded value
new_sim_mvt = applied_rule.newContent( new_sim_mvt = applied_rule.newContent(
portal_type=movement_type, portal_type=movement_type,
id=new_id, id=new_id,
...@@ -123,33 +124,49 @@ class DeliveryRule(Rule): ...@@ -123,33 +124,49 @@ class DeliveryRule(Rule):
delivery_value=deliv_mvt, delivery_value=deliv_mvt,
delivery_ratio=1, delivery_ratio=1,
deliverable=1, deliverable=1,
source=deliv_mvt.getSource(), source=deliv_mvt.getSource(),
source_section=deliv_mvt.getSourceSection(), source_section=deliv_mvt.getSourceSection(),
destination=deliv_mvt.getDestination(), destination=deliv_mvt.getDestination(),
destination_section=deliv_mvt.getDestinationSection(), destination_section=deliv_mvt.getDestinationSection(),
quantity=deliv_mvt.getQuantity(), start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate(),
resource=deliv_mvt.getResource(), resource=deliv_mvt.getResource(),
variation_category_list=deliv_mvt.getVariationCategoryList(), variation_category_list=deliv_mvt.getVariationCategoryList(),
variation_property_dict=deliv_mvt.getVariationPropertyDict(), variation_property_dict=deliv_mvt.getVariationPropertyDict(),
start_date=deliv_mvt.getStartDate(), aggregate_list=deliv_mvt.getAggregateList(),
stop_date=deliv_mvt.getStopDate())
quantity=deliv_mvt.getQuantity(),
quantity_unit=deliv_mvt.getQuantityUnit(),
price=deliv_mvt.getPrice(),
price_currency=deliv_mvt.getPriceCurrency(),
)
elif sim_mvt in existing_movement_list: elif sim_mvt in existing_movement_list:
if sim_mvt not in immutable_movement_list: if sim_mvt not in immutable_movement_list:
# modification allowed # modification allowed
# XXX Hardcoded value
sim_mvt.edit( sim_mvt.edit(
delivery_value=deliv_mvt, delivery_value=deliv_mvt,
delivery_ratio=1, delivery_ratio=1,
deliverable=1, deliverable=1,
source=deliv_mvt.getSource(), source=deliv_mvt.getSource(),
source_section=deliv_mvt.getSourceSection(), source_section=deliv_mvt.getSourceSection(),
destination=deliv_mvt.getDestination(), destination=deliv_mvt.getDestination(),
destination_section=deliv_mvt.getDestinationSection(), destination_section=deliv_mvt.getDestinationSection(),
quantity=deliv_mvt.getQuantity(), start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate(),
resource=deliv_mvt.getResource(), resource=deliv_mvt.getResource(),
variation_category_list=deliv_mvt.getVariationCategoryList(), variation_category_list=deliv_mvt.getVariationCategoryList(),
variation_property_dict=deliv_mvt.getVariationPropertyDict(), variation_property_dict=deliv_mvt.getVariationPropertyDict(),
start_date=deliv_mvt.getStartDate(), aggregate_list=deliv_mvt.getAggregateList(),
stop_date=deliv_mvt.getStopDate(),
quantity=deliv_mvt.getQuantity(),
quantity_unit=deliv_mvt.getQuantityUnit(),
price=deliv_mvt.getPrice(),
price_currency=deliv_mvt.getPriceCurrency(),
force_update=1) force_update=1)
else: else:
# modification disallowed, must compensate # modification disallowed, must compensate
......
...@@ -135,18 +135,27 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -135,18 +135,27 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
LOG("InvoiceTransactionRule", PROBLEM, LOG("InvoiceTransactionRule", PROBLEM,
"expanding %s: without resource" % applied_rule.getPath()) "expanding %s: without resource" % applied_rule.getPath())
# XXX Harcoded list
prevision_line = { prevision_line = {
'id': transaction_line.getId(), 'id': transaction_line.getId(),
'source': transaction_line.getSource(), 'source': transaction_line.getSource(),
'destination': transaction_line.getDestination(),
'source_section': context_movement.getSourceSection(), 'source_section': context_movement.getSourceSection(),
'destination': transaction_line.getDestination(),
'destination_section': context_movement.getDestinationSection(), 'destination_section': context_movement.getDestinationSection(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'resource': resource, 'resource': resource,
# 'variation_category_list': \
# transaction_line.getVariationCategoryList(),
# 'variation_property_dict': \
# transaction_line.getVariationPropertyDict(),
# 'aggregate_list': transaction_line.getAggregateList(),
# 'price': transaction_line.getPrice(),
# 'price_currency': transaction_line.getPriceCurrency(),
# calculate (quantity * price) * cell_quantity # calculate (quantity * price) * cell_quantity
'quantity': (context_movement.getCorrectedQuantity() * 'quantity': (context_movement.getCorrectedQuantity() *
context_movement.getPrice()) * transaction_line.getQuantity(), context_movement.getPrice()) * transaction_line.getQuantity(),
'start_date': context_movement.getStartDate(), # 'quantity_unit': transaction_line.getQuantityUnit(),
'stop_date': context_movement.getStopDate(),
'force_update': 1, 'force_update': 1,
} }
prevision_list.append(prevision_line) prevision_list.append(prevision_line)
......
...@@ -109,20 +109,23 @@ class InvoicingRule(Rule): ...@@ -109,20 +109,23 @@ class InvoicingRule(Rule):
or destination_section is None: or destination_section is None:
return [] return []
# XXX Harcoded list
invoice_line = { invoice_line = {
'price': context_movement.getPrice(),
'quantity': context_movement.getCorrectedQuantity(),
'quantity_unit': context_movement.getQuantityUnit(),
'efficiency': context_movement.getEfficiency(),
'resource': context_movement.getResource(),
'variation_category_list': context_movement.getVariationCategoryList(),
'variation_property_dict': context_movement.getVariationPropertyDict(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'source': context_movement.getSource(), 'source': context_movement.getSource(),
'source_section': source_section, 'source_section': source_section,
'destination': context_movement.getDestination(), 'destination': context_movement.getDestination(),
'destination_section': destination_section, 'destination_section': destination_section,
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'resource': context_movement.getResource(),
'variation_category_list': context_movement.getVariationCategoryList(),
'variation_property_dict': context_movement.getVariationPropertyDict(),
'aggregate_list': context_movement.getAggregateList(),
'quantity': context_movement.getCorrectedQuantity(),
'quantity_unit': context_movement.getQuantityUnit(),
'price': context_movement.getPrice(),
'price_currency': context_movement.getPriceCurrency(),
'efficiency': context_movement.getEfficiency(),
# We do need to collect invoice lines to build invoices # We do need to collect invoice lines to build invoices
'deliverable': 1 'deliverable': 1
} }
......
...@@ -163,12 +163,25 @@ class OrderRule(DeliveryRule): ...@@ -163,12 +163,25 @@ class OrderRule(DeliveryRule):
property_dict = {} property_dict = {}
if default_property_list is None: if default_property_list is None:
LOG("Order Rule , _getPropertiesTo", WARNING, # XXX Hardcoded value
"Hardcoded properties set") # LOG("Order Rule , _getPropertiesTo", WARNING,
# "Hardcoded properties set")
default_property_list = ( default_property_list = (
'source_section', 'destination_section', 'source', 'source',
'destination', 'resource', 'variation_category_list', 'source_section',
'aggregate_list', 'start_date', 'stop_date') 'destination',
'destination_section',
'start_date',
'stop_date',
'resource',
'variation_category_list',
'variation_property_dict',
'aggregate_list',
'price',
'price_currency',
'quantity',
'quantity_unit',
)
for prop in default_property_list: for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop) property_dict[prop] = movement.getProperty(prop)
......
...@@ -72,14 +72,23 @@ class ProductionOrderRule(OrderRule): ...@@ -72,14 +72,23 @@ class ProductionOrderRule(OrderRule):
property_dict = {} property_dict = {}
if default_property_list is None: if default_property_list is None:
LOG("Order Rule , _getExpandablePropertyDict", WARNING, # XXX Hardcoded value
"Hardcoded properties set") # LOG("Order Rule , _getExpandablePropertyDict", WARNING,
# "Hardcoded properties set")
default_property_list = ( default_property_list = (
'destination',
'destination_section', 'destination_section',
'destination', 'resource', 'start_date',
'stop_date',
'resource',
'variation_category_list', 'variation_category_list',
'variation_property_dict',
'aggregate_list', 'aggregate_list',
'start_date', 'stop_date') 'price',
'price_currency',
'quantity',
'quantity_unit',
)
supply_chain = self.getSupplyChain(applied_rule) supply_chain = self.getSupplyChain(applied_rule)
# We got a supply chain # We got a supply chain
......
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