تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2494 أدوات العرض

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


الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

You are right. But mrp.production also doesnt work

الصورة الرمزية
إهمال

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.

الكاتب

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.

الكاتب

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.

المنشورات ذات الصلة الردود أدوات العرض النشاط
4
مايو 24
13347
1
أبريل 24
3850
0
نوفمبر 23
2536
1
سبتمبر 23
2711
2
أغسطس 23
5288