提交 b4a5dbed authored 作者: 贺阳's avatar 贺阳

向导返回根据类型指定对应的form视图

上级 85a0d351
...@@ -126,6 +126,11 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -126,6 +126,11 @@ class BatchGetPodInfoWizard(models.TransientModel):
预览操作:获取PDF、处理涂抹、合并PDF并显示 预览操作:获取PDF、处理涂抹、合并PDF并显示
""" """
action_type = self.action_type action_type = self.action_type
wizard_name = _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading')
wizard_form_view = [[self.env.ref('ccs_base.view_batch_get_pod_info_wizard_form').id,
"form"]] if action_type == '获取尾程POD信息' else [
[self.env.ref('ccs_base.view_batch_create_and_get_pod_info_wizard_form').id, "form"]]
self.show_error_message = False self.show_error_message = False
try: try:
bl_objs = self.get_bl_objs() # 获取提单 bl_objs = self.get_bl_objs() # 获取提单
...@@ -221,26 +226,26 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -221,26 +226,26 @@ class BatchGetPodInfoWizard(models.TransientModel):
# 返回表单视图 # 返回表单视图
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _( 'name': wizard_name,
'Create TEMU Bill of Loading'),
'res_model': 'batch.get.pod.info.wizard', 'res_model': 'batch.get.pod.info.wizard',
'view_mode': 'form', 'view_mode': 'form',
'res_id': self.id, 'res_id': self.id,
'target': 'new', 'target': 'new',
'context': {'active_id': bl_objs.ids if bl_objs else False} 'context': {'active_id': bl_objs.ids if bl_objs else False},
'views': wizard_form_view,
} }
except Exception as e: except Exception as e:
_logger.error(f"预览操作失败: {str(e)}") _logger.error(f"预览操作失败: {str(e)}")
self.show_error_message = _('预览操作失败: %s') % str(e) self.show_error_message = _('预览操作失败: %s') % str(e)
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _( 'name': wizard_name,
'Create TEMU Bill of Loading'),
'res_model': 'batch.get.pod.info.wizard', 'res_model': 'batch.get.pod.info.wizard',
'view_mode': 'form', 'view_mode': 'form',
'res_id': self.id, 'res_id': self.id,
'target': 'new', 'target': 'new',
'context': {'active_id': self._context.get('active_id', [])} 'context': {'active_id': self._context.get('active_id', [])},
'views': wizard_form_view
} }
def confirm(self): def confirm(self):
...@@ -251,6 +256,11 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -251,6 +256,11 @@ class BatchGetPodInfoWizard(models.TransientModel):
start_time = time.time() start_time = time.time()
self.show_error_message = False self.show_error_message = False
action_type = self.action_type action_type = self.action_type
wizard_name = _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading')
wizard_form_view = [[self.env.ref('ccs_base.view_batch_get_pod_info_wizard_form').id,
"form"]] if action_type == '获取尾程POD信息' else [
[self.env.ref('ccs_base.view_batch_create_and_get_pod_info_wizard_form').id, "form"]]
bl_objs = self.get_bl_objs() bl_objs = self.get_bl_objs()
if action_type == '获取尾程POD信息' or (action_type == '创建temu提单' and self.get_last_mile_pod): if action_type == '获取尾程POD信息' or (action_type == '创建temu提单' and self.get_last_mile_pod):
# 优先使用已处理的文件数据(预览时已处理) # 优先使用已处理的文件数据(预览时已处理)
...@@ -286,12 +296,12 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -286,12 +296,12 @@ class BatchGetPodInfoWizard(models.TransientModel):
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard', 'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _( 'name': wizard_name,
'Create TEMU Bill of Loading'),
'view_mode': 'form', 'view_mode': 'form',
'res_id': self.id, 'res_id': self.id,
'target': 'new', 'target': 'new',
'context': {'active_id': bl_objs.ids, } 'context': {'active_id': bl_objs.ids, },
'views': wizard_form_view
} }
# 检查是否有文字清除失败的错误 # 检查是否有文字清除失败的错误
...@@ -302,13 +312,13 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -302,13 +312,13 @@ class BatchGetPodInfoWizard(models.TransientModel):
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard', 'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _( 'name': wizard_name,
'Create TEMU Bill of Loading'),
'view_mode': 'form', 'view_mode': 'form',
'res_id': self.id, 'res_id': self.id,
'target': 'new', 'target': 'new',
'context': {'default_show_error_message': self.show_error_message, 'context': {'default_show_error_message': self.show_error_message,
'active_id': bl_objs.ids if bl_objs else False} 'active_id': bl_objs.ids if bl_objs else False},
'views': wizard_form_view
} }
# 只处理成功涂抹的提单 # 只处理成功涂抹的提单
...@@ -361,13 +371,13 @@ class BatchGetPodInfoWizard(models.TransientModel): ...@@ -361,13 +371,13 @@ class BatchGetPodInfoWizard(models.TransientModel):
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard', 'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _( 'name': wizard_name,
'Create TEMU Bill of Loading'),
'view_mode': 'form', 'view_mode': 'form',
'res_id': self.id, 'res_id': self.id,
'target': 'new', 'target': 'new',
'context': {'default_show_error_message': self.show_error_message, 'context': {'default_show_error_message': self.show_error_message,
'active_id': bl_objs.ids if bl_objs else False} 'active_id': bl_objs.ids if bl_objs else False},
'views': wizard_form_view
} }
if action_type == '创建temu提单': if action_type == '创建temu提单':
return { return {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论