Handling Form Submissions in an Odoo Controller

A web form submitted by a user has to be handled. How an Odoo controller does that.

A web form lets a user submit data, and the submitted data has to be handled. This piece is about handling form submissions in an Odoo controller.

The web form and its submission

A web form is how a user, on the web, submits data: the form lets the user enter information and submit it. When the user submits the form, the data they entered comes to Odoo, to a controller route built to receive it. Handling form submissions in an Odoo controller is the receiving and the handling of that submitted data.

How a controller handles a submission

A web form's submission comes to a controller route, the web endpoint built to receive it. The controller's code, attached to that route, then handles the submission: it receives the data the user submitted, and does what should be done with it, which often includes creating or updating a record from the data, and producing a response back to the user. So handling a form submission is the controller route receiving the submitted data and the controller's code handling it, doing the genuine intended thing with it and responding.

Handling submitted data safely

The crucial point in handling form submissions is that the submitted data comes from outside, from a user on the web, and data from outside has to be handled safely. Submitted data is not to be simply trusted; it could be wrong, it could be malformed, it could, if a controller is careless, be a means of attack. So handling form submissions safely means the controller handles the submitted data carefully, not trusting it blindly, but checking and handling it properly, so that the submitted data does the genuine intended thing and cannot do harm. Handling submitted data safely is the central discipline of handling form submissions.

Why this matters so much

Handling submitted data safely matters so much because a controller handling a web form is, by nature, exposed to whatever comes from the web. A controller that handles submitted data carelessly, trusting it blindly, is a genuine security risk: it is a way that bad or malicious data could get into the system or cause harm. A controller that handles submitted data carefully, checking it, handling it properly, is safe. The difference between a safe web form and a dangerous one is, largely, how carefully the controller handles the submitted data. So handling form submissions is a place for genuine security care.

Part of securing controllers

Handling form submissions safely is part of the broader matter of securing controllers, web endpoints exposed to the web. A developer building a controller to handle a web form must handle the submitted data with the care that web-exposed code requires. This connects to securing public controllers generally: a controller that handles a form, especially a public one, is exposed, and it must be built to handle what comes to it safely. Handling form submissions is a place where the security care that controllers need is concretely applied.

The takeaway

Handling form submissions in an Odoo controller is the receiving and handling of the data a user submits through a web form: the submission comes to a controller route, and the controller's code handles the data, doing the genuine intended thing with it, often creating or updating a record, and responding. The crucial discipline is handling the submitted data safely, since it comes from outside and is not to be trusted blindly, but checked and handled carefully. This matters greatly because a controller handling a web form is exposed to the web, so handling form submissions is a place for genuine security care. For how we approach Odoo, see our ERP practice.

All posts

Got a Topic Worth Posting?

Suggest a Topic

If a question keeps coming up in your operations, it might be worth its own post.