[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 button [&rest args] (xmln "button" #*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]
|
||||
"Special field allowing mangling name attribute"
|
||||
(setv attrs (nth args 0))
|
||||
@ -98,17 +101,19 @@
|
||||
xmlid f"{model_und}_view_{view_type}"
|
||||
name f"{model_cap} {(.capitalize view_type)}")
|
||||
(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"
|
||||
(setv module (get (.split __name__ ".") 2)
|
||||
(setv module (get (.split filename ".") 2)
|
||||
inherited (get (.split inherit ".") 1)
|
||||
xmlid f"{inherited}_inherit_{module}")
|
||||
(view xmlid
|
||||
[(field-name name)
|
||||
(field-model model)
|
||||
(field-inherit inherit)
|
||||
(field-arch arch)]))
|
||||
xmlid f"{inherited}_inherit_{module}"
|
||||
model_cap (.join " " (lfor w (.split model ".") (.capitalize w)))
|
||||
name f"{model_cap} Adaptations")
|
||||
(view xmlid
|
||||
[(field-name name)
|
||||
(field-model model)
|
||||
(field-inherit inherit)
|
||||
(field-arch arch)]))
|
||||
|
||||
(defn actions-server-code [xmlid name modelref code]
|
||||
"Server actions of type code"
|
||||
@ -145,6 +150,8 @@
|
||||
(setv fn-name f"_compute_{(mangle fname)}")
|
||||
`(setv ~fname (~@body :compute ~fn-name)))
|
||||
|
||||
(defmacro __ [sentence] `((py "_") ~sentence))
|
||||
|
||||
; Migrations
|
||||
|
||||
(defn generate-fn-name [filepath]
|
||||
|
Loading…
x
Reference in New Issue
Block a user