跳至内容
菜单
此问题已终结

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
1月 24
1625
0
3月 15
4441
0
12月 24
3426
8
9月 20
15696
2
1月 18
5042