changeset d8ec7b7a2023 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=d8ec7b7a2023
description:
        Add creatable attribute on tree and form views

        issue10929
        review370201002
diffstat:

 CHANGELOG                  |   1 +
 doc/topics/views/index.rst |   6 ++++++
 trytond/ir/ui/form.rnc     |   2 ++
 trytond/ir/ui/form.rng     |  11 +++++++++++
 trytond/ir/ui/tree.rnc     |   2 ++
 trytond/ir/ui/tree.rng     |  11 +++++++++++
 6 files changed, 33 insertions(+), 0 deletions(-)

diffs (97 lines):

diff -r f23258f69504 -r d8ec7b7a2023 CHANGELOG
--- a/CHANGELOG Thu Dec 16 22:12:42 2021 +0100
+++ b/CHANGELOG Thu Dec 16 22:26:04 2021 +0100
@@ -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 -r f23258f69504 -r d8ec7b7a2023 doc/topics/views/index.rst
--- a/doc/topics/views/index.rst        Thu Dec 16 22:12:42 2021 +0100
+++ b/doc/topics/views/index.rst        Thu Dec 16 22:26:04 2021 +0100
@@ -204,6 +204,9 @@
         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 @@
 
     * ``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 -r f23258f69504 -r d8ec7b7a2023 trytond/ir/ui/form.rnc
--- a/trytond/ir/ui/form.rnc    Thu Dec 16 22:12:42 2021 +0100
+++ b/trytond/ir/ui/form.rnc    Thu Dec 16 22:26:04 2021 +0100
@@ -16,6 +16,8 @@
      | 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 -r f23258f69504 -r d8ec7b7a2023 trytond/ir/ui/form.rng
--- a/trytond/ir/ui/form.rng    Thu Dec 16 22:12:42 2021 +0100
+++ b/trytond/ir/ui/form.rng    Thu Dec 16 22:26:04 2021 +0100
@@ -32,6 +32,17 @@
   </define>
   <define name="attlist.form" combine="interleave">
     <optional>
+      <attribute a:defaultValue="1">
+        <name ns="">creatable</name>
+        <choice>
+          <value>0</value>
+          <value>1</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <define name="attlist.form" combine="interleave">
+    <optional>
       <attribute a:defaultValue="4">
         <name ns="">col</name>
         <text/>
diff -r f23258f69504 -r d8ec7b7a2023 trytond/ir/ui/tree.rnc
--- a/trytond/ir/ui/tree.rnc    Thu Dec 16 22:12:42 2021 +0100
+++ b/trytond/ir/ui/tree.rnc    Thu Dec 16 22:26:04 2021 +0100
@@ -6,6 +6,8 @@
   }
 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 -r f23258f69504 -r d8ec7b7a2023 trytond/ir/ui/tree.rng
--- a/trytond/ir/ui/tree.rng    Thu Dec 16 22:12:42 2021 +0100
+++ b/trytond/ir/ui/tree.rng    Thu Dec 16 22:26:04 2021 +0100
@@ -35,6 +35,17 @@
   </define>
   <define name="attlist.tree" combine="interleave">
     <optional>
+      <attribute a:defaultValue="1">
+        <name ns="">creatable</name>
+        <choice>
+          <value>0</value>
+          <value>1</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <define name="attlist.tree" combine="interleave">
+    <optional>
       <attribute>
         <name ns="">sequence</name>
         <text/>

Reply via email to