Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0, 16.0] formio.form model: Many2oneReference (res_model, res_id) to replace specialized model FK #212

Open
bobslee opened this issue Dec 31, 2022 · 0 comments

Comments

@bobslee
Copy link
Member

bobslee commented Dec 31, 2022

SYNOPSIS

To improve (and ease) the generic integration of forms, it's maybe possible to replace this by the generic Many2oneReference field.
(Possible v16.0 work).

Research and refactor formio.form model resource implementation to use the Many2oneReferene pseudo field.

This concerns the already present fields res_model, res_id etc (other res_ fields).

This results into 2 fields in the formio_form table, eg:

Column    | Type
-----------------------------
res_model | character varying
res_id    | integer

Docs (ORM API, reference)

See: https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.fields.Many2oneReference
Examples of implementation: mail.activity, mail.followers, mail.message.

REQUIREMENTS

So this thoroughly requires:

  • Design choices (eg. also options on delete of the resource/related model: block, set null, cascade).
  • Testing (proof of concept with 1 module, eg formio_crm)
  • Refactoring (and probably support the old-style field, due to past custom implementations eg by server actions etc)
  • Probably a migration scrript

WARNINGS (to test):

  • However, still in specialized modules (eg formio_crm) the FK in the formio.form model is the specialized one (eg. crm_lead_id). See also above regarding "refactoring old-style" and "migration script".
  • Views (eg. crm_lead_views.xml): Action button formio.action_formio_form context (fields).
@bobslee bobslee added the 16.0 label May 29, 2023
@bobslee bobslee changed the title [16.0] formio.form model: Many2oneReference (res_model, res_id) to replace specialized model FK [17.0, 16.0] formio.form model: Many2oneReference (res_model, res_id) to replace specialized model FK Apr 14, 2024
@bobslee bobslee added the 17.0 label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant