Commit efd1bd24 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

Fix detection of SEDAStartDate within the context of an archive unit

in which case we want the cardinality to be editable. To fix this, we've to
consider inlined creation view's "petype" parameter. This has probably not be
necessary until now becase SEDAStartDate wasn't until recently editable at
entity creation time.

Closes #17084051
parent 0d8167d5a77e
......@@ -58,12 +58,12 @@ class StartDateAutomaticEntityForm(autoform.AutomaticEntityForm):
attributes = super(StartDateAutomaticEntityForm, self).editable_attributes(strict)
if self.linked_to.get(('seda_start_date', 'subject')):
eid = self.linked_to[('seda_start_date', 'subject')][0]
start_date_of = self._cw.entity_from_eid(eid)
start_date_of = self._cw.entity_from_eid(eid).cw_etype
elif self.edited_entity.has_eid():
start_date_of = self.edited_entity.seda_start_date[0]
start_date_of = self.edited_entity.seda_start_date[0].cw_etype
start_date_of = None
if start_date_of is None or start_date_of.cw_etype != CONTENT_ETYPE:
start_date_of = self.cw_extra_kwargs.get('petype')
if start_date_of != CONTENT_ETYPE:
attributes.remove(('user_cardinality', 'subject'))
return attributes
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment