Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
34b886cb
提交
34b886cb
authored
10月 17, 2025
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提单上新增字段:尾程快递
取值:提单关联的大包对应下一个尾程快递匹配到到尾程快递,显示在提单上,若有多个 则显示多个 提单列表上新增该字段
上级
8dbdf3b4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
63 行增加
和
6 行删除
+63
-6
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+59
-6
cc_bl_view.xml
ccs_base/views/cc_bl_view.xml
+4
-0
没有找到文件。
ccs_base/models/cc_bill_loading.py
浏览文件 @
34b886cb
...
...
@@ -58,7 +58,7 @@ class CcBigPackage(models.Model):
# 提货相关字段
pickup_user_id
=
fields
.
Many2one
(
'res.users'
,
'Pickup User'
,
index
=
True
)
# 提货人
pickup_time
=
fields
.
Datetime
(
'Pickup Time'
)
# 提货时间
tally_state
=
fields
.
Selection
([
(
'unprocessed_goods'
,
'Unprocessed goods'
),
(
'picked_up'
,
'Picked Up'
),
...
...
@@ -647,7 +647,8 @@ class CcBL(models.Model):
big_package_qty
=
fields
.
Integer
(
string
=
'Big Package Qty'
)
# 已提货大包数量
picked_up_big_package_qty
=
fields
.
Integer
(
string
=
'Picked Up Big Package Qty'
,
compute
=
'cal_picked_up_big_package_qty'
,
picked_up_big_package_qty
=
fields
.
Integer
(
string
=
'Picked Up Big Package Qty'
,
compute
=
'cal_picked_up_big_package_qty'
,
store
=
True
)
# 理货大包数量
tally_big_package_qty
=
fields
.
Integer
(
string
=
'Tally Big Package Qty'
,
compute
=
'cal_tally_big_package_qty'
,
...
...
@@ -779,6 +780,58 @@ class CcBL(models.Model):
# 定义清关国家,关联到国家字段
cc_country_id
=
fields
.
Many2one
(
'res.country'
,
string
=
'CC Country'
)
# 新增尾程快递,many2many,cc.last.mile.provider
last_mile_provider_ids
=
fields
.
Many2many
(
'cc.last.mile.provider'
,
'cc_bill_loading_last_mile_provider_rel'
,
'bl_id'
,
'last_mile_provider_id'
,
string
=
'Last Mile Providers'
,
compute
=
'_compute_last_mile_provider_ids'
,
store
=
True
)
@api.depends
(
'big_package_ids'
,
'big_package_ids.next_provider_name'
)
def
_compute_last_mile_provider_ids
(
self
):
"""
提单关联的大包对应下一个尾程快递匹配到到尾程快递
"""
# 一次性获取所有尾程快递,避免重复查询
all_providers
=
self
.
env
[
'cc.last.mile.provider'
]
.
sudo
()
.
search
([])
# 预构建匹配值映射,提高查找效率
provider_matching_map
=
{}
for
provider
in
all_providers
:
if
provider
.
matching_value
:
# 预处理匹配值,避免重复split和lower操作
matching_values
=
[
value
.
lower
()
.
strip
()
for
value
in
provider
.
matching_value
.
split
(
'
\n
'
)
if
value
.
strip
()]
for
value
in
matching_values
:
if
value
not
in
provider_matching_map
:
provider_matching_map
[
value
]
=
[]
provider_matching_map
[
value
]
.
append
(
provider
.
id
)
for
bl
in
self
:
# 先清空现有记录
bl
.
last_mile_provider_ids
=
[(
6
,
0
,
[])]
if
not
bl
.
big_package_ids
:
continue
# 获取所有大包的下一个快递名称(去重)
provider_names
=
bl
.
big_package_ids
.
filtered
(
'next_provider_name'
)
.
mapped
(
'next_provider_name'
)
if
not
provider_names
:
continue
# 去重provider名称
provider_names
=
list
(
set
(
provider_names
))
# 使用集合存储匹配的provider ID,避免重复
matched_provider_ids
=
set
()
# 使用预构建的映射进行快速查找
for
provider_name
in
provider_names
:
provider_name_lower
=
provider_name
.
lower
()
.
strip
()
if
provider_name_lower
in
provider_matching_map
:
matched_provider_ids
.
update
(
provider_matching_map
[
provider_name_lower
])
# 更新字段值
if
matched_provider_ids
:
bl
.
last_mile_provider_ids
=
[(
6
,
0
,
list
(
matched_provider_ids
))]
def
push_clear_customs_start
(
self
,
utc_time
):
# 创建向导
push_node_obj
=
self
.
env
[
'cc.node'
]
.
sudo
()
.
search
(
...
...
@@ -870,17 +923,17 @@ class CcBL(models.Model):
}
}
def
check_is_done
(
self
,
is_email
=
False
,
**
kwargs
):
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
)
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!'
))
# 小包节点或提单节点不在已完成节点,提单不能变为已完成!
def
done_func
(
self
,
is_email
=
False
,
**
kwargs
):
def
done_func
(
self
,
is_email
=
False
,
**
kwargs
):
"""
变为已完成
"""
...
...
@@ -890,7 +943,7 @@ class CcBL(models.Model):
# 如果选择了忽略节点异常,则记录异常原因
if
kwargs
.
get
(
'exception_reason'
):
exception_reason
=
kwargs
[
'exception_reason'
]
#输出当前用户是什么语言
#
输出当前用户是什么语言
if
self
.
env
.
user
.
lang
==
'zh_CN'
:
message
=
'提单已完成,但存在节点异常,原因是:
%
s!'
%
exception_reason
else
:
...
...
ccs_base/views/cc_bl_view.xml
浏览文件 @
34b886cb
...
...
@@ -13,6 +13,7 @@
<field
optional=
"show"
name=
"customs_clearance_status"
string=
"Customs Clearance Status"
/>
<field
optional=
"show"
name=
"bl_no"
string=
"Bill of Loading No."
/>
<field
optional=
"show"
name=
"bl_date"
string=
"B/L Date"
/>
<field
optional=
"show"
name=
"last_mile_provider_ids"
string=
"Last Mile Providers"
widget=
"many2many_tags"
/>
<field
optional=
"hide"
name=
"transfer_bl_no"
string=
"Transfer Bill of Loading No."
/>
<field
optional=
"show"
name=
"customer_id"
string=
"Customer"
/>
<field
optional=
"show"
name=
"customs_bl_no"
string=
"Customs Bill of Loading No."
/>
...
...
@@ -140,6 +141,7 @@
<group>
<group>
<field
name=
"bl_date"
string=
"B/L Date"
/>
<field
name=
"last_mile_provider_ids"
string=
"Last Mile Providers"
widget=
"many2many_tags"
/>
<field
name=
"transfer_bl_no"
/>
<field
name=
"customer_id"
string=
"Customer"
/>
<field
name=
"customs_bl_no"
string=
"Customs Bill of Loading No."
/>
...
...
@@ -308,6 +310,8 @@
domain=
"[('cc_deadline', '<', time.strftime('%Y-%m-%d'))]"
/>
<separator/>
<group
expand=
"0"
string=
"Group By"
>
<!-- <filter domain="[]" name="groupby_last_mile_provider_ids" string="Last Mile Providers"
context="{'group_by': 'last_mile_provider_ids'}"/> -->
<filter
domain=
"[]"
name=
"groupby_customer_id"
string=
"Customer"
context=
"{'group_by': 'customer_id'}"
/>
<filter
domain=
"[]"
name=
"groupby_cc_company_id"
string=
"CC Company"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论