[ADD]Odoo macros : new o-mod for self.env['model']
This commit is contained in:
parent
24fe4e1cb3
commit
ca9d06d1dc
@ -1,6 +1,6 @@
|
||||
;; -*- coding: utf-8 -*-
|
||||
;;
|
||||
;; Copyright 2019-2020 Fabien Bourgeois <fabien@yaltik.com>
|
||||
;; Copyright 2019-2021 Fabien Bourgeois <fabien@yaltik.com>
|
||||
;;
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
" 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user