[Erp5-report] r32001 leonardo - /erp5/trunk/products/ERP5/Tool/SimulationTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jan 26 23:26:01 CET 2010
Author: leonardo
Date: Tue Jan 26 23:25:59 2010
New Revision: 32001
URL: http://svn.erp5.org?rev=32001&view=rev
Log:
Shared.DC.ZRDB.Results.Results objects no longer take a list of dictionaries.
Use Shared.DC.ZRDB.Results.Results.r objects instead, which behave like the
tuples that Shared.DC.ZRDB.Results.Results want.
Modified:
erp5/trunk/products/ERP5/Tool/SimulationTool.py
Modified: erp5/trunk/products/ERP5/Tool/SimulationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/SimulationTool.py?rev=32001&r1=32000&r2=32001&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/SimulationTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/SimulationTool.py [utf8] Tue Jan 26 23:25:59 2010
@@ -1013,7 +1013,7 @@
inventory.
Second query: Fetch full inventory amounts.
Fetch values of inventory identified in the first query.
- Tird query: Classic stock table read.
+ Third query: Classic stock table read.
Fetch all rows in stock table which are posterior to the inventory.
Final result
Add results of the second and third queries, and return it.
@@ -1269,7 +1269,7 @@
schema. If one of the parameters is None, returns the
other parameters.
- Arythmetic modifications on additions:
+ Arithmetic modifications on additions:
None + x = x
None + None = None
"""
@@ -1277,8 +1277,18 @@
return line_b
if line_b is None:
return line_a
- result = {}
- for key, value in line_a.iteritems():
+ # Create a new Shared.DC.ZRDB.Results.Results.__class__
+ # instance to add the line values.
+ # the logic for the 5 lines below is taken from
+ # Shared.DC.ZRDB.Results.Results.__getitem__
+ Result = line_a.__class__
+ parent = line_a.aq_parent
+ result = Result((), parent)
+ if parent is not None:
+ result = result.__of__(parent)
+
+ for key in line_a.__record_schema__:
+ value = line_a[key]
if key in result_column_id_dict:
value_b = line_b[key]
if None not in (value, value_b):
@@ -1291,13 +1301,13 @@
result[key] = line_a[key]
elif key not in ('date', 'stock_uid', 'path'):
LOG('InventoryTool.getInventoryList.addLineValues', 0,
- 'missmatch for %s column: %s and %s' % \
+ 'mismatch for %s column: %s and %s' % \
(key, line_a[key], line_b[key]))
return result
inventory_list_dict = {}
for line_list in (initial_inventory_line_list,
delta_inventory_line_list):
- for line in line_list.dictionaries():
+ for line in line_list:
line_key = getInventoryListKey(line)
line_a = inventory_list_dict.get(line_key)
inventory_list_dict[line_key] = addLineValues(line_a,
More information about the Erp5-report
mailing list