[IMP]Hy Base : new odoo macros

This commit is contained in:
Fabien BOURGEOIS 2019-09-18 21:10:00 +02:00
parent b61c49d1e6
commit 0b592275a9

View File

@ -29,6 +29,15 @@
(defmacro ox-odoo [&rest args] `(xmlr "odoo" ~@args))
(defmacro ox-data [&rest args] `(xmlnc "data" ~@args))
(defmacro ox-record [&rest args] `(xmlnc "record" ~@args))
(defmacro ox-form [&rest args] `(xmlnc "form" ~@args))
(defmacro ox-tree [&rest args] `(xmlnc "tree" ~@args))
(defmacro ox-search [&rest args] `(xmlnc "search" ~@args))
(defmacro ox-act-window [&rest args] `(xmlna "act_window" ~@args))
(defmacro ox-group [&rest args] `(xmlnc "group" ~@args))
(defmacro ox-header [&rest args] `(xmlnc "header" ~@args))
(defmacro ox-footer [&rest args] `(xmlnc "footer" ~@args))
(defmacro ox-button [&rest args] `(xmlna "button" ~@args))
(defmacro ox-p [&rest args] `(xmlnc "p" ~@args))
(defmacro ox-view [xmlid children] `(ox-record {"id" ~xmlid "model" "ir.ui.view"} ~children))
(defmacro ox-view-def [xmlid name model &rest body]
@ -60,6 +69,17 @@
(ox-field {"name" "state"} ["code"])
(ox-field {"name" "code"} [~code])])))
(defmacro ox-client-action-multi [xmlid name model action]
"Client action multi (ir.values), with own xmlid, name, targeted model and
action"
(setv action f"'ir.actions.server,%d'%{action}")
`(do
(ox-record {"id" ~xmlid "model" "ir.values"}
[(ox-field-name ~name)
(ox-field {"name" "key2" "eval" "'client_action_multi'"} [])
(ox-field {"name" "model" "eval" (+ "'" ~model "'")} [])
(ox-field {"name" "value" "eval" ~action})])))
(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]))