Commit a02653cc authored by Sebastien Robin's avatar Sebastien Robin

fixed a bug in monetary issue fast input.

Some errors were introduced on cash incident, but back good scripts.
Do not check the balance on outgoing lines on cash balance regulation

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12485 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a1840ca7
......@@ -84,7 +84,7 @@ def isSameSet(a, b):\n
return 1\n
\n
# remove previous line\n
old_line = [x.getObject().getId() for x in context.searchFolder(portal_type=[line_portal_type, container_line_portal_type])]\n
old_line = [x.getId() for x in context.objectValues(portal_type=[line_portal_type, container_line_portal_type])]\n
if len(old_line)>0:\n
for line_id in old_line:\n
r = context.deleteContent(line_id)\n
......@@ -98,11 +98,11 @@ for listbox_line in listbox:\n
container_dict["reference"] = container.getReference()\n
container_dict["range_start"] = container.getCashNumberRangeStart()\n
container_dict["range_stop"] = container.getCashNumberRangeStop()\n
container_lines = container.searchFolder(portal_type=\'Container Line\')\n
container_lines = container.objectValues(portal_type=\'Container Line\')\n
if len(container_lines) == 0:\n
context.log("Delivery_saveContainerFastInputLine", "No container line find for cash container %s" %(cash_container.getRelativeUrl(),))\n
continue\n
container_line = container_lines[0].getObject()\n
container_line = container_lines[0]\n
container_dict["resource"] = container_line.getResourceValue()\n
container_dict["quantity"] = container_line.getQuantity()\n
container_dict["variation_category"] = container_line.getVariationCategoryList()\n
......@@ -134,6 +134,7 @@ for cash_container in cash_container_item_dict.keys():\n
container_line.setResourceValue(container_dict[\'resource\'])\n
container_line.setVariationCategoryList(container_dict[\'variation_category\'])\n
container_line.updateCellRange(script_id=\'CashDetail_asCellRange\',base_id="movement")\n
resource_total_quantity = 0\n
for key in container_line.getCellKeyList(base_id=\'movement\'):\n
if isSameSet(key,container_dict[\'variation_category\']):\n
cell = container_line.newCell(*key)\n
......@@ -147,24 +148,23 @@ for cash_container in cash_container_item_dict.keys():\n
\n
resource_total_quantity += container_dict[\'quantity\']\n
\n
movement_line = context.newContent(id = "movement"\n
, portal_type = line_portal_type\n
, resource_value = container_dict[\'resource\']\n
, quantity_unit_value = context.portal_categories.quantity_unit.unit\n
)\n
movement_line.setVariationBaseCategoryList(container_dict[\'base_variation_category\'])\n
movement_line.setVariationCategoryList(container_dict[\'variation_category\'])\n
movement_line.updateCellRange(script_id="CashDetail_asCellRange", base_id="movement")\n
for key in movement_line.getCellKeyList(base_id=\'movement\'):\n
if isSameSet(key,container_dict[\'variation_category\']):\n
cell = movement_line.newCell(*key)\n
cell.setCategoryList(container_dict[\'variation_category\'])\n
cell.setQuantity(resource_total_quantity)\n
cell.setMappedValuePropertyList([\'quantity\',\'price\'])\n
cell.setMembershipCriterionBaseCategoryList(container_dict[\'base_variation_category\'])\n
cell.setMembershipCriterionCategoryList(container_dict[\'variation_category\'])\n
cell.edit(force_update = 1,\n
price = movement_line.getResourceValue().getBasePrice())\n
movement_line = context.newContent( portal_type = line_portal_type,\n
resource_value = container_dict[\'resource\'],\n
quantity_unit_value = context.portal_categories.quantity_unit.unit\n
)\n
movement_line.setVariationBaseCategoryList(container_dict[\'base_variation_category\'])\n
movement_line.setVariationCategoryList(container_dict[\'variation_category\'])\n
movement_line.updateCellRange(script_id="CashDetail_asCellRange", base_id="movement")\n
for key in movement_line.getCellKeyList(base_id=\'movement\'):\n
if isSameSet(key,container_dict[\'variation_category\']):\n
cell = movement_line.newCell(*key)\n
cell.setCategoryList(container_dict[\'variation_category\'])\n
cell.setQuantity(resource_total_quantity)\n
cell.setMappedValuePropertyList([\'quantity\',\'price\'])\n
cell.setMembershipCriterionBaseCategoryList(container_dict[\'base_variation_category\'])\n
cell.setMembershipCriterionCategoryList(container_dict[\'variation_category\'])\n
cell.edit(force_update = 1,\n
price = movement_line.getResourceValue().getBasePrice())\n
\n
request = context.REQUEST\n
redirect_url = \'%s/view?%s\' % ( context.absolute_url()\n
......
......@@ -95,6 +95,7 @@ def isSameSet(a, b):\n
if len(a) != len(b) : return 0\n
return 1\n
\n
reference_currency_id = context.Baobab_getPortalReferenceCurrencyID()\n
\n
def create_movement(CD_head_dict, CD_line_list):\n
# Head creation\n
......@@ -213,6 +214,9 @@ def split_head(CD_file_line_list):\n
except:\n
return {\'error\':True, \'message\':message_dict[\'10\'], \'head_dict\':{}}\n
head_variation = str(head_resource_variation)\n
# Bad hack because in the CD the variation used is the date of building\n
if head_variation==\'2005\':\n
head_variation=\'2003\'\n
\n
try:\n
column_end_price = head_resource_string.find(\'F\')\n
......@@ -234,7 +238,7 @@ def split_head(CD_file_line_list):\n
context.log(\'i_resource.getTitle\',resource_object.getTitle())\n
context.log(\'i_resource.getPath\',resource_object.getPath())\n
\n
if (resource_object.getPriceCurrency() == \'currency_module/XOF\') \\\n
if (resource_object.getPriceCurrency() == \'currency_module/%s\' % reference_currency_id) \\\n
and (resource_object.getBasePrice() == head_resource_price) \\\n
and (head_variation in resource_object.getVariationList()) :\n
\n
......@@ -428,14 +432,15 @@ return url_redirection(message_dict[\'message\' ],delivery_id=message_dict[\'del
<string>kw</string>
<string>message_dict</string>
<string>isSameSet</string>
<string>_getattr_</string>
<string>context</string>
<string>reference_currency_id</string>
<string>create_movement</string>
<string>split_head</string>
<string>split_lines</string>
<string>None</string>
<string>request</string>
<string>url_redirection</string>
<string>_getattr_</string>
<string>context</string>
<string>CD_file_line_list</string>
<string>_getitem_</string>
<string>split_head_result_dict</string>
......
......@@ -68,8 +68,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>#return None\n
return context.getSource()\n
<value> <string>return None\n
</string> </value>
</item>
<item>
......@@ -120,8 +119,7 @@ return context.getSource()\n
<tuple>
<string>args</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
</tuple>
</value>
</item>
......
......@@ -68,7 +68,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return None\n
<value> <string>return context.getSource()\n
</string> </value>
</item>
<item>
......@@ -119,7 +119,8 @@
<tuple>
<string>args</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
</value>
</item>
......
......@@ -76,7 +76,10 @@ transaction = state_change.object\n
caisse = transaction.getSource()\n
\n
resource_one = transaction.CashDelivery_checkCounterInventory(source = caisse, portal_type=\'Incoming Cash Balance Regulation Line\')\n
resource_two = transaction.CashDelivery_checkCounterInventory(source = caisse, portal_type=\'Outgoing Cash Balance Regulation Line\', same_source=1)\n
resource_two = transaction.CashDelivery_checkCounterInventory(source = caisse, \n
portal_type=\'Outgoing Cash Balance Regulation Line\', \n
same_source=1,\n
no_balance_check=1)\n
#resource_two = transaction.CashDelivery_checkCounterInventory(source = caisse, portal_type=\'Outgoing Cash Balance Regulation Line\')\n
\n
#context.log(\'resource_one\', resource_one)\n
......
156
\ No newline at end of file
159
\ 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