[IMP]Hy base : namespace Odoo DSL
This commit is contained in:
parent
a4a4539528
commit
e2796dc29b
@ -19,36 +19,36 @@
|
||||
|
||||
(require [odoo.addons.hy_base.xml [*]])
|
||||
|
||||
(defmacro odoo [&rest args] `(xmlr "odoo" ~@args))
|
||||
(defmacro data [&rest args] `(xmlnc "data" ~@args))
|
||||
(defmacro record [&rest args] `(xmlnc "record" ~@args))
|
||||
(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 view [xmlid children] `(record {"id" ~xmlid "model" "ir.ui.view"} ~children))
|
||||
(defmacro view-def [xmlid name model &rest body]
|
||||
(defmacro ox-view [xmlid children] `(ox-record {"id" ~xmlid "model" "ir.ui.view"} ~children))
|
||||
(defmacro ox-view-def [xmlid name model &rest body]
|
||||
"View and first fields simplification with record xmlid, name, targeted model"
|
||||
`(do
|
||||
(view ~xmlid
|
||||
[(field-name ~name)
|
||||
(field-model ~model)
|
||||
(field-arch ~@body)])))
|
||||
(defmacro view-inherit [name model inherit &rest body]
|
||||
(ox-view ~xmlid
|
||||
[(ox-field-name ~name)
|
||||
(ox-field-model ~model)
|
||||
(ox-field-arch ~@body)])))
|
||||
(defmacro ox-view-inherit [name model inherit &rest body]
|
||||
"Inherited View simplification with name of the record, xmlid for model and
|
||||
inherited view"
|
||||
(setv module (get (.split __name__ ".") 2)
|
||||
inherited (get (.split inherit ".") 1)
|
||||
xmlid f"{inherited}_inherit_{module}")
|
||||
`(do
|
||||
(view ~xmlid
|
||||
[(field-name ~name)
|
||||
(field-model ~model)
|
||||
(field-inherit ~inherit)
|
||||
(field-arch ~@body)])))
|
||||
(ox-view ~xmlid
|
||||
[(ox-field-name ~name)
|
||||
(ox-field-model ~model)
|
||||
(ox-field-inherit ~inherit)
|
||||
(ox-field-arch ~@body)])))
|
||||
|
||||
(defmacro field [&rest args] `(xmlna "field" ~@args))
|
||||
(defmacro field-name [name] `(field {"name" "name"} [~name]))
|
||||
(defmacro field-model [model] `(field {"name" "model"} [~model]))
|
||||
(defmacro field-inherit [xmlid] `(field {"name" "inherit_id" "ref" ~xmlid} []))
|
||||
(defmacro field-arch [&rest args] `(field {"name" "arch" "type" "xml"} ~@args))
|
||||
(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]))
|
||||
(defmacro ox-field-inherit [xmlid] `(ox-field {"name" "inherit_id" "ref" ~xmlid} []))
|
||||
(defmacro ox-field-arch [&rest args] `(ox-field {"name" "arch" "type" "xml"} ~@args))
|
||||
|
||||
(defmacro/g! xml-write [filename tree]
|
||||
"Write XML file according to filename and given tree"
|
||||
|
Loading…
Reference in New Issue
Block a user