Commit 330ef75f authored by Jean-Paul Smets's avatar Jean-Paul Smets

Global Udate to Latest Coramy Optimizations (force in rules)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@529 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a51dbd2c
......@@ -903,6 +903,21 @@ class CategoryTool( UniqueObject, Folder, Base ):
return 1
return 0
security.declareProtected( Permissions.AccessContentsInformation, 'isAcquiredMemberOf' )
def isAcquiredMemberOf(self, context, category):
"""
Tests if an object if member of a given category
Category is a string here. It could be more than a string (ex. an object)
XXX Should include acquisition ?
"""
if getattr(aq_base(context), 'isCategory', 0):
return context.isAcquiredMemberOf(category)
for c in self._getAcquiredCategoryList(context):
if c.find(category) >= 0:
return 1
return 0
security.declareProtected( Permissions.AccessContentsInformation, 'getCategoryList' )
def getCategoryList(self, context):
self._cleanupCategories(context)
......
......@@ -178,3 +178,4 @@ un modele..."""
#pass
self.modele_compute_pri(batch_mode=1)
......@@ -217,60 +217,60 @@
<title>Right</title>
<fields>
<field><id>my_organisation_title</id> <type>RelationStringField</type>
<field><id>my_default_email_text</id> <type>EmailField</type>
<values>
<alternate_name></alternate_name>
<base_category>subordination</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<display_width type="int">30</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation')]</portal_type>
<required type="int">0</required>
<title>Organisation</title>
<title>Email</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
<default>here/getDefaultEmailText</default>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
<message name="not_email">You did not enter an email address.</message>
</messages>
</field>
<field><id>my_default_email_text</id> <type>EmailField</type>
<field><id>my_organisation_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>subordination</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">30</display_width>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation')]</portal_type>
<required type="int">0</required>
<title>Email</title>
<title>Organisation</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
<default>here/getDefaultEmailText</default>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
<message name="not_email">You did not enter an email address.</message>
</messages>
</field>
<field><id>my_default_telephone_text</id> <type>StringField</type>
......
......@@ -76,4 +76,10 @@ if fix:
for delivery in delivery_list:
print " New delivery %s for causality %s" % (delivery.getRelativeUrl(), ' '.join(delivery.getCausalityList()))
# Invoke delivery rule
if len(requires_delivery_rule) > 0:
if fix:
context.updateAppliedRule()
print "Building new delivery rule"
return printed
......@@ -26,4 +26,6 @@ elif local_user in equipe2 :
elif local_user in equipe3 :
object.AssignLocalRole(user_list=equipe3,role_list=['GestionaireDesigne',])
else :
if user_name == "AnimatriceAppros" :
local_user = 'Michele_Kmiecik'
object.AssignLocalRole(user_list=[local_user,],role_list=['GestionaireDesigne',])
......@@ -68,8 +68,8 @@ AND resource_membership.category_uid = resource_c.uid
AND resource_membership.base_category_uid = resource_bc.uid
AND resource_membership.uid = resource.uid
</dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement"
</dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0
</dtml-if><dtml-if omit_input>AND stock.quantity < 0 AND movement.source_uid <> movement.destination_uid
</dtml-if><dtml-if omit_output>AND stock.quantity > 0 AND movement.source_uid <> movement.destination_uid
</dtml-if><dtml-if simulation_state>AND (<dtml-in simulation_state> catalog.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if query>AND category.uid = node.uid
AND <dtml-var query></dtml-if>
\ No newline at end of file
......@@ -67,8 +67,8 @@ AND movement.resource_uid = resource.uid
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if "variation_text is not None">AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement"
</dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0
</dtml-if><dtml-if omit_input>AND stock.quantity < 0 AND movement.source_uid <> movement.destination_uid
</dtml-if><dtml-if omit_output>AND stock.quantity > 0 AND movement.source_uid <> movement.destination_uid
</dtml-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string">
AND node_membership.category_uid = node_c.uid
AND node_membership.base_category_uid = node_bc.uid
......
......@@ -4,7 +4,7 @@
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=import_file, segmentation_strategique='2003-2004', incoterm='DAF',delivery_mode='Transporteur', order_type='Approvisionnement', travel_duration=0, batch_mode=0,**kw
##parameters=import_file, segmentation_strategique='2003-2004', incoterm='DAF',delivery_mode='Transporteur', order_type='Approvisionnement', travel_duration=0, batch_mode=0,user_name='',**kw
##title=
##
# import d'un fichier EDI
......@@ -70,9 +70,11 @@ sales_order.setDeliveryMode(delivery_mode)
sales_order.setIncoterm(incoterm)
sales_order.setOrderType(order_type)
# set the source administration
local_user = container.portal_membership.getAuthenticatedMember()
local_user_name = string.replace(local_user.getUserName(), ' ', '_')
#local_user = container.portal_membership.getAuthenticatedMember()
#local_user_name = string.replace(local_user.getUserName(), '_', ' ')
local_user_name = string.replace(user_name, '_', ' ')
local_persons = sales_order.item_by_title_sql_search(title = local_user_name, portal_type = 'Person')
if len(local_persons) > 0:
sales_order.setSourceAdministration(local_persons[0].relative_url)
......@@ -272,7 +274,11 @@ sales_order.flushActivity(invoke=1)
# try to apply a sale condition
sales_order.sales_order_apply_condition(my_id, 1)
# change the workflow to create the sales packing list
# give the role to user
sales_order.Item_doWorkflowTransition(workflow_action='user_order', workflow_id='order_workflow')
#sales_order.flushActivity(invoke=1)
sales_order.Item_doWorkflowTransition(workflow_action='user_confirm', workflow_id='order_workflow')
# and this is the end ....
if batch_mode:
......
......@@ -526,6 +526,28 @@
<infostring align="left" x="1.1cm" y="3.2cm" size="5" font="Helvetica" color="(0,0,0)">
dues cette date de rglement en principal, frais et taxes inclus, et au taux de l'intrt lgal major de 5 points, sans que cette pnalit puisse tre en toute hypothse infrieure 1,5 fois le taux de l'intrt lgal.
</infostring>
<infostring align="left" x="10cm" y="24.7cm" size="9"
font="Helvetica-Oblique" color="(0,0,0)">
Rpartition par tailles
</infostring>
<infostring align="left" x="15.4cm" y="24.7cm" size="9"
font="Helvetica-Oblique" color="(0,0,0)">
Quantit
</infostring>
<infostring align="left" x="17.1cm" y="24.7cm" size="9"
font="Helvetica-Oblique" color="(0,0,0)">
P.U.H.T.
</infostring>
<infostring align="left" x="18.8cm" y="24.7cm" size="9"
font="Helvetica-Oblique" color="(0,0,0)">
Total H.T.
</infostring>
<!-- Pied de facture -->
<rectangle x="1cm" y="5.0cm" width="19.5cm" height="0.8cm"
linewidth="0" fill="(0.75,0.75,0.75)"/>
<line x1="1cm" x2="20.5cm" y1="5.8cm" y2="5.8cm" width="1"/>
<line x1="1cm" x2="20.5cm" y1="5.0cm" y2="5.0cm" width="1"/>
</static>
......
......@@ -140,6 +140,36 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_source_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>source</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Expdi par</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
</fields>
</group>
<group>
......@@ -231,6 +261,61 @@
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>destination_address</id> <type>StringField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">1</hidden>
<max_length></max_length>
<required type="int">0</required>
<title>Lieu livraison : inconnu</title>
<truncate type="int">0</truncate>
</values>
<tales>
<title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_destination_section_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>destination_section</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Pour le compte de</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_start_date</id> <type>DateTimeField</type>
<values>
<alternate_name></alternate_name>
......@@ -248,7 +333,7 @@
<title>Date d'expdition prvue</title>
</values>
<tales>
<title>python:'Date d'expdition prvue : %s' % here.getStartDate()</title>
<title>python:'Expdition prvue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......@@ -299,7 +384,7 @@
<title>Date de livraison prvue</title>
</values>
<tales>
<title>python:'Date de livraison prvue : %s' % here.getStopDate()</title>
<title>python:'Livraison prvue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......
......@@ -140,6 +140,36 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_source_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>source</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Expdi par</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
</fields>
</group>
<group>
......@@ -231,6 +261,61 @@
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>destination_address</id> <type>StringField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">1</hidden>
<max_length></max_length>
<required type="int">0</required>
<title>Lieu livraison : inconnu</title>
<truncate type="int">0</truncate>
</values>
<tales>
<title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_destination_section_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>destination_section</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Pour le compte de</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_start_date</id> <type>DateTimeField</type>
<values>
<alternate_name></alternate_name>
......@@ -248,7 +333,7 @@
<title>Date d'expdition prvue</title>
</values>
<tales>
<title>python:'Date d'expdition prvue : %s' % here.getStartDate()</title>
<title>python:'Expdition prvue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......@@ -299,7 +384,7 @@
<title>Date de livraison prvue</title>
</values>
<tales>
<title>python:'Date de livraison prvue : %s' % here.getStopDate()</title>
<title>python:'Livraison prvue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......
......@@ -8,7 +8,7 @@
page_number python:[0]">
<TABLE tal:repeat="delivery delivery_list" width="660" height="955" cellpadding="0" cellspacing="0" tal:attributes="class python:here.PT_pageBreak(page_number)">
<TABLE border="0" width="660" height="900" cellpadding="0" cellspacing="0"
tal:define="order python:delivery.getCausalityValue(portal_type=['Sales Order']);
tal:define="order python:delivery.getCausalityValue(portal_type=['Sales Order','Sales Packing List']);
destination python:delivery.getDestinationValue(portal_type=['Organisation']);
delivery_line_list python:filter(lambda line_item: line_item.getTargetTotalQuantity() > 0, delivery.contentValues(filter={'portal_type':
'Sales Packing List Line'}));
......
......@@ -140,6 +140,36 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_source_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>source</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Expdi par</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
</fields>
</group>
<group>
......@@ -248,7 +278,37 @@
<truncate type="int">0</truncate>
</values>
<tales>
<title>python: 'Lieu livraison : %s %s' % (here.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getZipCode(),here.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getCity())</title>
<title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_destination_section_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>destination_section</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>organisation</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type>
<required type="int">0</required>
<title>Pour le compte de</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......
......@@ -163,7 +163,7 @@ An ERP5 Rule..."""
rule.reset(self)
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self):
def expand(self, **kw):
"""
Expands the current movement downward.
......
......@@ -120,7 +120,7 @@ An ERP5 Rule..."""
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, **kw):
"""
Expands the current movement downwards.
......@@ -136,7 +136,9 @@ An ERP5 Rule..."""
# Only expand if my_delivery is not None and state is not 'confirmed'
if my_delivery is not None:
if my_delivery.getSimulationState() not in ('delivered', ):
#if my_delivery.getSimulationState() not in ('delivered', ):
# Even if delivered, we should always calculate consequences
if 1:
# First, check each contained movement and make
# a list of delivery ids which do not need to be copied
# eventually delete movement which do not exist anylonger
......@@ -216,7 +218,7 @@ An ERP5 Rule..."""
% delivery_line_object.absolute_url())
# Pass to base class
Rule.expand(self, applied_rule)
Rule.expand(self, applied_rule, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list):
......
......@@ -236,20 +236,24 @@ An order..."""
my_applied_rule_list = self.getCausalityRelatedValueList(portal_type='Applied Rule')
if len(my_applied_rule_list) != 1:
# XXX This is an error
return
raise CategoryError, "Order has no or too many order rule(s)"
applied_rule = my_applied_rule_list[0].getObject()
if applied_rule is None:
# XXX This is an error
return
raise CategoryError, "Order has None order rule"
# Make sure applied rule has been reindexed
applied_rule.flushActivity(invoke=1)
# Make sure there are no more activities on this order related to expand
self.flushActivity(invoke=1, method_id='expand') # Make sure expand is finished
self.flushActivity(invoke=0, method_id='expand') # Make sure expand is finished
# We are expanding but are not allowed to if state wrong...
# (ex. confirmed)
applied_rule.expand(force = 1) # thus, we mist force expand of applied order rule
applied_rule.flushActivity(invoke=1)
# Build delivery list on applied rule
# Currently, we build it 'again' but we should actually only build
# deliveries for orphaned movements
if self.getPortalType() == 'Production Order' :
delivery_list = self.ProductionOrder_buildDeliveryList() # Coramy specific moved to portal_simulation
#else:
elif self.getPortalType() in ('Purchase Order', 'Sales Order') :
delivery_list = self.order_create_packing_list() # Coramy specific should be moved to portal_simulation
#self.informDeliveryList(delivery_list=delivery_list, comment=repr(delivery_list)) # XXX Not ready
......
......@@ -29,7 +29,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Rule import Rule
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list
from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, reserved_inventory_state_list, current_inventory_state_list
from zLOG import LOG
......@@ -121,7 +121,7 @@ An ERP5 Rule..."""
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, force=0, **kw):
"""
Expands the current movement downward.
......@@ -141,8 +141,9 @@ An ERP5 Rule..."""
if my_order is not None:
# Only expand order rule if order not yet confirmed (This is consistent
# with the fact that once simulation is launched, we stick to it)
if my_order.getSimulationState() not in reserved_inventory_state_list and \
my_order.getSimulationState() not in current_inventory_state_list:
if force or \
(my_order.getSimulationState() not in reserved_inventory_state_list and \
my_order.getSimulationState() not in current_inventory_state_list):
# First, check each contained movement and make
# a list of order ids which do not need to be copied
# eventually delete movement which do not exist anylonger
......@@ -198,7 +199,7 @@ An ERP5 Rule..."""
% order_line_object.absolute_url())
# Pass to base class
Rule.expand(self, applied_rule)
Rule.expand(self, applied_rule, force=force, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list):
......
......@@ -167,7 +167,7 @@ An ERP5 Rule..."""
"""
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, **kw):
"""
Expands the current movement downward.
......@@ -177,7 +177,7 @@ An ERP5 Rule..."""
is expanded.
"""
for o in applied_rule.objectValues():
o.expand()
o.expand(**kw)
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list):
......
......@@ -236,7 +236,7 @@ a service in a public administration)."""
# Causality Workflow Methods
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self):
def expand(self, **kw):
"""
-> new status : expanded
......@@ -252,7 +252,7 @@ a service in a public administration)."""
if self.getCausalityState() is 'expanded':
# Reexpand
for my_applied_rule in self.objectValues():
my_applied_rule.expand()
my_applied_rule.expand(**kw)
else:
portal_rules = getToolByName(self, 'portal_rules')
# Parse each applied rule and test if it applied
......
......@@ -166,7 +166,7 @@ An ERP5 Rule..."""
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, **kw):
"""
Expands the current movement downward.
......@@ -289,7 +289,7 @@ An ERP5 Rule..."""
applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery
# Pass to base class
Rule.expand(self, applied_rule)
Rule.expand(self, applied_rule, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list):
......
......@@ -153,7 +153,7 @@ An ERP5 Rule..."""
"""
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, **kw):
"""
Expands the current movement downward.
......@@ -219,7 +219,7 @@ An ERP5 Rule..."""
my_context_movement.getVariationCategoryList())
# Create one submovement which sources the transformation
Rule.expand(self, applied_rule)
Rule.expand(self, applied_rule, **kw)
security.declareProtected(Permissions.ModifyPortalContent, 'solve')
def solve(self, applied_rule, solution_list):
......
......@@ -123,7 +123,7 @@ An ERP5 Rule..."""
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule):
def expand(self, applied_rule, **kw):
"""
An applied rule can be expanded only if its parent movement
is expanded.
......
......@@ -505,10 +505,12 @@ class SimulationTool (Folder, UniqueObject):
if movement_group is not None:
for order_group in movement_group.group_list:
# Order should never be None
LOG("buildDeliveryList", 0, str(order_group.__dict__))
if order_group.order is not None:
order = self.portal_categories.resolveCategory(order_group.order)
if order is not None:
# define some variables
LOG("order", 0, str(order.__dict__))
if order.getPortalType() == 'Purchase Order' :
delivery_module = order.getPortalObject().livraison_achat
delivery_type = 'Purchase Packing List'
......@@ -519,9 +521,16 @@ class SimulationTool (Folder, UniqueObject):
delivery_type = 'Sales Packing List'
delivery_line_type = delivery_type + ' Line'
delivery_cell_type = 'Delivery Cell'
else:
#LOG("ERP5 Simulation", 100, "None order makes no sense")
else : # should never be none
LOG("order is None", 0, str(order.__dict__))
return delivery_list
else: # order is None
order = None
# possible when we build deliveries for tranfer of property
delivery_module = self.getPortalObject().livraison_vente
delivery_type = 'Sales Packing List'
delivery_line_type = delivery_type + ' Line'
delivery_cell_type = 'Delivery Cell'
for path_group in order_group.group_list :
# we create a new delivery for each DateGroup
......@@ -530,8 +539,10 @@ class SimulationTool (Folder, UniqueObject):
# JPS NEW
if path_group.source is None or path_group.destination is None:
# Production Path
#LOG("Builder",0, "Strange Path %s " % path_group.source)
#LOG("Builder",0, "Strange Path %s " % path_group.destination)
LOG("Builder",0, "Strange Path %s " % path_group.source)
LOG("Builder",0, "Strange Path %s " % path_group.destination)
if path_group.source is None or path_group.destination is None:
delivery_module = self.rapport_fabrication
delivery_type = 'Production Report'
delivery_line_type = 'Production Report Line'
......@@ -556,10 +567,6 @@ class SimulationTool (Folder, UniqueObject):
self.portal_types.constructContent(type_name = delivery_type,
container = delivery_module,
id = new_delivery_id,
title = order.getTitle(),
causality_value = order,
incoterm = order.getIncoterm(),
delivery_mode = order.getDeliveryMode(),
target_start_date = date_group.start_date,
target_stop_date = date_group.stop_date,
start_date = date_group.start_date,
......@@ -570,6 +577,12 @@ class SimulationTool (Folder, UniqueObject):
destination_section = path_group.destination_section
)
delivery = delivery_module[new_delivery_id]
if order is not None :
delivery.edit(title = order.getTitle(),
causality_value = order,
incoterm = order.getIncoterm(),
delivery_mode = order.getDeliveryMode()
)
# the new delivery is added to the delivery_list
delivery_list.append(delivery)
# LOG('Livraison cre',0,str(delivery.getId()))
......@@ -614,7 +627,7 @@ class SimulationTool (Folder, UniqueObject):
# update target_quantity for each delivery_cell
for variant_group in resource_group.group_list :
#LOG('Variant_group examin',0,str(variant_group.category_list))
#LOG('Variant_group examin?,0,str(variant_group.category_list))
object_to_update = None
# if there is no variation of the resource, update delivery_line with quantities and price
if len(variant_group.category_list) == 0 :
......@@ -652,6 +665,7 @@ class SimulationTool (Folder, UniqueObject):
except:
cell_total_price = None
if movement.getPortalType() == 'Simulation Movement' :
# update every simulation_movement
# we set delivery_value and target dates and quantity
movement._setDeliveryValue(object_to_update)
......
......@@ -495,6 +495,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
security.declareProtected( Permissions.ModifyPortalContent, 'edit' )
def edit(self, REQUEST=None, force_update = 0, reindex_object=1, **kw):
return self._edit(REQUEST=REQUEST, force_update=force_update, reindex_object=reindex_object, **kw)
edit = WorkflowMethod( edit )
# Accessing object property Ids
......
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