提交 41e1c854 authored 作者: 伍姿英's avatar 伍姿英

Merge branch 'release/3.7.1'

......@@ -782,7 +782,8 @@ class CcBL(models.Model):
if len(self) == 1:
zip_name = f"{self.bl_no or self.id}.zip"
att = self.env['ir.attachment'].sudo().create(
{'name': zip_name, 'datas': datas, 'res_model': 'cc.bl', 'res_id': (self.id if len(self) == 1 else self[0].id),
{'name': zip_name, 'datas': datas, 'res_model': 'cc.bl',
'res_id': (self.id if len(self) == 1 else self[0].id),
'mimetype': 'application/zip'})
url = f"/web/content/ir.attachment/{att.id}/datas/{att.name}?download=true"
return {'type': 'ir.actions.act_url', 'url': url, 'target': 'self'}
......@@ -1239,6 +1240,9 @@ class CcBL(models.Model):
def action_batch_get_pod_info(self):
"""批量获取尾程POD信息"""
is_temp = self.filtered(lambda x: x.bl_type == 'temu')
if is_temp:
raise ValidationError(_('TEMU提单不支持获取尾程POD信息,请点击批量创建提单!'))
return {
'name': _('Batch Get POD Info'),
'type': 'ir.actions.act_window',
......
......@@ -126,6 +126,11 @@ class BatchGetPodInfoWizard(models.TransientModel):
预览操作:获取PDF、处理涂抹、合并PDF并显示
"""
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
try:
bl_objs = self.get_bl_objs() # 获取提单
......@@ -221,26 +226,26 @@ class BatchGetPodInfoWizard(models.TransientModel):
# 返回表单视图
return {
'type': 'ir.actions.act_window',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading'),
'name': wizard_name,
'res_model': 'batch.get.pod.info.wizard',
'view_mode': 'form',
'res_id': self.id,
'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:
_logger.error(f"预览操作失败: {str(e)}")
self.show_error_message = _('预览操作失败: %s') % str(e)
return {
'type': 'ir.actions.act_window',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading'),
'name': wizard_name,
'res_model': 'batch.get.pod.info.wizard',
'view_mode': 'form',
'res_id': self.id,
'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):
......@@ -251,6 +256,11 @@ class BatchGetPodInfoWizard(models.TransientModel):
start_time = time.time()
self.show_error_message = False
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()
if action_type == '获取尾程POD信息' or (action_type == '创建temu提单' and self.get_last_mile_pod):
# 优先使用已处理的文件数据(预览时已处理)
......@@ -286,12 +296,12 @@ class BatchGetPodInfoWizard(models.TransientModel):
return {
'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading'),
'name': wizard_name,
'view_mode': 'form',
'res_id': self.id,
'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):
return {
'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading'),
'name': wizard_name,
'view_mode': 'form',
'res_id': self.id,
'target': 'new',
'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):
return {
'type': 'ir.actions.act_window',
'res_model': 'batch.get.pod.info.wizard',
'name': _('Batch Get POD Info') if action_type == '获取尾程POD信息' else _(
'Create TEMU Bill of Loading'),
'name': wizard_name,
'view_mode': 'form',
'res_id': self.id,
'target': 'new',
'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提单':
return {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论