Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
47c73879
提交
47c73879
authored
3月 24, 2025
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化小包状态回写提单状态
上级
f19ed46d
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
40 行增加
和
26 行删除
+40
-26
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+1
-1
cc_node.py
ccs_base/models/cc_node.py
+11
-7
cc_node_view.xml
ccs_base/views/cc_node_view.xml
+1
-1
batch_input_ship_package_statu_wizard.py
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
+1
-3
update_bl_status_wizard.py
ccs_base/wizard/update_bl_status_wizard.py
+7
-6
update_bl_status_wizard.xml
ccs_base/wizard/update_bl_status_wizard.xml
+3
-1
cc_bill_loading.py
ccs_connect_tiktok/models/cc_bill_loading.py
+15
-6
batch_input_ship_package_statu_wizard.py
...ct_tiktok/wizard/batch_input_ship_package_statu_wizard.py
+1
-1
没有找到文件。
ccs_base/models/cc_bill_loading.py
浏览文件 @
47c73879
...
@@ -603,7 +603,7 @@ class CcBL(models.Model):
...
@@ -603,7 +603,7 @@ class CcBL(models.Model):
raise
ValidationError
(
_
(
'The customs clearance status of the selected bill of loading must be the same.'
))
raise
ValidationError
(
_
(
'The customs clearance status of the selected bill of loading must be the same.'
))
# 最近操作时间取最晚的一条提单状态操作时间。
# 最近操作时间取最晚的一条提单状态操作时间。
last_process_time
=
\
last_process_time
=
\
self
.
filtered
(
lambda
x
:
x
.
customs_clearance_status
.
id
)
.
mapped
(
'process_time'
)
.
sorted
(
reverse
=
True
)[
0
]
sorted
(
self
.
filtered
(
lambda
x
:
x
.
customs_clearance_status
.
id
)
.
mapped
(
'process_time'
),
reverse
=
True
)[
0
]
return
{
return
{
'name'
:
_
(
'Update the status of the bill of loading'
),
'name'
:
_
(
'Update the status of the bill of loading'
),
'type'
:
'ir.actions.act_window'
,
'type'
:
'ir.actions.act_window'
,
...
...
ccs_base/models/cc_node.py
浏览文件 @
47c73879
# 导入odoo
# 导入odoo
import
base64
# 导入日志
# 导入日志
import
logging
import
logging
import
xlrd
from
odoo
import
models
,
fields
,
api
,
_
from
odoo
import
models
,
fields
from
odoo.exceptions
import
UserError
# 获取日志
# 获取日志
_logger
=
logging
.
getLogger
(
__name__
)
_logger
=
logging
.
getLogger
(
__name__
)
...
@@ -50,6 +48,12 @@ class CcNode(models.Model):
...
@@ -50,6 +48,12 @@ class CcNode(models.Model):
],
default
=
''
,
string
=
'Corresponding to the status of the big package'
,
index
=
True
)
# 对应大包状态 未理货/已理货/尾程交接
],
default
=
''
,
string
=
'Corresponding to the status of the big package'
,
index
=
True
)
# 对应大包状态 未理货/已理货/尾程交接
# 新增字段:对应小包状态。只有类型为提单上才可填写。可选已配置节点类型为小包的节点。单选;
# 新增字段:对应小包状态。只有类型为提单上才可填写。可选已配置节点类型为小包的节点。单选;
package_state
=
fields
.
Many2one
(
'cc.node'
,
string
=
'Corresponding to the status of the package'
,
domain
=
"[('node_type','=','package')]"
,
index
=
True
)
# 对应小包状态
package_state
=
fields
.
Many2one
(
'cc.node'
,
string
=
'Corresponding to the status of the package'
,
domain
=
"[('node_type','=','package')]"
,
index
=
True
)
# 对应小包状态
def
node_is_sync
(
self
):
# 如果更新节点是 默认节点 同步的标志变为True
is_sync
=
False
if
self
.
is_default
:
is_sync
=
True
return
is_sync
ccs_base/views/cc_node_view.xml
浏览文件 @
47c73879
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<field
optional=
"show"
name=
"desc"
string=
"Node Description"
/>
<field
optional=
"show"
name=
"desc"
string=
"Node Description"
/>
<field
optional=
"show"
name=
"next_code_ids"
widget=
"many2many_tags"
options=
"{'no_create':True}"
/>
<field
optional=
"show"
name=
"next_code_ids"
widget=
"many2many_tags"
options=
"{'no_create':True}"
/>
<field
optional=
"show"
name=
"tally_state"
/>
<field
optional=
"show"
name=
"tally_state"
/>
<field
optional=
"show"
name=
"package_state"
/>
<field
optional=
"show"
name=
"package_state"
attrs=
"{'invisible': [('node_type', '=', 'package')]}"
/>
<field
optional=
"show"
name=
"is_must"
string=
"Is Must Node"
/>
<field
optional=
"show"
name=
"is_must"
string=
"Is Must Node"
/>
<field
optional=
"show"
name=
"is_done"
string=
"Is Done Node"
/>
<field
optional=
"show"
name=
"is_done"
string=
"Is Done Node"
/>
<field
optional=
"show"
name=
"is_default"
string=
"Is Current Node"
/>
<field
optional=
"show"
name=
"is_default"
string=
"Is Current Node"
/>
...
...
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
47c73879
...
@@ -102,9 +102,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -102,9 +102,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
if
reason_obj
and
not
self
.
node_exception_reason_id
:
if
reason_obj
and
not
self
.
node_exception_reason_id
:
raise
ValidationError
(
_
(
'Please select the reason for the exception!'
))
# 请选择异常原因
raise
ValidationError
(
_
(
'Please select the reason for the exception!'
))
# 请选择异常原因
# 如果更新节点是 默认节点 同步的标志变为True
# 如果更新节点是 默认节点 同步的标志变为True
is_sync
=
False
is_sync
=
self
.
update_status
.
node_is_sync
()
if
self
.
update_status
.
is_default
:
is_sync
=
True
# 更新状态
# 更新状态
parcels
.
write
(
parcels
.
write
(
{
'state'
:
self
.
update_status
.
id
,
'node_exception_reason_id'
:
self
.
node_exception_reason_id
.
id
,
{
'state'
:
self
.
update_status
.
id
,
'node_exception_reason_id'
:
self
.
node_exception_reason_id
.
id
,
...
...
ccs_base/wizard/update_bl_status_wizard.py
浏览文件 @
47c73879
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from
odoo
import
models
,
api
,
fields
from
odoo
import
models
,
fields
from
odoo.exceptions
import
ValidationError
from
odoo.exceptions
import
ValidationError
...
@@ -29,6 +29,8 @@ class UpdateBlStatusWizard(models.TransientModel):
...
@@ -29,6 +29,8 @@ class UpdateBlStatusWizard(models.TransientModel):
bl_count
=
fields
.
Integer
(
'Bill Of Loading Count'
,
default
=
get_bl_count
)
bl_count
=
fields
.
Integer
(
'Bill Of Loading Count'
,
default
=
get_bl_count
)
current_status
=
fields
.
Many2one
(
'cc.node'
,
'Current Status'
)
current_status
=
fields
.
Many2one
(
'cc.node'
,
'Current Status'
)
next_code_ids
=
fields
.
Many2many
(
'cc.node'
,
'bl_node_next_node_wizard_rel'
,
'node_id'
,
'next_node_id'
,
'Next Node'
,
related
=
'current_status.next_code_ids'
)
update_status
=
fields
.
Many2one
(
'cc.node'
,
'Update Node'
)
update_status
=
fields
.
Many2one
(
'cc.node'
,
'Update Node'
)
is_ok
=
fields
.
Boolean
(
'Confirm Date is ok.'
,
default
=
False
)
is_ok
=
fields
.
Boolean
(
'Confirm Date is ok.'
,
default
=
False
)
process_time
=
fields
.
Datetime
(
'Process Time'
)
process_time
=
fields
.
Datetime
(
'Process Time'
)
...
@@ -39,7 +41,7 @@ class UpdateBlStatusWizard(models.TransientModel):
...
@@ -39,7 +41,7 @@ class UpdateBlStatusWizard(models.TransientModel):
# 批量更新小包状态
# 批量更新小包状态
def
submit
(
self
):
def
submit
(
self
):
bl_obj
=
self
.
get_order
()
bl_obj
=
self
.
get_order
()
# 确认数据
# 确认数据
if
not
self
.
is_ok
:
if
not
self
.
is_ok
:
raise
ValidationError
(
'Please confirm that the above data is correct.'
)
# 请确认以上数据正确
raise
ValidationError
(
'Please confirm that the above data is correct.'
)
# 请确认以上数据正确
...
@@ -50,10 +52,9 @@ class UpdateBlStatusWizard(models.TransientModel):
...
@@ -50,10 +52,9 @@ class UpdateBlStatusWizard(models.TransientModel):
# 3.若选择的“更新节点”为“选择节点”的前序节点(根据节点设置排序),则查找“选择节点”是否已有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。若有多条,以同步时间最晚的一条为准。
# 3.若选择的“更新节点”为“选择节点”的前序节点(根据节点设置排序),则查找“选择节点”是否已有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。若有多条,以同步时间最晚的一条为准。
# 4.若选择的“更新节点”和“选择节点”一致时,需检查该节点的前序节点是否有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。同一节点若有多条同步日志,以同步时间最晚的一条为准。
# 4.若选择的“更新节点”和“选择节点”一致时,需检查该节点的前序节点是否有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。同一节点若有多条同步日志,以同步时间最晚的一条为准。
# 如果更新节点是 默认节点 同步的标志变为True
# 如果更新节点是 默认节点 同步的标志变为True
is_sync
=
False
is_sync
=
self
.
update_status
.
node_is_sync
()
if
self
.
update_status
.
is_default
:
is_sync
=
True
# 更新状态
# 更新状态
bl_obj
.
write
(
bl_obj
.
write
(
{
'customs_clearance_status'
:
self
.
update_status
.
id
,
'process_time'
:
self
.
process_time
,
'state_explain'
:
self
.
state_explain
,
{
'customs_clearance_status'
:
self
.
update_status
.
id
,
'process_time'
:
self
.
process_time
,
'state_explain'
:
self
.
state_explain
,
'is_bl_sync'
:
is_sync
})
'is_bl_sync'
:
is_sync
})
ccs_base/wizard/update_bl_status_wizard.xml
浏览文件 @
47c73879
...
@@ -16,10 +16,12 @@
...
@@ -16,10 +16,12 @@
<field
name=
"bl_id"
invisible=
"1"
/>
<field
name=
"bl_id"
invisible=
"1"
/>
<field
name=
"current_status"
readonly=
"1"
/>
<field
name=
"current_status"
readonly=
"1"
/>
<field
name=
"last_process_time"
/>
<field
name=
"last_process_time"
/>
<field
name=
"update_status"
required=
"1"
domain=
"[('node_type','=','bl')]"
/>
<field
name=
"update_status"
required=
"1"
domain=
"[('id','in',next_code_ids)]"
/>
<field
name=
"process_time"
required=
"1"
string=
"Customs Clearance Status Process Time"
/>
<field
name=
"process_time"
required=
"1"
string=
"Customs Clearance Status Process Time"
/>
<field
name=
"state_explain"
invisible=
"1"
/>
<field
name=
"state_explain"
invisible=
"1"
/>
<field
name=
"is_batch"
invisible=
"1"
/>
<field
name=
"is_batch"
invisible=
"1"
/>
<field
name=
"next_code_ids"
invisible=
"1"
widget=
"many2many_tags"
/>
</group>
</group>
<group>
<group>
<field
name=
"is_ok"
/>
<field
name=
"is_ok"
/>
...
...
ccs_connect_tiktok/models/cc_bill_loading.py
浏览文件 @
47c73879
...
@@ -282,12 +282,12 @@ class CcBl(models.Model):
...
@@ -282,12 +282,12 @@ class CcBl(models.Model):
state_obj
=
self
.
env
[
'cc.node'
]
.
search
([(
'package_state'
,
'='
,
package_state_obj
.
id
)],
limit
=
1
)
state_obj
=
self
.
env
[
'cc.node'
]
.
search
([(
'package_state'
,
'='
,
package_state_obj
.
id
)],
limit
=
1
)
for
bl
in
self
:
for
bl
in
self
:
# 判断当前提单的关务提单状态是需要更新的前序节点,则进行修改和生成同步日志
# 判断当前提单的关务提单状态是需要更新的前序节点,则进行修改和生成同步日志
if
self
.
customs_clearance_status
.
is_before_node
(
state_obj
):
if
bl
.
customs_clearance_status
.
is_before_node
(
state_obj
):
# 判断提单下所有小包的同步日志是否都有已提货的同步日志
# 判断提单下所有小包的同步日志是否都有已提货的同步日志
is_all
=
self
.
check_multiple_bl_pickup_status_best
(
package_state_obj
)
is_all
=
bl
.
check_multiple_bl_pickup_status_best
(
package_state_obj
)
if
is_all
:
if
is_all
:
# 操作时间取小包对应操作时间最晚的一条
# 操作时间取小包对应操作时间最晚的一条
operate_time
=
sorted
(
self
.
ship_package_ids
.
mapped
(
'process_time'
),
reverse
=
True
)[
0
]
operate_time
=
sorted
(
bl
.
ship_package_ids
.
mapped
(
'process_time'
),
reverse
=
True
)[
0
]
# 检查该状态之前的所有节点是否都有同步日志,如果没有,则生成同步日志
# 检查该状态之前的所有节点是否都有同步日志,如果没有,则生成同步日志
before_node_obj
=
state_obj
.
get_before_node
(
node_type
=
'bl'
)
before_node_obj
=
state_obj
.
get_before_node
(
node_type
=
'bl'
)
is_ok
=
True
is_ok
=
True
...
@@ -299,6 +299,8 @@ class CcBl(models.Model):
...
@@ -299,6 +299,8 @@ class CcBl(models.Model):
before_minutes
=
before_node
.
calculate_total_interval
(
state_obj
)
before_minutes
=
before_node
.
calculate_total_interval
(
state_obj
)
bl
.
process_time
=
datetime
.
strptime
(
str
(
operate_time
),
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
-
timedelta
(
bl
.
process_time
=
datetime
.
strptime
(
str
(
operate_time
),
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
-
timedelta
(
minutes
=
before_minutes
)
minutes
=
before_minutes
)
bl
.
is_bl_sync
=
before_node
.
node_is_sync
()
self
.
_cr
.
commit
()
# 调用同步关务提单状态
# 调用同步关务提单状态
is_ok
=
bl
.
callback_track_bl
()
is_ok
=
bl
.
callback_track_bl
()
if
not
is_ok
:
if
not
is_ok
:
...
@@ -306,8 +308,12 @@ class CcBl(models.Model):
...
@@ -306,8 +308,12 @@ class CcBl(models.Model):
if
is_ok
:
if
is_ok
:
bl
.
customs_clearance_status
=
state_obj
.
id
bl
.
customs_clearance_status
=
state_obj
.
id
bl
.
process_time
=
operate_time
bl
.
process_time
=
operate_time
bl
.
is_bl_sync
=
state_obj
.
node_is_sync
()
self
.
_cr
.
commit
()
# 调用同步提单状态
# 调用同步提单状态
bl
.
callback_track_bl
()
bl
.
callback_track_bl
()
# 如果提单有小包变成了清关开始,提单状态变为清关中;如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成
bl
.
change_state_by_ship_package
()
def
check_multiple_bl_pickup_status_best
(
self
,
package_state_obj
):
def
check_multiple_bl_pickup_status_best
(
self
,
package_state_obj
):
"""
"""
...
@@ -431,8 +437,11 @@ class CcBl(models.Model):
...
@@ -431,8 +437,11 @@ class CcBl(models.Model):
ship_packages
=
self
.
env
[
'cc.ship.package'
]
.
search
([(
'bl_id'
,
'='
,
item
.
id
),
(
'is_sync'
,
'='
,
False
)])
ship_packages
=
self
.
env
[
'cc.ship.package'
]
.
search
([(
'bl_id'
,
'='
,
item
.
id
),
(
'is_sync'
,
'='
,
False
)])
is_ok
=
item
.
package_callback_func
(
ship_packages
.
ids
)
is_ok
=
item
.
package_callback_func
(
ship_packages
.
ids
)
# 根据小包状态更新提单关务状态
# 根据小包状态更新提单关务状态
if
is_ok
and
self
.
ship_package_ids
:
try
:
self
.
change_customs_state_by_ship_package
(
self
.
ship_package_ids
[
0
]
.
state
)
if
is_ok
and
item
.
ship_package_ids
:
item
.
change_customs_state_by_ship_package
(
item
.
ship_package_ids
[
0
]
.
state
)
except
Exception
as
e
:
logging
.
info
(
'change_customs_state_by_ship_package error:
%
s'
%
e
)
return
is_ok
return
is_ok
def
package_callback_func
(
self
,
ship_package_ids
):
def
package_callback_func
(
self
,
ship_package_ids
):
...
@@ -495,7 +504,7 @@ class CcBl(models.Model):
...
@@ -495,7 +504,7 @@ class CcBl(models.Model):
# self.batch_create_package_sync_logs_by_sql(log_values)
# self.batch_create_package_sync_logs_by_sql(log_values)
# 如果提单有小包变成了清关开始,提单状态变为清关中;如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成
# 如果提单有小包变成了清关开始,提单状态变为清关中;如果提单所有小包的清关节点变成"是完成节点",则该提单状态变成已完成
self
.
change_state_by_ship_package
()
#
self.change_state_by_ship_package()
return
is_ok
return
is_ok
def
batch_create_package_sync_logs_by_sql
(
self
,
log_values
):
def
batch_create_package_sync_logs_by_sql
(
self
,
log_values
):
...
...
ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
47c73879
...
@@ -162,6 +162,6 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -162,6 +162,6 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
self
.
current_status
.
tk_code
or
''
,
self
.
current_status
.
name
or
''
,
self
.
update_status
.
tk_code
or
''
,
self
.
current_status
.
tk_code
or
''
,
self
.
current_status
.
name
or
''
,
self
.
update_status
.
tk_code
or
''
,
self
.
update_status
.
name
or
''
))
self
.
update_status
.
name
or
''
))
# 如果提单有小包变成了清关开始,提单状态变为清关中;如果提单所有小包的清关节点变成“是完成节点”,则该提单状态变成已完成
# 如果提单有小包变成了清关开始,提单状态变为清关中;如果提单所有小包的清关节点变成“是完成节点”,则该提单状态变成已完成
bl_obj
.
change_state_by_ship_package
()
bl_obj
.
change_customs_state_by_ship_package
(
self
.
update_status
)
#根据小包状态更新提单关务状态
bl_obj
.
change_customs_state_by_ship_package
(
self
.
update_status
)
#根据小包状态更新提单关务状态
# bl_obj.change_state_by_ship_package()
return
obj
return
obj
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论