Add dynamic label and prefix, suffix on tree view
review689003
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
<tree string="Taxes" sequence="sequence">
|
||||
<field name="name"/>
|
||||
<field name="percentage">
|
||||
<suffix string="%"/>
|
||||
</field>
|
||||
<field name="group"/>
|
||||
<field name="type"/>
|
||||
<field name="active"/>
|
||||
|
||||
@@ -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 &=
|
||||
|
||||
+33
-1
@@ -54,7 +54,12 @@
|
||||
<define name="field">
|
||||
<element name="field">
|
||||
<ref name="attlist.field"/>
|
||||
<empty/>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<ref name="prefix"/>
|
||||
<ref name="suffix"/>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
<define name="attlist.field" combine="interleave">
|
||||
@@ -167,6 +172,33 @@
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="prefix">
|
||||
<element name="prefix">
|
||||
<ref name="attlist.affix"/>
|
||||
<empty/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="suffix">
|
||||
<element name="suffix">
|
||||
<ref name="attlist.affix"/>
|
||||
<empty/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="attlist.affix" combine="interleave">
|
||||
<optional>
|
||||
<attribute name="string"/>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="attlist.affix" combine="interleave">
|
||||
<optional>
|
||||
<attribute name="name"/>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="attlist.affix" combine="interleave">
|
||||
<optional>
|
||||
<attribute name="icon"/>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="button">
|
||||
<element name="button">
|
||||
<ref name="attlist.button"/>
|
||||
|
||||
@@ -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), {})
|
||||
|
||||
Reference in New Issue
Block a user