Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2501 Widoki

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


Awatar
Odrzuć
Najlepsza odpowiedź

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')

Awatar
Odrzuć
Autor Najlepsza odpowiedź

You are right. But mrp.production also doesnt work

Awatar
Odrzuć

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.

Autor

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.

Autor

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.

Powiązane posty Odpowiedzi Widoki Czynność
4
maj 24
13347
1
kwi 24
3850
0
lis 23
2536
1
wrz 23
2711
2
sie 23
5288