c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #28827
[Bug 803486] Re: option 'parent' can't be recognized when using widget="selection"!
Hello,
I'm closing this bug as invalid, as this is more a question on how the OpenERP framework works.
BTW, let's answer the question, see below :-)
Domain values that are written inside a view (or as a string value in
the definition of a field) are meant to be evaluated at the client side.
Therefore these may reference the fields values that are present in the
form (but only those!), as well as the parent form if there is one. A
domain in a view may look like [('partner_id', '=', parent.partner_id)],
but it cannot following relationships that are known only on server-
side, for example this will not work: [('address_id', '=',
user_id.address_id)], because at the client-side 'user_id' is just an
integer value, not a real relationship.
Now there is a specific case for selection widget, because for a normal fields.selection, the available options are known in advance and directly provided by the server in the result of fields_view_get(). So when using a widget=selection for a many2one field, the server does a pre-computation of the possible values for the many2one, in order to provide that same list of options to the client.
So in that specific case, the server will evaluate the domain of the many2one on server-side, and this happens before the view is opened, so client-side field values or 'parent' values are not available.
This is currently the way it works, by design.
In the future we may provide a different mechanism to avoid this use of
selection widgets for many2one fields, for example in v6.1 the new web
client includes a new widget for many2one that can work using dynamic
domains.
** Changed in: openobject-server
Importance: Medium => Undecided
** Changed in: openobject-server
Status: Confirmed => Invalid
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/803486
Title:
option 'parent' can't be recognized when using widget="selection"!
Status in OpenERP Server:
Invalid
Bug description:
Hi,
I think this is a bug.
In view definition of voucher_payment_receipt_form of module account_voucher, I wonder 'parent' in the code below, how openerp server can understand what parent means? I understand the meaning of this definition, but does not know how to implement this in other views. I tried but openerp reports
"NameError: name 'parent' is not defined"
===
domain="[
('account_id.type','in',('receivable','payable')),
('reconcile_id','=', False),
('partner_id','=',parent.partner_id)
]"
===
Thanks,
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/803486/+subscriptions
References