diff --git a/CHANGELOG b/CHANGELOG index 6548d897a8..7f070648f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add dynamic label +* Add prefix, suffix on tree view * Replace _constraints with validate in ModelStorage * Add selection_change_with on Selection and Reference fields * Add Dict fields diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 3e152e2951..c1837c95b9 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -159,7 +159,8 @@ Display static string. * ``string``: The string that will be displayed in the label. * ``name``: The name of the field whose description will be used for - string. + string. Except if ``string`` is set, it will use this value and the value + of the field if ``string`` is empty. * ``id``: see common-attributes-id_. @@ -491,6 +492,19 @@ field * ``completion``: see in common-attributes-completion_. +prefix or suffix +^^^^^^^^^^^^^^^^ + +A ``field`` could contain one or many ``prefix`` or ``suffix`` that will be +diplayed in the same column. + + * ``string``: The text that will be displayed. + + * ``name``: The name of the field whose value will be displayed. + + * ``icon``: The name of the field that contains the name of the icon to + display or the name of the icon. + Example ------- @@ -500,6 +514,9 @@ Example + + + diff --git a/trytond/ir/ui/tree.rnc b/trytond/ir/ui/tree.rnc index 70e0799b44..e66066dc6c 100644 --- a/trytond/ir/ui/tree.rnc +++ b/trytond/ir/ui/tree.rnc @@ -12,7 +12,7 @@ attlist.tree &= attribute sequence { text }? attlist.tree &= attribute colors { text }? attlist.tree &= [ a:defaultValue = "0" ] attribute keyword_open { "0" | "1" }? -field = element field { attlist.field, empty } +field = element field { attlist.field, (prefix | suffix)* } attlist.field &= attribute name { text } attlist.field &= attribute readonly { "0" | "1" }? attlist.field &= @@ -52,6 +52,11 @@ attlist.field &= attlist.field &= attribute float_time { text }? attlist.field &= [a:defaultValue = "0"] attribute pre_validate { "0" | "1" }? attlist.field &= [a:defaultValue = "1"] attribute completion { "0" | "1" }? +prefix = element prefix { attlist.affix, empty } +suffix = element suffix { attlist.affix, empty } +attlist.affix &= attribute string { text }? +attlist.affix &= attribute name { text }? +attlist.affix &= attribute icon { text }? button = element button { attlist.button, empty } attlist.button &= attribute help { text }? attlist.button &= diff --git a/trytond/ir/ui/tree.rng b/trytond/ir/ui/tree.rng index 5a155d1dde..5d5b1da9fa 100644 --- a/trytond/ir/ui/tree.rng +++ b/trytond/ir/ui/tree.rng @@ -54,7 +54,12 @@ - + + + + + + @@ -167,6 +172,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index abc6b09836..322eedf8b6 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -418,7 +418,8 @@ class ModelView(Model): fields_attrs = copy.deepcopy(fields_attrs) childs = True - if element.tag in ('field', 'label', 'separator', 'group'): + if element.tag in ('field', 'label', 'separator', 'group', 'suffix', + 'prefix'): for attr in ('name', 'icon'): if element.get(attr): fields_attrs.setdefault(element.get(attr), {})