[IMP]Odoo : new XML nodes, improve view inherit macro, attempt for _translate...
But Odoo black magic, does not work with AST and so Hy...
This commit is contained in:
parent
bb5c3a8cb8
commit
811c166f90
@ -68,6 +68,9 @@
|
|||||||
(defn sheet [&rest args] (xmln "sheet" #*args))
|
(defn sheet [&rest args] (xmln "sheet" #*args))
|
||||||
(defn button [&rest args] (xmln "button" #*args))
|
(defn button [&rest args] (xmln "button" #*args))
|
||||||
(defn p [&rest args] (xmln "p" #*args))
|
(defn p [&rest args] (xmln "p" #*args))
|
||||||
|
(defn xpath [&rest args] (xmln "xpath" #*args))
|
||||||
|
(defn attribute [name value] (xmln "attribute" {"name" name} [value]))
|
||||||
|
|
||||||
(defn field [&rest args]
|
(defn field [&rest args]
|
||||||
"Special field allowing mangling name attribute"
|
"Special field allowing mangling name attribute"
|
||||||
(setv attrs (nth args 0))
|
(setv attrs (nth args 0))
|
||||||
@ -98,12 +101,14 @@
|
|||||||
xmlid f"{model_und}_view_{view_type}"
|
xmlid f"{model_und}_view_{view_type}"
|
||||||
name f"{model_cap} {(.capitalize view_type)}")
|
name f"{model_cap} {(.capitalize view_type)}")
|
||||||
(view-def :xmlid xmlid :name name :model model :arch arch))
|
(view-def :xmlid xmlid :name name :model model :arch arch))
|
||||||
(defn view-inherit [name model inherit arch]
|
(defn view-inherit [filename model inherit arch]
|
||||||
"Inherited View simplification with name of the record, xmlid for model and
|
"Inherited View simplification with name of the record, xmlid for model and
|
||||||
inherited view"
|
inherited view"
|
||||||
(setv module (get (.split __name__ ".") 2)
|
(setv module (get (.split filename ".") 2)
|
||||||
inherited (get (.split inherit ".") 1)
|
inherited (get (.split inherit ".") 1)
|
||||||
xmlid f"{inherited}_inherit_{module}")
|
xmlid f"{inherited}_inherit_{module}"
|
||||||
|
model_cap (.join " " (lfor w (.split model ".") (.capitalize w)))
|
||||||
|
name f"{model_cap} Adaptations")
|
||||||
(view xmlid
|
(view xmlid
|
||||||
[(field-name name)
|
[(field-name name)
|
||||||
(field-model model)
|
(field-model model)
|
||||||
@ -145,6 +150,8 @@
|
|||||||
(setv fn-name f"_compute_{(mangle fname)}")
|
(setv fn-name f"_compute_{(mangle fname)}")
|
||||||
`(setv ~fname (~@body :compute ~fn-name)))
|
`(setv ~fname (~@body :compute ~fn-name)))
|
||||||
|
|
||||||
|
(defmacro __ [sentence] `((py "_") ~sentence))
|
||||||
|
|
||||||
; Migrations
|
; Migrations
|
||||||
|
|
||||||
(defn generate-fn-name [filepath]
|
(defn generate-fn-name [filepath]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user