diff --git a/hy_odoo/odoo.hy b/hy_odoo/odoo.hy index 714f023..a1eaafb 100644 --- a/hy_odoo/odoo.hy +++ b/hy_odoo/odoo.hy @@ -1,6 +1,6 @@ ;; -*- coding: utf-8 -*- ;; -;; Copyright 2019-2020 Fabien Bourgeois +;; Copyright 2019-2021 Fabien Bourgeois ;; ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as @@ -15,7 +15,7 @@ ;; You should have received a copy of the GNU Affero General Public License ;; along with this program. If not, see . -" Odoo macros " +" Odoo macros and helpers " (require [hy-odoo.xml [if-python2]]) (import [os [path]]) @@ -31,6 +31,10 @@ value (if (string? value) f"'{value}'" value)) (return f"('{field}', '{op}', {value})"))) +(defmacro o-mod [model-name] + "Odoo self.env model shortcut" + `(. self env [~model-name])) + (defmacro hydm [hy-domain] "Generate Odoo domain from Hy like tuple domain" (setv op (second hy-domain)