I trying to figure out self.Form.new(). I have a button that has an onHit event
with self.Form.new(). When I click on it I get a new parent record. I fill in
the the fields and save the record, so far so good. At this point I lose the
connection between the parent and child record. When I use the navigation
buttons to go back and forward the child records move but the parent does not.
Also the PK field for the new record remains at -1 even though the bizobj has
the correct value in the field. Any suggestions welcome.
Dabo:
Platform: GTK
Python Version: 2.5.1c1 on linux2
Dabo Version: Version 0.8.3; Revision ~3849
UI Version: 2.8.7.1 on wxGTK (gtk2)
Database:
Postgres 8.2
Bizobj code:
def createBizobjs(self):
class Publicplant1Bizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "public.plant1"
self.KeyField = "p_item_no"
self.addFrom("public.plant1")
self.addOrderBy("p_item_no")
self.setLimit(None)
self.addField("plant_type")
self.addField("p_item_no")
self.addField("variety")
self.addField("color")
self.addField("season")
self.addField("category_sub_type")
self.addField("category_type")
self.addField("common")
self.addField("series")
self.addField("genus")
self.addField("species")
self.SaveNewUnchanged=True
"""self.DefaultValues={'plant_type':None,
'season':None,
'category_type':None,
'category_sub_type':None,
'common':None}"""
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
if len(self.Record.common) == 0:
print len(self.Record.common)
ret = 'No empty strings'
else:
ret = ""
# Add your business rules here.
return ret
def validateField(self,fld,val):
ret = ""
if fld == 'common' and val == '':
ret = 'No empty strings'
return ret
publicplant1Bizobj = Publicplant1Bizobj(self.Connection)
self.addBizobj(publicplant1Bizobj)
class PublicprojectionBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "public.projection"
self.KeyField = "line_id"
self.addFrom("public.projection")
self.addOrderBy("year")
self.addOrderBy("c_id")
self.setLimit(None)
self.addField("line_id")
self.addField("c_id")
self.addField("p_item_no")
self.addField("item_key")
self.addField("year")
self.addField("method")
self.addField("sub_method")
self.addField("qty")
self.addField("proj_note")
self.addField("pot_ct")
self.addField("trial")
self.addField("link_key")
self.LinkField = "p_item_no"
self.ParentLinkField = "p_item_no"
self.FillLinkFromParent = True
self.SaveNewUnchanged= True
"""self.DefaultValues = {'year':None,
'c_id':None,
'method':None,
'p_item_no':None} """
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
publicprojectionBizobj = PublicprojectionBizobj(self.Connection)
self.addBizobj(publicprojectionBizobj)
publicplant1Bizobj.addChild(publicprojectionBizobj)
--
Adrian Klaver
[EMAIL PROTECTED]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]