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
- Buchhaltung
- Lager
- PoS
- Project
- MRP
Diese Frage wurde gekennzeichnet
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,
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren