Heres the start of my bizobj :-
import dabo
import datetime
class TransactionsBizobj(dabo.biz.dBizobj):
def initProperties(self):
self.super()
self.Caption = "Transactions"
self.DataSource = "Transactions"
self.KeyField = "TransID"
self.DataStructure = (
("Date", "D", False, "Transactions", "Date"),
("AccountID", "I", False, "Transactions", "AccountID"),
("MemberID", "I", False, "Transactions", "MemberID"),
("Amount", "N", False, "Transactions", "Amount"),
("Description", "C", False, "Transactions",
"Description"),
("Reference", "C", False, "Transactions", "Reference"),
("TransID", "I", True, "Transactions", "TransID"),
)
self.DefaultValues = { "Date" : datetime.date.today}
def afterInit(self):
self.DataSource = "Transactions"
self.KeyField = "TransID"
self.addFrom("Transactions")
self.addField("Date")
self.addField("AccountID")
self.addField("MemberID")
self.addField("Amount")
self.addField("Description")
self.addField("Reference")
self.addField("TransID")
self.VirtualFields = {"AccountCode":self.getAccountCode,
"AccountDescription":self.getAccountDescription,
"LodgeName":self.getLodgeName}
Am I doing anything wrong here?
Thanks
Roger
--------------------------------------------------
From: "Ed Leafe" <[email protected]>
Sent: Wednesday, May 27, 2009 8:20 AM
To: "Dabo Users list" <[email protected]>
Subject: Re: [dabo-users] SQLite Problem
> On May 25, 2009, at 8:28 PM, Roger Lovelock wrote:
>
>> Not sure if this is a problem with dabo, or my code - wondering if
>> anyone else has a similar problem :-
>> I have a transaction table with a date field - default value is
>> today. Whenever I enter a new transaction the date on the first
>> record in the table is updated to today, even though I have not
>> edited that record. My form only allows new transactions to be
>> entered - the after init routine ending with self.new().
>
>
> How are you setting the default value? Sounds like you may not be on
> the new record when this is happening.
>
> The cleanest way is to use the DefaultValues dict in the bizobj.
>
>
> -- Ed Leafe
>
>
>
> _______________________________________________
> 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/[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/[email protected]