Odoo share form to Internet
or share form to public user

Share backend form its easy?

Real case

Sometimes there is a task to share the form not to the user of the Odoo, but simply to an outsider or a partner who does not have access to the Odoo, a user is not created, and even there is no portal user.

When might we need it?

For example, you have a certain form (contract) in which there is data of your partner, but you do not have partners in the system, you can grant access to fill in this data such as the name of the campaign, the name of the CEO, and so on.

So to share the form exactly as we see it on the backend, the task is not yet solved. But there is a workaround. The Odoo provides a portal.mixin model that adds an access token to each entry first, and a mechanism for displaying our form on the portal second.

An access token is a random 128 byte number passed in a get request that you can open the form with.

But after all, there are also related fields in the form, and these are already other data models, and therefore, in fact, if we want to give the partner the opportunity to enter data into the form containing the related fields (many2one many2many and others) then we would have to give them access, and I think this is the main difficulty

So we have an access token and now we need to write our own form it will be a simple web form with fields that we will give to fill in, and when you click on the fill button, they will be automatically entered into our form and database.

So what about the relaitid fields now? we just collect them in the controller before submitting the form and thus we don't even need to give access to the models.

And by the way when a person does not work under the user ode considers it a public user

Disadvantages of the solution

Can we do it normally?

You always need to inherit from the portal.mixin, you always need to make a form for input and handle errors.

In general, you just need to be able to program! it would be ideal if we could do this by pressing a single button, but alas, this is not yet available, although I know how to do it

Odoo outgoing mail server
setup on odoo 14
Contact us
/>