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

提单批量完成的优化

上级 50ff2113
...@@ -6,8 +6,8 @@ msgid "" ...@@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-18 02:22+0000\n" "POT-Creation-Date: 2026-04-10 02:22+0000\n"
"PO-Revision-Date: 2025-12-18 10:25+0800\n" "PO-Revision-Date: 2026-04-10 10:22+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: zh_CN\n" "Language: zh_CN\n"
...@@ -266,28 +266,28 @@ msgstr "地址3" ...@@ -266,28 +266,28 @@ msgstr "地址3"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "API URL not configured" msgid "API URL not configured"
msgstr "未配置 API URL" msgstr "未配置 API URL"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "API request failed: %s" msgid "API request failed: %s"
msgstr "API 请求失败:%s" msgstr "API 请求失败:%s"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "API returned empty response" msgid "API returned empty response"
msgstr "API 返回空响应" msgstr "API 返回空响应"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "API returned error: %s" msgid "API returned error: %s"
msgstr "API 返回错误:%s" msgstr "API 返回错误:%s"
...@@ -1577,7 +1577,7 @@ msgstr "导出报关文件" ...@@ -1577,7 +1577,7 @@ msgstr "导出报关文件"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "Failed to get PDF file from API: %s" msgid "Failed to get PDF file from API: %s"
msgstr "从 API 获取 PDF 文件失败: %s" msgstr "从 API 获取 PDF 文件失败: %s"
...@@ -2462,7 +2462,7 @@ msgstr "提单号" ...@@ -2462,7 +2462,7 @@ msgstr "提单号"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
#: code:addons/ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py:0 code:addons/ccs_base/wizard/batch_get_pod_info_wizard.py:0 #: code:addons/ccs_base/models/common_common.py:0
#, python-format #, python-format
msgid "No PDF files found in API response" msgid "No PDF files found in API response"
msgstr "API调用成功,但没有PDF文件" msgstr "API调用成功,但没有PDF文件"
...@@ -3745,8 +3745,8 @@ msgstr "所选操作时间超过 %s 小时,请重新确认操作时间" ...@@ -3745,8 +3745,8 @@ msgstr "所选操作时间超过 %s 小时,请重新确认操作时间"
#, python-format #, python-format
msgid "" msgid ""
"The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to " "The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to "
"completed!" "completed!These BL numbers are: %s"
msgstr "小包节点或提单节点不在已完成节点,提单不能变为已完成!" msgstr "小包节点或提单节点不在已完成节点,提单不能变为已完成!这些提单号是:%s"
#. module: ccs_base #. module: ccs_base
#. odoo-python #. odoo-python
......
...@@ -1025,13 +1025,18 @@ class CcBL(models.Model): ...@@ -1025,13 +1025,18 @@ class CcBL(models.Model):
def check_is_done(self, is_email=False, **kwargs): def check_is_done(self, is_email=False, **kwargs):
# 如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成.tk模块有继承 # 如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成.tk模块有继承
failed_bl_nos = []
for item in self:
if all(line.state.is_done for line in if all(line.state.is_done for line in
self.ship_package_ids) and self.customs_clearance_status.is_done and self.is_bl_sync: item.ship_package_ids) and item.customs_clearance_status.is_done and item.is_bl_sync:
self.done_func(is_email, **kwargs) item.done_func(is_email, **kwargs)
else: else:
if not is_email: if not is_email:
failed_bl_nos.append(item.bl_no or item.name or '')
if not is_email and failed_bl_nos:
bl_str = '、'.join([b for b in failed_bl_nos if b])
raise ValidationError( raise ValidationError(
_('The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to completed!')) # 小包节点或提单节点不在已完成节点,提单不能变为已完成! _('The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to completed!These BL numbers are: %s') % bl_str) # 小包节点或提单节点不在已完成节点,提单不能变为已完成!
def done_func(self, is_email=False, **kwargs): def done_func(self, is_email=False, **kwargs):
""" """
......
...@@ -6,8 +6,8 @@ msgid "" ...@@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-06 06:30+0000\n" "POT-Creation-Date: 2026-04-10 02:23+0000\n"
"PO-Revision-Date: 2026-02-06 14:32+0800\n" "PO-Revision-Date: 2026-04-10 10:23+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: zh_CN\n" "Language: zh_CN\n"
...@@ -610,8 +610,10 @@ msgstr "操作时间不能大于当前时间,也不能小于最近的操作时 ...@@ -610,8 +610,10 @@ msgstr "操作时间不能大于当前时间,也不能小于最近的操作时
#, python-format #, python-format
msgid "" msgid ""
"The small package node or bill of lading node is not in the completed node, " "The small package node or bill of lading node is not in the completed node, "
"and the bill of lading cannot be changed to completed!" "and the bill of lading cannot be changed to completed!These BL numbers are:"
msgstr "小包节点或提单节点不在已完成节点,提单不能变为已完成!" "%s"
msgstr ""
"小包节点或提单节点不在已完成节点,提单不能变为已完成!这些提单号是:%s"
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#. odoo-python #. odoo-python
......
...@@ -538,15 +538,20 @@ class CcBl(models.Model): ...@@ -538,15 +538,20 @@ class CcBl(models.Model):
result = self.env.cr.fetchone() result = self.env.cr.fetchone()
return result and result[0] or False return result and result[0] or False
def check_is_done(self, is_email=False): def check_is_done(self, is_email=False, **kwargs):
# 如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成 # 如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成.tk模块有继承
failed_bl_nos = []
for item in self:
if all(line.state.is_done for line in if all(line.state.is_done for line in
self.ship_package_ids) and self.unsync_package_count <= 0 and self.customs_clearance_status.is_done and self.is_bl_sync: item.ship_package_ids) and item.unsync_package_count <= 0 and item.customs_clearance_status.is_done and item.is_bl_sync:
self.done_func(is_email) item.done_func(is_email, **kwargs)
else: else:
if not is_email: if not is_email:
failed_bl_nos.append(item.bl_no or item.name or '')
if not is_email and failed_bl_nos:
bl_str = '、'.join([b for b in failed_bl_nos if b])
raise ValidationError( raise ValidationError(
_('The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to completed!')) # 小包节点或提单节点不在已完成节点,提单不能变为已完成! _('The small package node or bill of lading node is not in the completed node, and the bill of lading cannot be changed to completed!These BL numbers are:%s') % bl_str) # 小包节点或提单节点不在已完成节点,提单不能变为已完成!
def done_func(self, is_email=False, **kwargs): def done_func(self, is_email=False, **kwargs):
""" """
...@@ -736,7 +741,8 @@ class CcBl(models.Model): ...@@ -736,7 +741,8 @@ class CcBl(models.Model):
""" """
issues = [] issues = []
# 获取所有小包节点,按顺序排序 # 获取所有小包节点,按顺序排序
package_nodes = self.env['cc.node'].sudo().search([('node_type', '=', 'package'), ('is_patrol_node', '=', True)], package_nodes = self.env['cc.node'].sudo().search(
[('node_type', '=', 'package'), ('is_patrol_node', '=', True)],
order='seq') order='seq')
if not package_nodes: if not package_nodes:
return issues return issues
...@@ -786,7 +792,8 @@ class CcBl(models.Model): ...@@ -786,7 +792,8 @@ class CcBl(models.Model):
# 根据节点的seq进行排序 # 根据节点的seq进行排序
sync_logs = [] sync_logs = []
# 获取所有提单节点,按业务顺序排序 # 获取所有提单节点,按业务顺序排序
bl_nodes = self.env['cc.node'].sudo().search([('node_type', '=', 'bl'), ('is_patrol_node', '=', True)], order='seq') bl_nodes = self.env['cc.node'].sudo().search([('node_type', '=', 'bl'), ('is_patrol_node', '=', True)],
order='seq')
if bl_nodes: if bl_nodes:
for node in bl_nodes: for node in bl_nodes:
if node.tk_code in logs_by_bl_process.keys(): if node.tk_code in logs_by_bl_process.keys():
...@@ -843,7 +850,8 @@ class CcBl(models.Model): ...@@ -843,7 +850,8 @@ class CcBl(models.Model):
""" """
issues = [] issues = []
# 获取所有提单节点,按顺序排序 # 获取所有提单节点,按顺序排序
bl_nodes = self.env['cc.node'].sudo().search([('node_type', '=', 'bl'), ('is_patrol_node', '=', True)], order='seq') bl_nodes = self.env['cc.node'].sudo().search([('node_type', '=', 'bl'), ('is_patrol_node', '=', True)],
order='seq')
if not bl_nodes: if not bl_nodes:
return issues return issues
# 检查每个节点是否有对应的同步日志 # 检查每个节点是否有对应的同步日志
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论