Discussion:
[Erp5-dev] RelationStringField - Container Getter Method
Shresth K
2007-05-21 08:56:35 UTC
Permalink
Hello,

Can anyone please explain the use of this field in some detail:

This is what the wiki has -

"Container Getter Method :
Method called to find the container in which new object will be created if
creation is allowed."


The immediate questions which arise are:
1. What is the expected return value from the method?
2. Is it somehow possible to choose for the end-user, which container the
object will be created in provided the user has access to multiple candidate
containers?

Thanks in advance,

Shresth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20070521/30a2ed43/attachment.htm>
Romain Courteaud
2007-05-21 13:20:56 UTC
Permalink
Post by Shresth K
Hello,
Hello,
Post by Shresth K
This is what the wiki has -
Method called to find the container in which new object will be created if
creation is allowed."
1. What is the expected return value from the method?
2. Is it somehow possible to choose for the end-user, which container the
object will be created in provided the user has access to multiple candidate
containers?
Currently, this parameter is not used at all by the RelationStringField,
and was probably removed by mistake.

The expected beheviour was to return the container object, and it was
not possible for the user to choose where to create the object.
http://svn.erp5.org/?view=rev&revision=5582

Regards,
Romain
Shresth K
2007-05-21 14:53:14 UTC
Permalink
Thanks Romain. Please read below.
Post by Romain Courteaud
Currently, this parameter is not used at all by the RelationStringField,
and was probably removed by mistake.
Do you mean that it was *included* by mistake as it is present in the
current implementation and I hope it is, because I can see a use case where
it is needed.

Can you please clear the ambiguity ? Obviously I can try and test it myself.

The expected beheviour was to return the container object, and it was
Post by Romain Courteaud
not possible for the user to choose where to create the object.
http://svn.erp5.org/?view=rev&revision=5582
I just hope it still works. ;-)

Regards,
Shresth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20070521/dd8915c1/attachment.htm>
Romain Courteaud
2007-05-24 11:53:50 UTC
Permalink
Post by Shresth K
Do you mean that it was *included* by mistake as it is present in the
current implementation and I hope it is, because I can see a use case where
it is needed.
The expected beheviour was to return the container object, and it was
Post by Romain Courteaud
not possible for the user to choose where to create the object.
http://svn.erp5.org/?view=rev&revision=5582
The parameter is still present in the configuration, but not used
anymore in the current implementation (because it was removed by
mistake).

So, it currently does not work.

This feature has to be readded in the system. For preventing futur errors, a
Selenium test also needs to be written (in
http://svn.erp5.org/erp5/trunk/bt5/erp5_ui_test/PathTemplateItem/portal_tests/relation_field_zuite/),
but I don't have time for fixing it currently.

Feel free to submit a patch for the fix and the test if you already
wrote them ;)

Regards,
Romain
Shresth K
2007-05-31 07:38:57 UTC
Permalink
Had been away for a while.
Post by Romain Courteaud
Post by Shresth K
Do you mean that it was *included* by mistake as it is present in the
current implementation and I hope it is, because I can see a use case
where
Post by Shresth K
it is needed.
The expected beheviour was to return the container object, and it was
Post by Romain Courteaud
not possible for the user to choose where to create the object.
http://svn.erp5.org/?view=rev&revision=5582
The parameter is still present in the configuration, but not used
anymore in the current implementation (because it was removed by
mistake).
So, it currently does not work.
This feature has to be readded in the system. For preventing futur errors, a
Selenium test also needs to be written (in
http://svn.erp5.org/erp5/trunk/bt5/erp5_ui_test/PathTemplateItem/portal_tests/relation_field_zuite/
),
but I don't have time for fixing it currently.
Feel free to submit a patch for the fix and the test if you already
wrote them ;)
I haven't yet written any tests or patch as I was in the process of
understanding the use case better. As of now this definitely is needed and
as confirmed by you that it was there, I shall put it as a future todo. As I
am still learning the system, I don't have an insight to the extent that I
can make such modifications. Hence I was searching for the revision in which
any related implementation was reverted back but got none. May be I need to
look harder to find something related or if anyone can help, you are most
welcome.

Herein is the use case that I have analysed and would request you to give
your opinion on it:
A sales manager may be responsible for 2 regions - A & B
All modules exist for all regions such as Person Module A, Person Module B,
Organisation Module A, Organisation Module B to ensure access and visibility
based on region.
There are 2 sales modules - Sales-Asia, Sales-Europe
Now while creating a Sales Order, if he/she needs to create a new
Person/Organisation through the RelationStringField(while setting the
source/destination), the existing implementation has no way to know in which
module to create the new object. For e.g: Should it be Organisation Module A
or Organisation Module B
In this scenario, I find the Container Getter Method invaluable. If the
object is being created in the context of Sales Module A then the method can
decide that the object must be in {Person, Organisation} A .


Thanks,
Shresth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20070531/1c7fca82/attachment.htm>
Loading...