Commit e3865bf2 authored by Mame Coumba Sall's avatar Mame Coumba Sall

2009-06-18 mame

*add new prefix already defined for reference
*modified so that reference is calculated according to EAN13 format

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27665 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 16558945
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Message import translateString\n
from DateTime import DateTime\n
\n
prefix_reference = DateTime().strftime(\'1%d%m%y\')\n
return prefix_reference\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>DateTime</string>
<string>_getattr_</string>
<string>prefix_reference</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DeliveryLine_calculateReferencePrefix</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -94,7 +94,7 @@ for line in kw.get(\'listbox\'):\n ...@@ -94,7 +94,7 @@ for line in kw.get(\'listbox\'):\n
module = context.getDefaultModule(item_portal_type)\n module = context.getDefaultModule(item_portal_type)\n
item = module.newContent(portal_type=item_portal_type,\n item = module.newContent(portal_type=item_portal_type,\n
title=line[\'title\'],\n title=line[\'title\'],\n
reference ="1%s%s" % (now, line["reference"].zfill(6)),\n reference = line["reference"],\n
quantity=line[\'quantity\'],\n quantity=line[\'quantity\'],\n
quantity_unit=context.getQuantityUnit(),\n quantity_unit=context.getQuantityUnit(),\n
**item_property_dict)\n **item_property_dict)\n
......
...@@ -53,12 +53,22 @@ ...@@ -53,12 +53,22 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>result = [x.getObject() for x in context.portal_catalog(portal_type = request.get("field_your_type"),\n <value> <string encoding="cdata"><![CDATA[
reference= request.get(\'field_listbox_reference_%s\' % request.cell.uid))]\n
if editor and result !=[]:\n if editor and len(request.get("field_listbox_reference_%s" % request.cell.uid))<=13:\n
reference = "%s%s" % (request.get("field_your_prefix_reference"), request.get(\'field_listbox_reference_%s\' % request.cell.uid).zfill(6)) \n
test_result = request.cell.Base_validateEan13Code(reference,request)\n
if test_result ==True:\n
request.form["field_listbox_reference_%s" % request.cell.uid] = reference\n
result = [x.getObject() for x in context.portal_catalog(portal_type = request.get("field_your_type"),\n
reference= reference)]\n
if (result !=[] or test_result ==False ):\n
return False\n return False\n
\n
return True\n return True\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -96,15 +106,19 @@ return True\n ...@@ -96,15 +106,19 @@ return True\n
<tuple> <tuple>
<string>editor</string> <string>editor</string>
<string>request</string> <string>request</string>
<string>len</string>
<string>_getattr_</string>
<string>reference</string>
<string>test_result</string>
<string>True</string>
<string>_write_</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_getattr_</string>
<string>context</string> <string>context</string>
<string>x</string> <string>x</string>
<string>result</string> <string>result</string>
<string>False</string> <string>False</string>
<string>True</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>display_maxwidth</string> </key> <key> <string>display_maxwidth</string> </key>
<value> <int>6</int> </value> <value> <int>13</int> </value>
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
......
171 173
\ No newline at end of file \ No newline at end of file
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