pyvelm.builders¶
builders ¶
Fluent view and menu declaration builders (velmphp / Filament-style).
Preferred authoring::
from pyvelm.builders import ViewsData, ListView, FormView, Field, Menus
m = Menus("partners")
views_data = (
ViewsData.make()
.views(
ListView.make("partner.list")
.model("res.partner")
.columns(["name", Field.make("active").toggle()])
.form_view("partner.form"),
FormView.make("partner.form")
.model("res.partner")
.section("identity", "Identity", ["name", "code"]),
)
.menus(
m.group("business", "Business", icon="home").children([
m.item("business.partners", "Partners").view("partner.list"),
]),
)
)
Legacy function helpers (list_view, field, section, …) remain
available and delegate to the same fluent classes.
DashboardView
module-attribute
¶
A view_type="dashboard" view declaration.
DetailView
module-attribute
¶
A view_type="detail" read-only record view declaration.
Action ¶
Declares a toolbar action on list or form/detail views.
Source code in pyvelm/builders/action.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
ActionForm ¶
Inline form schema for view-action dialogs.
Source code in pyvelm/builders/action.py
Field ¶
Build a single field entry inside list / form / kanban archs.
Source code in pyvelm/builders/field.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
readonly_when ¶
Read-only when a domain matches or a callable returns true.
Source code in pyvelm/builders/field.py
required_when ¶
Required when a domain matches or a callable returns true.
Source code in pyvelm/builders/field.py
visible_when ¶
Visible when a domain matches or a callable returns true.
Domains support nested paths (company_id.currency_id.code) on
live forms — M2O ids from the submitted form are browsed via env.
Source code in pyvelm/builders/field.py
live ¶
Re-render the form via HTMX when this field changes (Filament live()).
live() — on change; live(debounce=200) — debounced;
live(on_blur=True) — on blur only.
Source code in pyvelm/builders/field.py
reactive ¶
Alias for :meth:live (Filament / Livewire naming).
depends_on ¶
Declare sibling fields whose changes should refresh this field.
Dependency sources without an explicit live() still trigger a
form re-render so visible_when, required_when, and
options_domain stay in sync.
Source code in pyvelm/builders/field.py
options_domain ¶
Filter Many2one / Many2many picker options (domain list or callable).
Static domain — compiled to SQL for search; nested paths work::
.options_domain([("company_id.currency_id.code", "=", "KES")])
Sibling values: "company_id" or "$company_id" (also dotted
$company_id.currency_id.code).
Callable — module-level named function (view arch serializes it).
Receives (record, env, get) or (ctx,) and returns a domain list.
Use when empty-state logic is easier in Python than in domain syntax.
Source code in pyvelm/builders/field.py
KanbanCard ¶
Kanban card layout block.
Source code in pyvelm/builders/layout.py
Notebook ¶
Tabbed notebook block on a parent form.
Source code in pyvelm/builders/layout.py
Page ¶
One tab page inside a form notebook.
Source code in pyvelm/builders/layout.py
Section ¶
Form section block.
Source code in pyvelm/builders/layout.py
MenuBranch ¶
Menu group with optional nested children.
Source code in pyvelm/builders/menus.py
MenuItem ¶
Fluent leaf menu entry (MenuItem.make(...).view('partner.list')).
Source code in pyvelm/builders/menus.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
Menus ¶
Module-scoped fluent menu builder.
Source code in pyvelm/builders/menus.py
ViewsData ¶
Assign to views_data in a module DATA file.