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

[views] Attempt to display inherited rule if there is no rule defined at some level

Closes extranet #14593198
parent bfe6130e62b5
......@@ -4756,6 +4756,9 @@ msgstr ""
msgid "import_unit"
msgstr ""
msgid "inherited value"
msgstr ""
msgid "juridictional"
msgstr ""
......@@ -4775,6 +4775,9 @@ msgstr ""
msgid "import_unit"
msgstr "unité d'archive du référentiel"
msgid "inherited value"
msgstr "valeur héritée"
msgid "juridictional"
msgstr "juridication administrative"
......@@ -23,7 +23,7 @@ from logilab.mtconverter import xml_escape
from cubicweb.predicates import is_instance
from cubicweb.web import INTERNAL_FIELD_VALUE
from cubicweb.web.views import uicfg
from cubicweb.web.views import reledit, uicfg
from ..entities import parent_and_container, rule_type_from_etype
from . import viewlib
......@@ -180,3 +180,18 @@ class ClassificationRuleComplexLinkEntityAttributeView(RuleComplexLinkEntityAttr
need_human = _('without human intervention')
super(ClassificationRuleComplexLinkEntityAttributeView, self).entity_call(entity)
class MgmtRuleAutoClickAndEditFormView(reledit.AutoClickAndEditFormView):
__select__ = (reledit.AutoClickAndEditFormView.__select__
& is_instance('SEDASeqAltArchiveUnitArchiveUnitRefIdManagement'))
def _compute_default_value(self, rschema, role):
if rschema.type.endswith('_rule'):
rule_type = rschema.type[len('seda_'):-len('_rule')]
rule = self.entity.inherited_rule(rule_type)
if rule:
return rule.view('seda.reledit.text') + u'<p><mark>{}</mark></p>'.format(
self._cw._(u'inherited value'))
return super(MgmtRuleAutoClickAndEditFormView, self)._compute_default_value(
rschema, role)
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