I need to create an object (archetypes) from the View of the second object ( object2 - which is not the parent of the new object). It must be pre-populated with data from the Request and from object2 .
A simple solution would seem to be to use "default_method" in the schema fields, and this might work for the data from the request, but I do not believe that I have access to the view from there and therefore not to object2 . In any case, one of the fields is the ReferenceField for object2 , and I read that the ReferenceField ignores the "default_method".
Another option is to create it inside portal_factory, set its default values, and then display the add page, allowing the user to change the content as needed or exit without actually creating the object. Absolutely, in addition, from the many methods available for creating an object ( invokeFactory() , _createObjectByType() , _constructInstance() and createObject() , which I know), only createObject actually leaves the object in portal_factory - and since it only returns a string ( The URL of the Add page object) will not accept keyword arguments and does not seem to notify of any events (of course, not IObjectCreatedEvent), I donβt see how to change this using my data before directing the user to the page editing.
source share