[dabo-users] Bug in Bizobj.lookupPKWithAdd()

2013-11-28 Thread Ricardo Aráoz
lookupPKWithAdd adds a record to the Bizobj, but in this case it raises 
"IvaFc.FacturaId may not be NULL".
As you can see below this Bizobj is a child Bizobj with 
FillLinkFromParent set to True, so FacturaId should have been 
automatically added (as it effectively is when new() is issued).

For some context:
Factura = Invoice
Fc = Inv
Iva = VAT

Parent Bizobj:
def addChildren(self):
app = self.Application
self.ItemFc = ItemFc(app.dbConnection)
self.addChild(self.ItemFc)
self.PagoFc = PagoFc(app.dbConnection)
self.addChild(self.PagoFc)
self.IvaFc = IvaFc(app.dbConnection)
self.addChild(self.IvaFc)

Child Bizob:
class IvaFc(Base):
def initProperties(self):
super(IvaFc, self).initProperties()
self.Caption = "IvaFc"
self.DataSource = "IvaFc"
self.KeyField = "Id"
self.LinkField = 'FacturaId'
self.FillLinkFromParent = True

Code line that provokes the exception:
bizIvaFc.moveToPK(bizIvaFc.lookupPKWithAdd('IvaId',
self.IvaId.prevKey))

Exception :
Traceback (most recent call last):
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/ui/uiwx/dControlItemMixin.py", 
line 34, in _onWxHit

super(dControlItemMixin, self)._onWxHit(evt)
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/ui/uiwx/dDataControlMixin.py", 
line 13, in _onWxHit

super(dDataControlMixin, self)._onWxHit(evt, *args, **kwargs)
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/ui/uiwx/dControlMixin.py", 
line 27, in _onWxHit

self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", 
line 1084, in raiseEvent
super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
**kwargs)
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/lib/eventMixin.py", 
line 81, in raiseEvent

bindingFunction(event)
  File "/home/richie/Python/Contable/contab/ui/PagEditFactura.py", line 
224, in actIva

self.IvaId.prevKey))
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/biz/dBizobj.py", 
line 2076, in lookupPKWithAdd

return self._CurrentCursor.lookupPKWithAdd(field, val)
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/db/dCursorMixin.py", 
line 1137, in lookupPKWithAdd

aux.execute(sql, (val,))
  File 
"/usr/local/lib/python2.7/dist-packages/Dabo-0.9.13-py2.7.egg/dabo/db/dCursorMixin.py", 
line 380, in execute

raise dException.DBQueryException(errMsg)
dabo.dException.DBQueryException: DBQueryException encountered in 
execute(): IvaFc.FacturaId may not be NULL




--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---
___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/529790d1.90...@gmail.com


[dabo-users] Can't make sense of the api comment

2013-11-28 Thread Ricardo Aráoz

In the Bizobj API docs I find:

lookupPKWithAdd(self, field, val)
Runs a lookup in the specified field for the desired value. If
found, returns the PK for that record. If not found, a new record is
created with the 'field' column populated with 'val', and the new
record's PK is returned. None of this affects the current dataset.

What does "None of this affects the current dataset" mean. In the 
previous sentence it says that if the record is not found "a new record 
is created". If the current dataset is not affected, where has the 
record been created?
I'll be ignoring this last sentence as it doesn't make sense, and I'll 
assume the new record is being created in the current dataset but the 
record pointer remains where it was.
But I thought I'd post it here just in case. If I'm heading for trouble 
I'd appreciate some warning.


Thanks.

___
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/52977e2f.7050...@gmail.com