hi , I am trying to call refresh() def from onchange to refresh the page but it is not working.please suggest me the alternative which can help me in this situation@api.multi
def refresh(self):
return {
'type': 'ir.actions.client',
'tag': 'reload',
}
@api.onchange('barcode','workorder_sequence')
def onchange_barcode(self):
if self.barcode:
workorder_id = self.env['mrp.workorder'].search([('workorder_sequence', '=', self.workorder_sequence)])
workorder_config_obj = self.env['workorder.configuration']
config_id = workorder_config_obj.search([('barcode','=',self.barcode)])
if not config_id:
self.barcode = ''
raise UserError(_(
"Invalid Barcode Detected!!!"))
else:
if config_id.name =='start':
workorder_id.button_start()
self.refresh()
if config_id.name =='done':
workorder_id.record_production()
self.refresh()
if config_id.name =='pause':
workorder_id.button_pending()
self.refresh()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
hi @jignesh ,
i tried this one . but not working
Hello rathore_mahesh,
Try this method.
def refresh(self):
model_obj = self.env['ir.model.data']
data_id = model_obj._get_id('module_name', 'form_view_id')
view_id = model_obj.browse(data_id).res_id
return {
'type': 'ir.actions.client',
'tag': 'reload',
'name': _('form_name'),
'res_model': 'model.name',
'view_type': 'form',
'view_mode': 'form',
'view_id': view_id,
'target': 'current',
'nodestroy': True,
}
Hope this will helps you.
Thanks,
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up