[IMP]Hy Base : new macro for server actions

This commit is contained in:
Fabien BOURGEOIS 2019-09-17 16:39:58 +02:00
parent ba839855bd
commit 98c26fdbec
1 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,15 @@
(ox-field-inherit ~inherit)
(ox-field-arch ~@body)])))
(defmacro ox-actions-server-code [xmlid name modelref code]
"Server actions of type code"
`(do
(ox-record {"id" ~xmlid "model" "ir.actions.server"}
[(ox-field-name ~name)
(ox-field {"name" "model_id" "ref" ~modelref} [])
(ox-field {"name" "state"} ["code"])
(ox-field {"name" "code"} #[[~code]])])))
(defmacro ox-field [&rest args] `(xmlna "field" ~@args))
(defmacro ox-field-name [name] `(ox-field {"name" "name"} [~name]))
(defmacro ox-field-model [model] `(ox-field {"name" "model"} [~model]))