Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
1245 Vizualizări

Hi,

We're running Odoo 17e entreprise on-prem.

I'm trying to develop an addon to be able to more easily handle the creation of worksheet templates and worksheet views. 

We're in a situation where we need to recreate our quality worksheets when changes are made to them. The reason behind this is that worksheets need to stay exactly like they were when they were filled and modifying the views retroactively changes the worksheets already completed. 

I was thinking that defining the fields for each worksheet template in xml in a module would save me a lot of time when updating those worksheet templates, as I can create a new model, copy-paste most of the date, make the changes to the views and upload the new version, thus keeping completed worksheet intact while using the new ones in the future.

I'm able to create a new worksheet template by creating a new worksheet.template record, but I'm having trouble figuring out how to add fields to the model created by that new worksheet record.

Is there a good way to do what I'm looking to do and is there a simpler way to keep already completed worksheet intact while making changes to future ones?

Edit: One of the constraint of the project is keeping the module as a data module. Python files are to be avoided.

Imagine profil
Abandonează
Autor Cel mai bun răspuns

I've managed to find a solution:
It is possible to create a field record through XML. In that record, using the XMLID of the worksheet created, it is possible to fetch the model_id of the model linked to the worksheet. Fields can then be added arbitrarily using more field records.

<field name="model_id" model="ir.model" eval="obj().env.ref('module.worksheet_xml_id').id"/>
Imagine profil
Abandonează
Cel mai bun răspuns

Would it work if I will create custom model "module.worksheet_1" with apropriate fields (also with many2one quality.check), views and actions, then create new worksheet.template record linking to id of module.worksheet_1 ? 

My point is to not use worksheet creation method. Just prepare the model in my module and put the link in there.


Imagine profil
Abandonează
Autor

I forgot to add it to the post, but one of the constraint of the project is not using any python code to be able to install the module as a data module, so only XML and JS files.

Related Posts Răspunsuri Vizualizări Activitate
4
iul. 25
481
1
dec. 23
3282
0
sept. 23
3187
1
oct. 24
3767
5
nov. 19
5432