main logo
Subject: [dabo-dev] [Dabo Ticket] #1027: Bug ? in bizobj.new()
Author: "Dabo"

Posted: 2007/03/31 01:17:32
 
View Entire Thread
New Search


#1027: Bug ? in bizobj.new()
--------------------+-------------------------------------------------------
Reporter: johnf | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: 1.0
Component: ui | Version:
Keywords: |
--------------------+-------------------------------------------------------
Setup the following relationships:
Parent (pkid (integer))
child (pkid (integer), fk_Parent =parent.pkid)
grandchild (pkid (integer, fk_Parent=child.pkid)

Using the following to add a “child”:
mybiz=self.Form.getBizobj(“child”)
mybiz.new()

The new() will error at the database side when the bizobj attempts to
requery the grandchild because the child has been assigned a pkid =
"-1-dabotmp" – a string value. For example, the select statement for the
grandchild contains the following:
select * from grandchild
where fk_grandchild = "-1-dabotmp"

Our current work around is to change the order of the bizobj _onNew
method:
#jfcs changed to allow changing of PK
# Call the custom hook method
self.onNew()
# Fill in the link to the parent record
if self.Parent and self.FillLinkFromParent and
self.LinkField:
self.setParentFK()

And sub-class the “onNew” method in the bizobj to replace the child.pkid
with a retrieved pkid value from the database.

def onNew(self):
##self.AutoPopulatePK=True
conn = self.Application.getConnectionByName("DeanConn")
metaBiz = dabo.biz.dBizobj(conn)
metaBiz.execute("select
nextval('public.icvarieties_pkid_seq') as mypkid")
self.setFieldVal("pkid",metaBiz.getFieldVal("mypkid"))

We followed the code for hours and even now we are not sure if it is a bug
or we missed something very important. As we see it, we need to leave
AutoPopulatePK=True to allow dMemento to see changes with the new record.
Other wise if AutoPopulatePK=False dMemento does not see any changes to
dataset upon saving. In fact with AutoPopulatePK=False the record pointer
appears to move from the new record. But leaving AutoPopulatePK=True
causes the PKID to be assigned a string value without our changes noted
above.

Larry would like to say, “If looks like a duck....”
.

--
Ticket URL: <http://svn.dabodev.com/trac/dabo/ticket/1027>
Dabo <http://svn.dabodev.com/trac/dabo>
Trac Page for Dabo



 
©2007 Dabo
<-- Prior Message New Search Next Message -->