On 11/22/2013 01:04 PM, Ricardo Aráoz wrote:
El 22/11/13 15:34, John Fabiani escribió:
On 11/22/2013 10:24 AM, Ricardo Aráoz wrote:
I have "*Persona*" Bizobj defined with VirtualField "*FullName*":
        self.DataStructure = (
                ("Id", "I", True, "Persona", "Id"),
                ("Codigo", "C", False, "Persona", "Codigo"),
                ("CUIT", "C", False, "Persona", "CUIT"),
                ("Nombre", "C", False, "Persona", "Nombre"),
                ("Apellido", "C", False, "Persona", "Apellido"),
                ("CondIVAId", "I", False, "Persona", "CondIVAId"),
                ("CondIVA", "C", False, "condiva", "CondicionIVA"),
*                ("FullName", "C", False, None, "FullName"),*
        )
...
    def afterInit(self):
        super(Persona, self).afterInit()
        self.addJoin('condiva',
                     'condiva.Id = Persona.CondIVAId',
                     'left')
*        self.VirtualFields = {'FullName': self.getFullName}*


Now I have "*Proveedor*" Bizobj from which I'd like to reference *Persona.Fullname*:
        self.DataStructure = (
                ("Id", "I", True, "Proveedor", "Id"),
                ("PersonaId", "I", False, "Proveedor", "PersonaId"),
                ("LetraId", "I", False, "Proveedor", "LetraId"),
                ("CuentaId", "I", False, "Proveedor", "CuentaId"),
("ConcptoImputac", "C", False, "Proveedor", "ConcptoImputac"),
*                ("Nombre", "I", False, "Persona", "FullName"),*
                ("Letra", "I", False, "Letra", "Letra"),
                ("Cuenta", "I", False, "cuenta", "Nombre"),
        )
...
    def afterInit(self):
        super(Proveedor, self).afterInit()
*        self.addJoin('persona',**
**                     'persona.Id = Proveedor.PersonaId',**
**                     'left')*
        self.addJoin('letra',
                     'letra.Id = Proveedor.LetraId',
                     'left')
        self.addJoin('cuenta',
                     'cuenta.Id = Proveedor.CuentaId',
                     'left')

and I get the following error message (this is datanav) :
2013-11-22 15:17:55 - ERROR - Ejecución en la base de datos falló con respuesta: DBQueryException encountered in execute(): no such column: Persona.FullName

It would be nice to be able to access the VirtualField directly instead of having to define it again in this Bizobj.



I would not consider that an issue with the framework. You have to identify each field in the model and the same is true for fields from joins or virtuals. I normal do set the datastucture and just define the bizobj. See example:

class WarehousepwcontnrBizobj(dabo.biz.dBizobj):

    def afterInit(self):
        self.DataSource = "warehouse.pwcontnr"
        self.KeyField = "pkid"
        self.addFrom("warehouse.pwcontnr")
        self.addField("pwcontnr.loblreq")
        self.addField("pwcontnr.fk_voyage")
        self.addField("pwcontnr.fk_importer")
...
        self.addField("pwcontnr.chep_pallets")
        #self.addField("trailertype")
        #self.addField("pwcntype.cdesc")
#self.addJoin('warehouse.pwcntype', 'pwcontnr.fk_cnttype = pwcntype.pkid', joinType='Left')
        self.NonUpdateFields=["pwcontnr.pkid"]
        self.DefaultValues={'fk_cnttype':1,'ntemptype':3}
        self.VirtualFields = {"trailertype": self.trailerType}


It make life a little easier in my mind.

I didn't mean to imply that there was an issue with the framework (though I probably did, bear in mind English is not my native language), this has not been an issue to me. I was just saying it would be nice because you wouldn't have to duplicate your code, now I am having to define the value of a Virtual field not only in the original Bizobj but in any other Bizobj that will use it. Not a big problem though and I'm sure I'll find a way of extracting the VirtualField definition from the Bizobjects and placing it elsewhere so as not to repeat my code.



Sorry about that - I did not pick up on the fact you were asking for an enhancement.


Johnf

_______________________________________________
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/528ff68b.4020...@jfcomputer.com

Reply via email to