-
Notifications
You must be signed in to change notification settings - Fork 90
Home
Terminology:
- component: could be read as textfield, select, column, datagrid, button etc.
- Form Builder: shall explicitly reference here the Odoo
formio.builder
record or the Form Builder tool.
Whereas (for now) an input component primary references a textfield.
EXAMPLE with CRM Lead
Create a form for a CRM Lead, and have it autofill certain information such as the customer info.
At least the following modules are required:
-
formio_data_api
(makes the data loading possible) -
formio_crm
(ensures the linking between a Form and CRM Lead).
Configuration necessities:
- In the Odoo form-view ensure the field "Resource Model" contains "CRM Lead" (
crm.lead
). - Open the Form Builder (tool), edit some input component and open the "API" tab.
- To use the Lead
name
field, fill in (setting field) Property Name:Odoo__name
(double underscore is required to traverse fields).
About the prefixes:
-
Odoo
: Uses the stored value after the Form has been submitted (state != pending). -
OdooRF
: Refreshes the data even if the Form has been completed (for every state).
Whereas (for now) an input component primary references a textfield.
EXAMPLE with Sale Quotation/Order Lines
Create a form for a Sale Quote/Order, and generate rows with info/fields for every Order Line.
At least the following modules are required:
-
formio_data_api
(makes the data loading possible) -
formio_sale
(ensures the linking between a Form and Sale Quote/Order).
Configuration necessities:
- In the Odoo form-view ensure the field "Resource Model" contains "Sale Order" (
sale.order
). - Open the Form Builder (tool), add Data Grid or Edit Grid component and open the "API" tab.
About the prefixes:
-
Odoo
: Uses the stored value after the Form has been submitted (state != pending). -
OdooRF
: Refreshes the data even if the Form has been completed (for every state).
Possible use case:
Use a select field/component to load and provide the Odoo customers (display name), available in the res.partner
model.
Important, not supported:
To keep data secure, this currently only works in the Odoo backend and portal. In case you want to use this on the website (public user) this won't work (yet).
Required setup/actions:
- Drop a Select component in the Form Builder (tool)
- Edit Select component and open the Data tab
- Fill in the field Data Source URL:
/data
- Fill in the field Filter Query:
model=res.partner&label=name
Previous Filter Query will get all partners
It's also possible to filter certain partners, by adding extra URL query-params.
Following example loads data into Select Component, whereby choices are the partner names with city "Sittard".
Filter Query: model=res.partner&label=name&domain_fields=city&city=Sittard