← Back to team overview

openerp-expert-framework team mailing list archive

Implementing widgets for O2M form fields

 

Dear framework experts,

I'm implementing a web widget which replaces actual web_calendar module functionality. I've already added the possibility to use the calendar view in Many2Many form fields by mimicking what I've found in ``view_form.js`` concerning Many2Many kanban stuff. This is working well.

My question is about One2Many fields. It seems quite different than the actual Many2Many implementation despite the fact that these have a very similar functionality.

The One2Many implementation uses a viewmanager and make no distinction between views with different classes for each widget type. A lot of magical strings are hard-wired in ``instance.web.form.FieldOne2Many``. For example:

    if (! _.include(["list", "tree", "graph", "kanban"], mode)) {
throw new Error(_.str.sprintf(_t("View type '%s' is not supported in One2Many."), mode));
    }

I can see the advantages of a unique FieldOne2Many using a ViewManager, but currently, the implementation lacks modularity as far as I am concerned.

I was wondering what was the roadmap about this. Will FieldOne2Many be awarded more love to make it more modular ? and eventually FieldMany2Many will have the same architecture ?

Or are there arcane knowledge I should know about fundamental differences between Many2Many field widget and One2Many that explains those inconveniences ?

I need to know this to correctly follow official and less official policies so that I minimise maintenance on my code in the future.

Thank you for your insights,

--
Valentin LAB
Ingénieur Développement

tel:  +33 6 71 39 62 13
mail: valentin.lab@xxxxxxxxxxx