diff --git a/CHANGELOG b/CHANGELOG index 36f6a815df..f5641ee566 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add creatable attribute on tree and form views * Fill local cache of Function field instances with values * Cache Function field getter without context in readonly transactions * Use expire delay instead of UTC datetime in reset password email diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 2cda359452..e9ef7c3d89 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -204,6 +204,9 @@ Each form view must start with this tag. The method must be registered in :attr:`trytond.model.Model.__rpc__`. .. + * ``creatable``: A boolean to specify if the form can be used to create new + record. The default value is ``true``. + * ``col``: see in common-attributes-col_. * ``cursor``: The name of the field that must have the cursor by default. @@ -586,6 +589,9 @@ Each tree view must start with this tag. * ``editable``: A boolean to specify if the list is editable. + * ``creatable``: A boolean to specify if the editable list can be used to + create new record. The default value is ``true``. + * ``sequence``: The name of the field that is used for sorting. This field must be an integer and it will be updated to match the new sort order when the user uses ``Drag and Drop`` on list rows. diff --git a/trytond/ir/ui/form.rnc b/trytond/ir/ui/form.rnc index f408ac7df4..3953e4eb30 100644 --- a/trytond/ir/ui/form.rnc +++ b/trytond/ir/ui/form.rnc @@ -16,6 +16,8 @@ form = | vpaned)* } attlist.form &= attribute on_write { text }? +attlist.form &= + [ a:defaultValue = "1" ] attribute creatable { "0" | "1" }? attlist.form &= [ a:defaultValue = "4" ] attribute col { text }? attlist.form &= attribute cursor { text }? diff --git a/trytond/ir/ui/form.rng b/trytond/ir/ui/form.rng index 8a1e34f601..b5951f54c4 100644 --- a/trytond/ir/ui/form.rng +++ b/trytond/ir/ui/form.rng @@ -30,6 +30,17 @@ + + + + creatable + + 0 + 1 + + + + diff --git a/trytond/ir/ui/tree.rnc b/trytond/ir/ui/tree.rnc index 13ee7886a2..9e52bfce41 100644 --- a/trytond/ir/ui/tree.rnc +++ b/trytond/ir/ui/tree.rnc @@ -6,6 +6,8 @@ tree = element tree { attlist.tree, } attlist.tree &= attribute on_write { text }? attlist.tree &= attribute editable { "0" | "1" }? +attlist.tree &= + [ a:defaultValue = "1" ] attribute creatable { "0" | "1" }? attlist.tree &= attribute sequence { text }? attlist.tree &= [ a:defaultValue = "0" ] attribute keyword_open { "0" | "1" }? diff --git a/trytond/ir/ui/tree.rng b/trytond/ir/ui/tree.rng index 299e9e6ece..adf69b98d9 100644 --- a/trytond/ir/ui/tree.rng +++ b/trytond/ir/ui/tree.rng @@ -33,6 +33,17 @@ + + + + creatable + + 0 + 1 + + + +