Commit dae22c5b authored by Romain Courteaud's avatar Romain Courteaud

creation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@225 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cbcde99e
## Script (Python) "SalesOrder_confirmList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=start_date=None, stop_date=None,batch_mode=0,**kw
##title=
##
# confirm the selection of Sales Order
request = context.REQUEST
object_list = context.object_action_list(selection_name='sales_order_selection')
confirmed_order_number = 0
confirmed_order_list = ' '
not_confirmed_order_number = 0
not_confirmed_order_list = ' '
uid_list = []
for order in object_list:
simulation_state = order.getSimulationState()
if (simulation_state == 'planned' or simulation_state == 'ordered'):
error_message = order.Order_heavyControl()
if error_message == '':
# we give local_roles to the users
user_name = ''
user_name = order.getSourceAdministrationTitle().replace(' ','_')
order.assign_gestionaire_designe_roles(user_name = user_name)
if start_date != None:
order.setStartDate(start_date)
if stop_date != None:
order.setStopDate(stop_date)
# set the transition_state to 'confirmed'
order.confirm()
#order.flushActivity(invoke=1)
confirmed_order_number += 1
confirmed_order_list += order.getId()+' '
else:
not_confirmed_order_number += 1
not_confirmed_order_list += order.getId()+' '
uid_list.append(order.getUid())
elif (simulation_state == 'draft'):
not_confirmed_order_number += 1
not_confirmed_order_list += order.getId()+' '
uid_list.append(order.getUid())
# and this is the end ....
if batch_mode:
return None
else:
"""
redirect_url = '%s?%s%i%s' % ( context.absolute_url()+'/'+'view', 'portal_status_message=',not_confirmed_order_number,'+Commandes+ventes+non+confirmes:'+not_confirmed_order_list+'\n')
request[ 'RESPONSE' ].redirect( redirect_url )
"""
if not_confirmed_order_number == 0:
redirect_url = '%s?%s%i%s' % ( context.absolute_url()+'/'+'view', 'portal_status_message=',confirmed_order_number,'+Commandes+ventes+confirmes.')
else:
context.portal_selections.setSelectionToIds('sales_order_selection', uid_list, REQUEST=request)
redirect_url = '%s?%s%i%s' % ( context.absolute_url()+'/'+'view', 'portal_status_message=',not_confirmed_order_number,'+Commandes+ventes+non+confirmes.')
request[ 'RESPONSE' ].redirect( redirect_url )
<?xml version="1.0" encoding="iso-8859-1"?>
<form>
<title>Confirmer les commandes</title>
<name>SalesOrder_confirmListForm</name>
<action>SalesOrder_confirmList</action>
<enctype>multipart/form-data</enctype>
<method>POST</method>
<pt>form_view_dialog</pt>
<groups>
<group>
<title>Default</title>
<fields>
<field><id>my_start_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable_expression></editable_expression>
<editable_permission></editable_permission>
<editable_role></editable_role>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>dmy</input_order>
<input_style>text</input_style>
<not_viewable type="int">0</not_viewable>
<read_only type="int">0</read_only>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>Date d'expdition confirme</title>
<viewable_expression></viewable_expression>
<viewable_permission></viewable_permission>
<viewable_role></viewable_role>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
<field><id>my_stop_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable_expression></editable_expression>
<editable_permission></editable_permission>
<editable_role></editable_role>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>dmy</input_order>
<input_style>text</input_style>
<not_viewable type="int">0</not_viewable>
<read_only type="int">0</read_only>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>Date de livraison confirme</title>
<viewable_expression></viewable_expression>
<viewable_permission></viewable_permission>
<viewable_role></viewable_role>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>hidden</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
## Script (Python) "SalesOrder_orderList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=batch_mode=0,**kw
##title=
##
# order the selection of Sales Order
request = context.REQUEST
object_list = context.object_action_list(selection_name='sales_order_selection')
ordered_order_number = 0
ordered_order_list = ' '
not_ordered_order_number = 0
not_ordered_order_list = ' '
uid_list = []
for order in object_list:
simulation_state = order.getSimulationState()
if (simulation_state == 'planned' or simulation_state == 'draft'):
error_message = order.Order_lightControl()
if error_message == '':
# we give local_roles to the users
user_name = ''
user_name = order.getSourceAdministrationTitle().replace(' ','_')
order.assign_gestionaire_designe_roles(user_name = user_name)
# set the transition_state to 'ordered'
order.order()
#order.flushActivity(invoke=1)
ordered_order_number += 1
ordered_order_list += order.getId()+' '
else:
not_ordered_order_number += 1
not_ordered_order_list += order.getId()+' '
uid_list.append(order.getUid())
else:
"""
not_ordered_order_number += 1
not_ordered_order_list += order.getId()+' '
uid_list.append(order.getUid())
"""
None
# and this is the end ....
if batch_mode:
return None
else:
if not_ordered_order_number == 0:
redirect_url = '%s?%s%i%s' % ( context.absolute_url()+'/'+'view', 'portal_status_message=',ordered_order_number,'+Commandes+ventes+valides.')
else:
context.portal_selections.setSelectionToIds('sales_order_selection', uid_list, REQUEST=request)
redirect_url = '%s?%s%i%s' % ( context.absolute_url()+'/'+'view', 'portal_status_message=',not_ordered_order_number,'+Commandes+ventes+non+valides.')
request[ 'RESPONSE' ].redirect( redirect_url )
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