← Back to team overview

openerp-expert-framework team mailing list archive

OpenERP introspectability

 

Hello OpenERP framework experts,


I'm currently improving OOOR http://github.com/rvalyi/ooor a bit. I'm
injecting the new ActiveModel Rails 3 interfaces to bring extra client side
power. For instance ActiveModel validations
http://api.rubyonrails.org/classes/ActiveModel/Validations.html

So for each OpenERP object, I want for instance to know which are the
required fields, this way OOOR will report missing fields errors without
even hitting OpenERP and will display nicely automagically in Rails 3 forms.

This almost work, but here is an issue is with OpenERP many2one fields that
are used as the association key for the _inherits feature of OpenERP,
indeed, for instance, the product_tmpl_id fields of product.product is
flagged as required in OpenERP.

Indeed, if you you look at product_tmpl_id, it's actually never required in
any client form (unless you install the product_variant_multi module)
because it's created along with the product_product record.
So what is the point in making it required of actually, it will be filled
automatically? I don't want to have it as required in OOOR if it's not
really required...
Of course, I could base the fields I requires upon specific views like the
GTK or web client, but I feel that the view layer should be an optional a
extra layer that should be made a dependency of the object layer...

So should we remove the required=True for the _inherits keys? (I doubt
personally)
Alternatively shouldn't we expose to the client that at some point those
fields are special and they might not be really required?
Is there already some way to find it out for a client that some many2one
field is actually an _inherits field?

Thank you for your answer, I hope we can find a workaround for this before
OpeERP 6.0, as it could bring lot's of power if clients could better
introspect OpenERP models.
BTW, I'll also propose a small merge that expose available object methods
and their signatures.


-- 
Raphaël Valyi
Founder and consultant
+55 21 3010 9965
www.akretion.com