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):
# Weare on a cell
new_id = "%s_%s" % (deliv_mvt.getParentId(), deliv_mvt.getId())
# Generate the simulation deliv_mvt
# XXX Hardcoded value
new_sim_mvt = applied_rule.newContent(
portal_type=movement_type,
id=new_id,
......@@ -123,33 +124,49 @@ class DeliveryRule(Rule):
delivery_value=deliv_mvt,
delivery_ratio=1,
deliverable=1,
source=deliv_mvt.getSource(),
source_section=deliv_mvt.getSourceSection(),
destination=deliv_mvt.getDestination(),
destination_section=deliv_mvt.getDestinationSection(),
quantity=deliv_mvt.getQuantity(),
start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate(),
resource=deliv_mvt.getResource(),
variation_category_list=deliv_mvt.getVariationCategoryList(),
variation_property_dict=deliv_mvt.getVariationPropertyDict(),
start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate())
aggregate_list=deliv_mvt.getAggregateList(),
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:
if sim_mvt not in immutable_movement_list:
# modification allowed
# XXX Hardcoded value
sim_mvt.edit(
delivery_value=deliv_mvt,
delivery_ratio=1,
deliverable=1,
source=deliv_mvt.getSource(),
source_section=deliv_mvt.getSourceSection(),
destination=deliv_mvt.getDestination(),
destination_section=deliv_mvt.getDestinationSection(),
quantity=deliv_mvt.getQuantity(),
start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate(),
resource=deliv_mvt.getResource(),
variation_category_list=deliv_mvt.getVariationCategoryList(),
variation_property_dict=deliv_mvt.getVariationPropertyDict(),
start_date=deliv_mvt.getStartDate(),
stop_date=deliv_mvt.getStopDate(),
aggregate_list=deliv_mvt.getAggregateList(),
quantity=deliv_mvt.getQuantity(),
quantity_unit=deliv_mvt.getQuantityUnit(),
price=deliv_mvt.getPrice(),
price_currency=deliv_mvt.getPriceCurrency(),
force_update=1)
else:
# modification disallowed, must compensate
......
......@@ -135,18 +135,27 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
LOG("InvoiceTransactionRule", PROBLEM,
"expanding %s: without resource" % applied_rule.getPath())
# XXX Harcoded list
prevision_line = {
'id': transaction_line.getId(),
'source': transaction_line.getSource(),
'destination': transaction_line.getDestination(),
'source_section': context_movement.getSourceSection(),
'destination': transaction_line.getDestination(),
'destination_section': context_movement.getDestinationSection(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'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
'quantity': (context_movement.getCorrectedQuantity() *
context_movement.getPrice()) * transaction_line.getQuantity(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
# 'quantity_unit': transaction_line.getQuantityUnit(),
'force_update': 1,
}
prevision_list.append(prevision_line)
......
......@@ -108,21 +108,24 @@ class InvoicingRule(Rule):
if source_section == destination_section or source_section is None \
or destination_section is None:
return []
# XXX Harcoded list
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_section': source_section,
'destination': context_movement.getDestination(),
'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
'deliverable': 1
}
......
......@@ -163,12 +163,25 @@ class OrderRule(DeliveryRule):
property_dict = {}
if default_property_list is None:
LOG("Order Rule , _getPropertiesTo", WARNING,
"Hardcoded properties set")
# XXX Hardcoded value
# LOG("Order Rule , _getPropertiesTo", WARNING,
# "Hardcoded properties set")
default_property_list = (
'source_section', 'destination_section', 'source',
'destination', 'resource', 'variation_category_list',
'aggregate_list', 'start_date', 'stop_date')
'source',
'source_section',
'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:
property_dict[prop] = movement.getProperty(prop)
......
......@@ -72,14 +72,23 @@ class ProductionOrderRule(OrderRule):
property_dict = {}
if default_property_list is None:
LOG("Order Rule , _getExpandablePropertyDict", WARNING,
"Hardcoded properties set")
# XXX Hardcoded value
# LOG("Order Rule , _getExpandablePropertyDict", WARNING,
# "Hardcoded properties set")
default_property_list = (
'destination',
'destination_section',
'destination', 'resource',
'start_date',
'stop_date',
'resource',
'variation_category_list',
'variation_property_dict',
'aggregate_list',
'start_date', 'stop_date')
'price',
'price_currency',
'quantity',
'quantity_unit',
)
supply_chain = self.getSupplyChain(applied_rule)
# 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