[PATCH 2 of 3 saem_ref] [seda] Hide seda_transferring_agency_archive_unit_identifier from archive unit form/view

Denis Laxalde denis.laxalde at logilab.fr
Wed Mar 21 12:07:51 CET 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1521628096 -3600
#      Wed Mar 21 11:28:16 2018 +0100
# Node ID 1493be198e6ea62a2dd653f01085464c7383c9fd
# Parent  232729eff9880f8b688c71dfb81a7fc71418c623
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 1493be198e6e
# EXP-Topic seda-TransferringAgencyArchiveIdentifier
[seda] Hide seda_transferring_agency_archive_unit_identifier from archive unit form/view

We want the value of "identifiant pour le service versant" to be hidden
from archive unit view and form so that it can later automatically
inserted with an empty value in SEDA exports (RNG 0.2 and XSD).

(CONSEJIRA-445)

diff --git a/cubicweb_saem_ref/views/seda.py b/cubicweb_saem_ref/views/seda.py
--- a/cubicweb_saem_ref/views/seda.py
+++ b/cubicweb_saem_ref/views/seda.py
@@ -17,7 +17,12 @@
 
 from cubicweb.web.views import uicfg
 
-from cubicweb_seda.views import archivetransfer
+from cubicweb_seda.views import (
+    CONTENT_ETYPE,
+    archivetransfer,
+    archiveunit,
+    rtags_from_rtype_role_targets,
+)
 
 
 afs = uicfg.autoform_section
@@ -38,3 +43,19 @@ afs.tag_attribute(('SEDABinaryDataObject
 
 
 archivetransfer.ArchiveTransferTabbedPrimaryView.tabs.append('saem.lifecycle_tab')
+
+
+# Hide "identifiant pour le service versant" which should be automatically
+# filled.
+class SimplifiedContentMainView(archiveunit.SimplifiedContentMainView):
+
+    rtype_role_targets = archiveunit.SimplifiedContentMainView.rtype_role_targets[:]
+    rtype_role_targets.remove(
+        ('seda_transferring_agency_archive_unit_identifier', 'object', None)
+    )
+    rsection, display_ctrl = rtags_from_rtype_role_targets(CONTENT_ETYPE, rtype_role_targets)
+
+
+def registration_callback(vreg):
+    vreg.register_all(globals().values(), __name__, [SimplifiedContentMainView])
+    vreg.register_and_replace(SimplifiedContentMainView, archiveunit.SimplifiedContentMainView)



More information about the saem-devel mailing list