Discussion:
[Erp5-dev] Programatically rendering documents
Jacek Medrzycki
2007-10-18 09:37:19 UTC
Permalink
Hi.

When I call an ERP5 object, I get the html representing the rendered
view of the object. The code is similar to the following:

obj = portal.restrictedTraverse(object_path)
html_repr = obj()

and here html_repr contains html code.

It works for almost all Portal Types, except for Payment Transaction, in
which case html_repr is like following:
http://localhost/erp5/accounting_module/9/view?portal_status_message=Accounting%20Transaction%20Line%20added.&selection_index:int=0&selection_name=

This looks like a kind of redirect. The "portal_status_message" part
sugggests that Transaction Line was created and, indeed, it was! But
why? Shouldn't a object_view action be called when an object is called?
Why the Transaction Line is beeing created? No object_view action
creates Transaction Line, as I see. How can I render programatically the
Payment Transaction?

TIA
Jacek
Jean-Paul Smets
2007-10-18 11:07:17 UTC
Permalink
Post by Jacek Medrzycki
Hi.
When I call an ERP5 object, I get the html representing the rendered
obj = portal.restrictedTraverse(object_path)
html_repr = obj()
and here html_repr contains html code.
This behaviour is not garanteed. For example, File behaves differently.
You can not rely on the fact that obj() will render the default view of
an object.
Use instead
obj.view()

BTW, using abbreviations is not conformant to ERP5 naming conventions.

obj -> object
html_repr -> html_representation

Please refer to naming conventsion for explanation.
Post by Jacek Medrzycki
It works for almost all Portal Types, except for Payment Transaction, in
http://localhost/erp5/accounting_module/9/view?portal_status_message=Accounting%20Transaction%20Line%20added.&selection_index:int=0&selection_name=
No idea for this one. Anyway, calling __call__ is not the appropriate way.
Can you please try view() instead. Based on the results, I may search
for you what is going on.
Post by Jacek Medrzycki
This looks like a kind of redirect. The "portal_status_message" part
sugggests that Transaction Line was created and, indeed, it was! But
why? Shouldn't a object_view action be called when an object is called?
Why the Transaction Line is beeing created? No object_view action
creates Transaction Line, as I see. How can I render programatically the
Payment Transaction?
TIA
Jacek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://mail.nexedi.com/mailman/listinfo/erp5-dev
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Continue reading on narkive:
Search results for '[Erp5-dev] Programatically rendering documents' (Questions and Answers)
5
replies
how to access Internet throw mobile phone to PC? pls tell me names of mobiles?
started 2007-03-13 04:14:49 UTC
internet
Loading...