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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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,
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký