Skip to Content
Menu
This question has been flagged
2 Replies
1736 Views

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
Discard
Best Answer

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
Discard
Author Best Answer

You are right. But mrp.production also doesnt work

Avatar
Discard

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.

Author

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.

Author

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.

Related Posts Replies Views Activity
4
May 24
10077
1
Apr 24
1566
0
Nov 23
525
1
Sep 23
570
2
Aug 23
2427