[ADD]Odoo hydict macro

This commit is contained in:
Fabien BOURGEOIS 2021-02-18 19:25:04 +01:00
parent 1a44194047
commit 34510b8c7a
1 changed files with 12 additions and 0 deletions

View File

@ -43,6 +43,18 @@
value (nth hy-domain 3))
`(, ~field ~op ~value))
(defmacro hydict [dic]
"Generate dict with mangled keys, from HyDict list"
(setv mangled-dic
(list
(map
(fn [pair]
(if (even? (nth pair 0))
(mangle (nth pair 1))
(nth pair 1)))
(enumerate dic))))
`{~@mangled-dic})
; XML helpers functions and macros
(defn odoo [&rest args] (xmlroot (xmln "odoo" {} #*args)))