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

提单批量完成的优化

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