dabo Commit
Revision 6422
Date: 2011-02-11 06:24:22 -0800 (Fri, 11 Feb 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6422
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Limit child bizobj FK updates to the new rows only.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2011-02-11 13:41:03 UTC (rev 6421)
+++ trunk/dabo/biz/dBizobj.py 2011-02-11 14:24:22 UTC (rev 6422)
@@ -1441,7 +1441,7 @@
if self.AutoPopulatePK:
for child in self.__children:
if child.FillLinkFromParent:
- child.setParentFK()
+ child.setParentFK(allRows=True)
# Call the custom hook method
self.onSaveNew()
@@ -1469,7 +1469,7 @@
cursor.setNewFlag()
# Fill in the link to the parent record
if self.Parent and self.FillLinkFromParent and self.LinkField:
- self.setParentFK()
+ self.setParentFK(allRows=False)
# Call the custom hook method
self.onNew()
@@ -1490,7 +1490,7 @@
pass
- def setParentFK(self, val=None):
+ def setParentFK(self, val=None, allRows=True):
""" Accepts and sets the foreign key value linking to the
parent table for all records.
"""
@@ -1499,8 +1499,12 @@
val = self.getParentLinkValue()
# Update cursor key to avoid future redundant requery.
self._updateCursorKey(val)
- self.scan(self._setParentFK, val)
+ if allRows:
+ self.scan(self._setParentFK, val,
scanRequeryChildren=None)
+ else:
+ self._setParentFK(val)
+
def _setParentFK(self, val):
if not isinstance(val, (list, tuple)):
val = (val,)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]