Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3666 Visualizzazioni

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
Abbandona
Risposta migliore

Hello Cody,

try below code in onchange at last

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

Thanks & Regards

Ankit Vaghela

Avatar
Abbandona
Autore

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?

Autore

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?

Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
gen 24
1624
0
mar 15
4441
0
dic 24
3423
8
set 20
15690
2
gen 18
5041