Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
2500 Weergaven

Maybe I haven't understood something fundamental about how odoo works. I have made a module that inherits mrp.production and adds 2 fields in manufacturing order(a checkbox and a text box) with the appropriate changes in the xml file

newfilechkbx = fields.Boolean(string="New File")

notes = fields.Text(string="Notes")

so far so good.

Now i want to make these fields pass to the work order that is created I have tried this:

from odoo import models, fields, api

 

class MrpWorkOrderInherited(models.Model):

    _inherit = 'mrp.workorder'

 

    custom_fields = fields.Many2one('mrp.production.form')

    newfilechkbx2 = fields.Boolean(related='custom_fields.newfilechkbx')

    notes2 = fields.Text(related='custom_fields.notes')

but it doesnt work and i cant find anything in to help me understand how I can make it work. 

I have Odoo 13


Avatar
Annuleer
Beste antwoord

Hi, 

You have a typo in your code, there is no model named mrp.production.form :

 custom_fields = fields.Many2one('mrp.production.form')  

Should be:

 custom_fields = fields.Many2one('mrp.production')

Avatar
Annuleer
Auteur Beste antwoord

You are right. But mrp.production also doesnt work

Avatar
Annuleer

It should worked, When you change anything in the code, you have to restart the Odoo service and update app lists and then upgrade you module.

To make sure it's not working, create a fresh DB and install your module and check.

Auteur

It's good to know that I have understood the fundamentals and the code should. As this is a server that we keep at work I will test it on monday and update the question.

That's sound good.

It's better to have a development environment because you will need to restart the service many times during the development.

Auteur

No luck again. I also tried to filter by domain in python or in the view but no luck also. I dont know what else to do...

Please try to install your module in a fresh DB and check if it's working or not.

Gerelateerde posts Antwoorden Weergaven Activiteit
4
mei 24
13347
1
apr. 24
3850
0
nov. 23
2536
1
sep. 23
2711
2
aug. 23
5288