From ca372a24eca6acfd2011faf6c500adf4414b5380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 11 Oct 2021 22:53:02 +0200 Subject: [PATCH] Support create/delete attribute in view issue10840 review377341002 --- CHANGELOG | 1 + doc/topics/views/index.rst | 8 ++++++++ trytond/ir/ui/form.rnc | 4 ++++ trytond/ir/ui/form.rng | 22 ++++++++++++++++++++++ trytond/ir/ui/tree.rnc | 4 ++++ trytond/ir/ui/tree.rng | 22 ++++++++++++++++++++++ 6 files changed, 61 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b700e025e6..ffdda448c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Support create/delete attribute in view * Skip default values when copying records * Use global cache for Function fields in readonly transactions * Add format method to DictSchemaMixin diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 08565e0a3a..2cda359452 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -154,6 +154,14 @@ List of attributes shared by many form elements: :class:`trytond.model.fields.One2Many` to specifiy if the client must auto-complete the field. The default value is True. + .. _common-attributes-create: + + * ``create``: A boolean to specify if the user can create targets from the + widget. The default value is ``True``. + + * ``delete``: A boolean to specify if the user can delete targets from the + widget. The default value is ``True``. + .. _common-attributes-factor: * ``factor``: A factor to apply on fields diff --git a/trytond/ir/ui/form.rnc b/trytond/ir/ui/form.rnc index ebab9de218..f408ac7df4 100644 --- a/trytond/ir/ui/form.rnc +++ b/trytond/ir/ui/form.rnc @@ -90,6 +90,10 @@ attlist.field &= attribute view_ids { text }? attlist.field &= attribute product { text }? attlist.field &= [ a:defaultValue = "0" ] attribute invisible { "0" | "1" }? +attlist.field &= + [ a:defaultValue = "1" ] attribute create { "0" | "1" }? +attlist.field &= + [ a:defaultValue = "1" ] attribute delete { "0" | "1" }? attlist.field &= [ a:defaultValue = "left_to_right" ] attribute orientation { "left_to_right" diff --git a/trytond/ir/ui/form.rng b/trytond/ir/ui/form.rng index 2047923bad..8a1e34f601 100644 --- a/trytond/ir/ui/form.rng +++ b/trytond/ir/ui/form.rng @@ -380,6 +380,28 @@ + + + + create + + 0 + 1 + + + + + + + + delete + + 0 + 1 + + + + diff --git a/trytond/ir/ui/tree.rnc b/trytond/ir/ui/tree.rnc index f4199cc61d..13ee7886a2 100644 --- a/trytond/ir/ui/tree.rnc +++ b/trytond/ir/ui/tree.rnc @@ -51,6 +51,10 @@ attlist.field &= attribute icon { text }? attlist.field &= attribute sum { text }? attlist.field &= attribute width { text }? attlist.field &= attribute height { text }? +attlist.field &= + [ a:defaultValue = "1" ] attribute create { "0" | "1" }? +attlist.field &= + [ a:defaultValue = "1" ] attribute delete { "0" | "1" }? attlist.field &= [ a:defaultValue = "left_to_right" ] attribute orientation { "left_to_right" diff --git a/trytond/ir/ui/tree.rng b/trytond/ir/ui/tree.rng index c53029102c..299e9e6ece 100644 --- a/trytond/ir/ui/tree.rng +++ b/trytond/ir/ui/tree.rng @@ -189,6 +189,28 @@ + + + + create + + 0 + 1 + + + + + + + + delete + + 0 + 1 + + + +