Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3684 Представления

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
янв. 24
1627
0
мар. 15
4443
0
дек. 24
3434
8
сент. 20
15698
2
янв. 18
5048