From 0b592275a9d511ba5af66cb303b0458581ca8f2c Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 18 Sep 2019 21:10:00 +0200 Subject: [PATCH] [IMP]Hy Base : new odoo macros --- hy_base/odoo.hy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hy_base/odoo.hy b/hy_base/odoo.hy index 50af04e..26da7cd 100644 --- a/hy_base/odoo.hy +++ b/hy_base/odoo.hy @@ -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]))