fixup! [erp5_crm] Activate actions for ERP5JS
-
Owner
I also noticed this bug and I was working on fixing it. At the moment I am still updating the tests, so that we have test coverage for this also in erp5_xhtml_style.
I was wondering how to fix,
Base_renderForm
supports akeep_items
argument that would also work for erp5_xhtml_style, but not for ERP5JS.The description of
keep_items
does not seem correct, so I'm a bit confused here.> :param keep_items: {dict} items to be available in the next call. They will be either added as hidden fields to the > rendered form or in case of "portal_status_message" just displayed to the user
/cc @romain
-
mentioned in merge request !1397 (merged)
-
Owner
At the moment I am still updating the tests, so that we have test coverage for this also in erp5_xhtml_style.
see !1397 (merged)
-
Owner
Hum. It is a bit hard for me to believe xhtml was broken without doing
request.set
, as I probably manually tested it. And I said to people to userequest.form
in their fast input to be compatible with both UI, and I heard it was correctly working like this.Doing both ways as is will only lead to not maintainable code. We should introduce an API to stop directly modifying the REQUEST and use it everywhere. Modifying the REQUEST directly must be a coding crime.
-
Owner
Thanks !
It's also a bit mysterious for me.
Event_viewCreateResponseDialog
/Event_updateCreateResponse
have the same logic of usingrequest.form
, but it works there. This seem to be depending on the "Form enctype" from the dialog's Settings in ZMI. When it's set tomultipart/form-data
this trick only work withrequest.set(k, v)
, but notrequest.form[k] = v
(edit: in legacy UI). This behaviour might be something new. I thought both ways were equivalent.I like this idea of having a higher level API and
keep_items
seems to be OK for this. So the usage here would be something like this, right ?keep_items = { 'your_notification_message': '', 'your_title': title, 'your_text_content': temp_event.getTextContent(), 'your_content_type': temp_event.getContentType(), 'your_resource': temp_event.getResource(), } return context.Base_renderForm(dialog_id, keep_items=keep_items)
-
Owner
Yes. It seems much cleaner like this.
We should probably add new tests reproducing the different "Form enctype" configurations on a Foo document to ensure
Base_renderForm
will work in both UI. -
Owner
Thanks. I don't think I can work on this in the short time, but at least we have an API.
About "Form enctype", it reminds me we have this guideline erp5-Guideline.Set.Form.Enctype.To.Multipart.Form-data.When.Using.File.Uploads
The form enctype is multipart/form-data ( actually only important if you have file uploads )
the first module guidelines was saying "always use
multipart/form-data
". We added "only with file uploads", probably because we did not want to change all the forms. I don't really know what would be wrong to always usemultipart/form-data
.Anyway, for a first step, having a test for each enctype might be the best
-
Owner
Please add the crm tests for xhtml and keep the scripts as is for now if enough.
Thanks, the tests are in !1397 (merged) I'll finalize it as we discussed tomorrow.
-
mentioned in merge request !1414 (merged)