Commit aebfc1de authored by Sebastien Robin's avatar Sebastien Robin

use target source and destination


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1802 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 16be777a
...@@ -198,6 +198,9 @@ An ERP5 Rule...""" ...@@ -198,6 +198,9 @@ An ERP5 Rule..."""
# Find production node # Find production node
my_context_movement = applied_rule.getParent() my_context_movement = applied_rule.getParent()
production_node = my_context_movement.getSource() production_node = my_context_movement.getSource()
LOG('TransformationRule.expand my_context_movement.getPhysicalPath()',0,my_context_movement.getPhysicalPath())
LOG('TransformationRule.expand my_context_movement.getSource()',0,my_context_movement.getSource())
LOG('TransformationRule.expand my_context_movement.getTargetSource()',0,my_context_movement.getTargetSource())
production_section = my_context_movement.getSourceSection() production_section = my_context_movement.getSourceSection()
# Generate production and consumption lines # Generate production and consumption lines
my_quantity = my_context_movement.getTargetQuantity() my_quantity = my_context_movement.getTargetQuantity()
...@@ -233,11 +236,11 @@ An ERP5 Rule...""" ...@@ -233,11 +236,11 @@ An ERP5 Rule..."""
target_stop_date = my_context_movement.getTargetStartDate(), target_stop_date = my_context_movement.getTargetStartDate(),
resource = my_context_movement.getResource(), resource = my_context_movement.getResource(),
target_quantity = my_context_movement.getTargetQuantity() + lost_quantity, target_quantity = my_context_movement.getTargetQuantity() + lost_quantity,
source_list = (), target_source_list = (),
source_section_list = (), target_source_section_list = (),
quantity_unit = my_context_movement.getQuantityUnit(), quantity_unit = my_context_movement.getQuantityUnit(),
destination_section = production_section, target_destination_section = production_section,
destination = production_node, target_destination = production_node,
deliverable = 1 deliverable = 1
) )
# Mising quantity unit conversion for my_quantity !!!! XXXX # Mising quantity unit conversion for my_quantity !!!! XXXX
...@@ -273,11 +276,14 @@ An ERP5 Rule...""" ...@@ -273,11 +276,14 @@ An ERP5 Rule..."""
target_efficiency = amount_line['efficiency'], target_efficiency = amount_line['efficiency'],
resource_value = amount_line['resource'], resource_value = amount_line['resource'],
quantity_unit = amount_line['quantity_unit'], quantity_unit = amount_line['quantity_unit'],
source = production_node, target_source = production_node,
source_section = production_section, target_source_section = production_section,
destination_list = (), target_destination_list = (),
deliverable = 1 deliverable = 1
) )
LOG('TransformationRule.expand transformed_resource.getPhysicalPath()',0,transformed_resource.getPhysicalPath())
LOG('TransformationRule.expand transformed_resource.getTargetSource()',0,transformed_resource.getTargetSource())
LOG('TransformationRule.expand transformed_resource.getSource()',0,transformed_resource.getSource())
#LOG('RESOURCE', 0, str(amount_line['resource'].getRelativeUrl())) #LOG('RESOURCE', 0, str(amount_line['resource'].getRelativeUrl()))
#LOG('VC List', 0, str(amount_line['variation_category_list'])) #LOG('VC List', 0, str(amount_line['variation_category_list']))
#LOG('Quantity', 0, str(amount_line['quantity'])) #LOG('Quantity', 0, str(amount_line['quantity']))
...@@ -291,6 +297,10 @@ An ERP5 Rule...""" ...@@ -291,6 +297,10 @@ An ERP5 Rule..."""
category_list += [category] category_list += [category]
transformed_resource.setVariationCategoryList(category_list) transformed_resource.setVariationCategoryList(category_list)
acceptable_id_list += [new_id] acceptable_id_list += [new_id]
LOG('TransformationRule.expand transformed_resource.getPhysicalPath()',0,transformed_resource.getPhysicalPath())
LOG('TransformationRule.expand transformed_resource.getTargetSource()',0,transformed_resource.getTargetSource())
LOG('TransformationRule.expand transformed_resource.getSource()',0,transformed_resource.getSource())
LOG('TransformationRule.expand transformed_resource.showDict()',0,transformed_resource.showDict())
line_number += 1 line_number += 1
# Remove each movement not in the transformation # Remove each movement not in the transformation
...@@ -298,6 +308,11 @@ An ERP5 Rule...""" ...@@ -298,6 +308,11 @@ An ERP5 Rule..."""
if movement.getId() not in acceptable_id_list: if movement.getId() not in acceptable_id_list:
movement.flushActivity(invoke=0) movement.flushActivity(invoke=0)
applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery
LOG('TransformationRule.expand movement.getPhysicalPath()',0,movement.getPhysicalPath())
LOG('TransformationRule.expand movement.getTargetSource()',0,movement.getTargetSource())
LOG('TransformationRule.expand movement.getSource()',0,movement.getSource())
LOG('TransformationRule.expand movement.getTargetSource',0,movement.getTargetSource)
LOG('TransformationRule.expand movement.showDict()',0,movement.showDict())
# Pass to base class # Pass to base class
Rule.expand(self, applied_rule, **kw) Rule.expand(self, applied_rule, **kw)
......
...@@ -166,6 +166,11 @@ An ERP5 Rule...""" ...@@ -166,6 +166,11 @@ An ERP5 Rule..."""
# Source that movement from the next node / stock # Source that movement from the next node / stock
my_context_movement = applied_rule.getParent() my_context_movement = applied_rule.getParent()
LOG('TransformationSourcingRule.expand, my_context_movement.getPhysicalPath()',0,my_context_movement.getPhysicalPath())
LOG('TransformationSourcingRule.expand, my_context_movement.getSource()',0,my_context_movement.getSource())
LOG('TransformationSourcingRule.expand, my_context_movement.getTargetSource()',0,my_context_movement.getTargetSource())
LOG('TransformationSourcingRule.expand, my_context_movement.showDict()',0,my_context_movement.showDict())
LOG('TransformationSourcingRule.expand, my_context_movement.getTargetSource',0,my_context_movement.getTargetSource)
if my_context_movement.getSource() is not None: if my_context_movement.getSource() is not None:
# We should only expand movements if they have a source # We should only expand movements if they have a source
# otherwise, it creates infinite recursion # otherwise, it creates infinite recursion
...@@ -191,11 +196,11 @@ An ERP5 Rule...""" ...@@ -191,11 +196,11 @@ An ERP5 Rule..."""
resource = resource, resource = resource,
target_start_date = my_context_movement.getTargetStartDate(), target_start_date = my_context_movement.getTargetStartDate(),
target_stop_date = my_context_movement.getTargetStartDate(), target_stop_date = my_context_movement.getTargetStartDate(),
source_list = (), target_source_list = (),
source_section_list = (), target_source_section_list = (),
quantity_unit = my_context_movement.getQuantityUnit(), quantity_unit = my_context_movement.getQuantityUnit(),
destination = my_context_movement.getSource(), target_destination = my_context_movement.getTargetSource(),
destination_section = my_context_movement.getSourceSection(), target_destination_section = my_context_movement.getTargetSourceSection(),
deliverable = 0 # We do not need to source explicitely operations deliverable = 0 # We do not need to source explicitely operations
) )
transformation_source.setVariationCategoryList( transformation_source.setVariationCategoryList(
...@@ -208,11 +213,11 @@ An ERP5 Rule...""" ...@@ -208,11 +213,11 @@ An ERP5 Rule..."""
resource = resource, resource = resource,
target_start_date = my_context_movement.getTargetStartDate(), target_start_date = my_context_movement.getTargetStartDate(),
target_stop_date = my_context_movement.getTargetStartDate(), target_stop_date = my_context_movement.getTargetStartDate(),
source = 'site/Stock_MP/Gravelines', target_source = 'site/Stock_MP/Gravelines',
source_section = 'group/Coramy', target_source_section = 'group/Coramy',
quantity_unit = my_context_movement.getQuantityUnit(), quantity_unit = my_context_movement.getQuantityUnit(),
destination = my_context_movement.getSource(), target_destination = my_context_movement.getTargetSource(),
destination_section = my_context_movement.getSourceSection(), target_destination_section = my_context_movement.getTargetSourceSection(),
deliverable = 1, deliverable = 1,
) )
transformation_source.setVariationCategoryList( transformation_source.setVariationCategoryList(
......
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