From 217a64ab68018f32276314aedc89bb821b547e28 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Tue, 17 Sep 2019 16:39:58 +0200 Subject: [PATCH] [IMP]Hy Base : new macro for server actions --- hy_base/odoo.hy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hy_base/odoo.hy b/hy_base/odoo.hy index 02ab982..44554f9 100644 --- a/hy_base/odoo.hy +++ b/hy_base/odoo.hy @@ -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]))