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

I am manufacturing products and displaying the amount of available products to consume in a many2many field, my field for creating the manufacturing order is an onchange field, which allows a user to enter a barcode for that manufacturing lot and it'll automatically produce that product however, after it has completed and created the products, it doesnt update the values on the many2many fields in the browser. however when i refresh i see the updated values.

similarly, clicking on save after finishing the MO, also displays the updated values. 

How can i force the browser to refresh or force the values to be updated correctly? I could have the user click save and then edit again but this seems like extra steps to achieve something i assumed would be relatively easy?

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

Hello Cody,

try below code in onchange at last

return {
'type': 'ir.actions.client',
'tag': 'reload',
}

Thanks & Regards

Ankit Vaghela

الصورة الرمزية
إهمال
الكاتب

Thanks Ankit,

I cannot seem to get this to work? is this method still valid in odoo v14?

it doesnt seem to do anything? I have tried it alone in a new function an as a part of the onchange function that calls it and neither of them cause a refresh of the values.

Hello Cody,

Yes, it is valid also in odoo v14.

can you paste your onchange method code here for more claarification?

الكاتب

It is an onchange button that used to be a button push but now just actions a manufacturing order (manufacture_value()), updates inventory(get_inventory())), which is where my problem is and if conditions are met packagaes it up( get_MC_production()).

after this has happened is when I want my client to reload.

@api.onchange('Confirm_BOM', 'Serial_Number')

def _push_button(self):

if self.Confirm_BOM and self.Serial_Number:

self.manufacture_value()

self.get_inventory()

self.get_MC_production()

return {

'type': 'ir.actions.client',

'tag': 'reload',

}

it runs through this and the values in my many to many field dont change.

above code is running or not?

أفضل إجابة

You can manually call the onchange methods when the barcode scan event happens.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
يناير 24
1624
0
مارس 15
4441
0
ديسمبر 24
3425
8
سبتمبر 20
15695
2
يناير 18
5042