Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2505 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore Risposta migliore

You are right. But mrp.production also doesnt work

Avatar
Abbandona

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.

Autore

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.

Autore

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.

Post correlati Risposte Visualizzazioni Attività
4
mag 24
13347
1
apr 24
3852
0
nov 23
2537
1
set 23
2711
2
ago 23
5288