[gen] Added a new hook in the object creation algorithm: 'onEditEarly', called before an object being created is linked to its initiator object. Indeed, 'onEdit' is called after the link has been done, and sometimes, the linking may need some information that must be set before calling onEdit, thus via this new method onEditEarly.
This commit is contained in:
parent
1ed4f0bf23
commit
4577855d60
|
@ -97,16 +97,20 @@ class BaseMixin:
|
||||||
# Keep in history potential changes on historized fields
|
# Keep in history potential changes on historized fields
|
||||||
obj.historizeData(previousData)
|
obj.historizeData(previousData)
|
||||||
|
|
||||||
|
# Call the custom "onEditEarly" if available. This method is called
|
||||||
|
# *before* potentially linking the object to its initiator.
|
||||||
|
appyObject = obj.appy()
|
||||||
|
if created and hasattr(appyObject, 'onEditEarly'):
|
||||||
|
appyObject.onEditEarly()
|
||||||
|
|
||||||
# Manage potential link with an initiator object
|
# Manage potential link with an initiator object
|
||||||
if created and initiator:
|
if created and initiator:
|
||||||
initiator.appy().link(initiatorField.name, obj.appy())
|
initiator.appy().link(initiatorField.name, appyObject)
|
||||||
|
|
||||||
# Call the custom "onEdit" if available
|
# Call the custom "onEdit" if available
|
||||||
msg = None # The message to display to the user. It can be set by onEdit
|
msg = None # The message to display to the user. It can be set by onEdit
|
||||||
if obj.wrapperClass:
|
if hasattr(appyObject, 'onEdit'): msg = appyObject.onEdit(created)
|
||||||
appyObject = obj.appy()
|
|
||||||
if hasattr(appyObject, 'onEdit'):
|
|
||||||
msg = appyObject.onEdit(created)
|
|
||||||
# Update last modification date
|
# Update last modification date
|
||||||
if not created:
|
if not created:
|
||||||
from DateTime import DateTime
|
from DateTime import DateTime
|
||||||
|
|
Loading…
Reference in a new issue