Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3664 Zobrazení

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?

Avatar
Zrušit
Nejlepší odpověď

Hello Cody,

try below code in onchange at last

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

Thanks & Regards

Ankit Vaghela

Avatar
Zrušit
Autor

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?

Autor

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?

Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
led 24
1622
0
bře 15
4438
0
pro 24
3421
8
zář 20
15689
2
led 18
5040