Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
31e4b309
提交
31e4b309
authored
10月 30, 2024
作者:
刘擎阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.增加提单批量更新小包
上级
3b57bdd7
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
87 行增加
和
16 行删除
+87
-16
zh_CN.po
ccs_base/i18n/zh_CN.po
+13
-0
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+11
-0
cc_bl_view.xml
ccs_base/views/cc_bl_view.xml
+13
-1
batch_input_ship_package_statu_wizard.py
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
+24
-5
batch_input_ship_package_statu_wizard.xml
ccs_base/wizard/batch_input_ship_package_statu_wizard.xml
+3
-1
batch_input_ship_package_statu_wizard.py
...ct_tiktok/wizard/batch_input_ship_package_statu_wizard.py
+23
-9
没有找到文件。
ccs_base/i18n/zh_CN.po
浏览文件 @
31e4b309
...
@@ -352,6 +352,11 @@ msgstr "买方所在地区"
...
@@ -352,6 +352,11 @@ msgstr "买方所在地区"
msgid "By Node"
msgid "By Node"
msgstr "节点"
msgstr "节点"
#. module: ccs_base
#: model:ir.model.fields,field_description:ccs_base.field_batch_input_ship_package_status_wizard__bl_count
msgid "Bl count"
msgstr "已选提单"
#. module: ccs_base
#. module: ccs_base
#: model:ir.model.fields.selection,name:ccs_base.selection__batch_input_ship_package_status_wizard__select_type__tracking_no
#: model:ir.model.fields.selection,name:ccs_base.selection__batch_input_ship_package_status_wizard__select_type__tracking_no
msgid "By TrackingNo"
msgid "By TrackingNo"
...
@@ -802,6 +807,14 @@ msgstr "导出报关数据"
...
@@ -802,6 +807,14 @@ msgstr "导出报关数据"
msgid "Export customs clearance bill of lading file"
msgid "Export customs clearance bill of lading file"
msgstr "导出清关提单文件"
msgstr "导出清关提单文件"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#, python-format
#: model:ir.actions.server,name:ccs_base.batch_input_ship_package_status_server
msgid "Update the status of the small package"
msgstr "更新小包状态"
#. module: ccs_base
#. module: ccs_base
#. odoo-python
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
...
...
ccs_base/models/cc_bill_loading.py
浏览文件 @
31e4b309
...
@@ -479,6 +479,17 @@ class CcBL(models.Model):
...
@@ -479,6 +479,17 @@ class CcBL(models.Model):
'target'
:
'new'
,
'target'
:
'new'
,
}
}
def
batch_input_ship_package_status_wizard
(
self
):
"""批量更新小包状态"""
return
{
'name'
:
_
(
'Update the status of the small package'
),
'type'
:
'ir.actions.act_window'
,
'view_mode'
:
'form'
,
'res_model'
:
'batch.input.ship.package.status.wizard'
,
'target'
:
'new'
,
'context'
:
{
'active_id'
:
self
.
ids
,
'default_is_batch'
:
True
,
'default_bl_id'
:
self
.
ids
}
}
@api.depends
(
'big_package_ids'
,
'big_package_ids.tally_state'
,
'big_package_ids.is_cancel'
)
@api.depends
(
'big_package_ids'
,
'big_package_ids.tally_state'
,
'big_package_ids.is_cancel'
)
def
cal_tally_big_package_qty
(
self
):
def
cal_tally_big_package_qty
(
self
):
"""
"""
...
...
ccs_base/views/cc_bl_view.xml
浏览文件 @
31e4b309
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
<header>
<header>
<!-- # 为action_batch_input_ship_package_wizard添加一个按钮, 上下文中添加bl_id-->
<!-- # 为action_batch_input_ship_package_wizard添加一个按钮, 上下文中添加bl_id-->
<button
name=
"%(action_batch_input_ship_package_wizard)d"
type=
"action"
class=
"oe_highlight"
<button
name=
"%(action_batch_input_ship_package_wizard)d"
type=
"action"
class=
"oe_highlight"
string=
"Update Ship Package Status"
context=
"{'default_bl_id': active_id}"
/>
string=
"Update Ship Package Status"
context=
"{'default_bl_id': active_id
, 'active_id': id
}"
/>
<field
name=
"state"
widget=
"statusbar"
options=
"{'clickable': '1'}"
/>
<field
name=
"state"
widget=
"statusbar"
options=
"{'clickable': '1'}"
/>
</header>
</header>
...
@@ -346,4 +346,15 @@
...
@@ -346,4 +346,15 @@
</field>
</field>
</record>
</record>
<record
id=
"batch_input_ship_package_status_server"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Update the status of the small package
</field>
<field
name=
"model_id"
ref=
"model_cc_bl"
/>
<field
name=
"binding_model_id"
ref=
"model_cc_bl"
/>
<field
name=
"state"
>
code
</field>
<field
name=
"code"
>
if records:
action = records.batch_input_ship_package_status_wizard()
</field>
</record>
</odoo>
</odoo>
\ No newline at end of file
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
31e4b309
...
@@ -11,6 +11,16 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -11,6 +11,16 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
_name
=
'batch.input.ship.package.status.wizard'
_name
=
'batch.input.ship.package.status.wizard'
_description
=
'Batch Update the status of the small package'
# 批量更新小包状态向导
_description
=
'Batch Update the status of the small package'
# 批量更新小包状态向导
def
get_order
(
self
):
"""
得到单据
:return:
"""
order_id
=
self
.
_context
.
get
(
'active_id'
)
if
type
(
order_id
)
!=
list
:
order_id
=
[
self
.
_context
.
get
(
'active_id'
)]
return
self
.
env
[
'cc.bl'
]
.
browse
(
order_id
)
@api.onchange
(
'select_type'
,
'current_status'
)
@api.onchange
(
'select_type'
,
'current_status'
)
def
onchange_select_type
(
self
):
def
onchange_select_type
(
self
):
for
item
in
self
:
for
item
in
self
:
...
@@ -21,7 +31,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -21,7 +31,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
domain
=
{
'update_status'
:
supplier_domain
}
domain
=
{
'update_status'
:
supplier_domain
}
return
{
'domain'
:
domain
}
return
{
'domain'
:
domain
}
bl_id
=
fields
.
Many2one
(
'cc.bl'
,
'Bill of Loading'
,
required
=
True
)
bl_id
=
fields
.
Many2one
(
'cc.bl'
,
'Bill of Loading'
)
@api.onchange
(
'current_status'
)
@api.onchange
(
'current_status'
)
def
change_current_status
(
self
):
def
change_current_status
(
self
):
...
@@ -35,6 +45,11 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -35,6 +45,11 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
(
'tracking_no'
,
'By TrackingNo'
)
(
'tracking_no'
,
'By TrackingNo'
)
],
string
=
'Select Type'
,
default
=
'node'
)
],
string
=
'Select Type'
,
default
=
'node'
)
def
get_bl_count
(
self
):
# print(self.get_order())
return
len
(
self
.
get_order
())
bl_count
=
fields
.
Integer
(
'Bl count'
,
default
=
get_bl_count
)
current_status
=
fields
.
Many2one
(
'cc.node'
,
'Select Node'
)
current_status
=
fields
.
Many2one
(
'cc.node'
,
'Select Node'
)
next_code_ids
=
fields
.
Many2many
(
'cc.node'
,
'node_next_node_wizard_rel'
,
'node_id'
,
'next_node_id'
,
'Next Node'
,
next_code_ids
=
fields
.
Many2many
(
'cc.node'
,
'node_next_node_wizard_rel'
,
'node_id'
,
'next_node_id'
,
'Next Node'
,
related
=
'current_status.next_code_ids'
)
related
=
'current_status.next_code_ids'
)
...
@@ -45,8 +60,9 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -45,8 +60,9 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
help
=
'A TrackingNo no is one line,separate multiple tracking numbers with line breaks'
)
help
=
'A TrackingNo no is one line,separate multiple tracking numbers with line breaks'
)
update_package_count
=
fields
.
Integer
(
'Select Package Count'
,
compute
=
'_compute_update_package_count'
)
update_package_count
=
fields
.
Integer
(
'Select Package Count'
,
compute
=
'_compute_update_package_count'
)
is_batch
=
fields
.
Boolean
(
'Batch'
,
default
=
False
)
@api.depends
(
'bl_id'
,
'select_type'
,
'select_tracking_no'
,
'exclude_tracking_no'
,
'current_status'
)
@api.depends
(
'bl_id'
,
'select_type'
,
'select_tracking_no'
,
'exclude_tracking_no'
,
'current_status'
,
'bl_count'
)
def
_compute_update_package_count
(
self
):
def
_compute_update_package_count
(
self
):
for
record
in
self
:
for
record
in
self
:
obj
=
self
.
get_process_package
()
obj
=
self
.
get_process_package
()
...
@@ -107,18 +123,21 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -107,18 +123,21 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
def
get_process_package
(
self
):
def
get_process_package
(
self
):
"""获取要更新的小包"""
"""获取要更新的小包"""
parcels
=
[]
parcels
=
[]
bl_objs
=
self
.
get_order
()
if
self
.
select_type
==
'tracking_no'
:
if
self
.
select_type
==
'tracking_no'
:
if
self
.
select_tracking_no
:
if
self
.
select_tracking_no
:
tracking_no_list
=
self
.
select_tracking_no
.
split
(
'
\n
'
)
tracking_no_list
=
self
.
select_tracking_no
.
split
(
'
\n
'
)
tracking_no_list
=
[
i
.
strip
()
for
i
in
tracking_no_list
if
i
.
strip
()]
tracking_no_list
=
[
i
.
strip
()
for
i
in
tracking_no_list
if
i
.
strip
()]
# parcels = self.env['cc.ship.package'].search(
# [('bl_id', '=', self.bl_id.id), ('tracking_no', 'in', tracking_no_list)])
parcels
=
self
.
env
[
'cc.ship.package'
]
.
search
(
parcels
=
self
.
env
[
'cc.ship.package'
]
.
search
(
[(
'bl_id'
,
'
='
,
self
.
bl_id
.
id
),
(
'tracking_no'
,
'in'
,
tracking_no_list
)])
[(
'bl_id'
,
'
in'
,
bl_objs
.
ids
),
(
'tracking_no'
,
'in'
,
tracking_no_list
)])
else
:
else
:
# 获取所有的小包
# 获取所有的小包
if
self
.
current_status
:
if
self
.
current_status
:
parcel_obj
=
self
.
env
[
'cc.ship.package'
]
parcel_obj
=
self
.
env
[
'cc.ship.package'
]
parcels
=
parcel_obj
.
search
([(
'bl_id'
,
'='
,
self
.
bl_id
.
id
),
(
'state'
,
'='
,
self
.
current_status
.
id
)])
# parcels = parcel_obj.search([('bl_id', '=', self.bl_id.id), ('state', '=', self.current_status.id)])
parcels
=
parcel_obj
.
search
([(
'bl_id'
,
'in'
,
bl_objs
.
ids
),
(
'state'
,
'='
,
self
.
current_status
.
id
)])
# 排除面单号
# 排除面单号
if
self
.
exclude_tracking_no
:
if
self
.
exclude_tracking_no
:
exclude_waybill_no_list
=
self
.
exclude_tracking_no
.
split
(
'
\n
'
)
exclude_waybill_no_list
=
self
.
exclude_tracking_no
.
split
(
'
\n
'
)
...
...
ccs_base/wizard/batch_input_ship_package_statu_wizard.xml
浏览文件 @
31e4b309
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
<!-- </div>-->
<!-- </div>-->
<!-- </group>-->
<!-- </group>-->
<group>
<group>
<field
name=
"bl_id"
required=
"1"
/>
<field
name=
"bl_count"
attrs=
"{'invisible': [('is_batch', '=', False)]}"
readonly=
"1"
/>
<field
name=
"bl_id"
required=
"0"
attrs=
"{'invisible': [('is_batch', '=', True)]}"
readonly=
"1"
/>
<field
name=
"select_type"
required=
"1"
/>
<field
name=
"select_type"
required=
"1"
/>
<field
name=
"current_status"
<field
name=
"current_status"
attrs=
"{'invisible':[('select_type','=','tracking_no')],'required':[('select_type','=','node')]}"
attrs=
"{'invisible':[('select_type','=','tracking_no')],'required':[('select_type','=','node')]}"
...
@@ -40,6 +41,7 @@
...
@@ -40,6 +41,7 @@
<field
name=
"process_time"
required=
"1"
string=
"Process Time"
/>
<field
name=
"process_time"
required=
"1"
string=
"Process Time"
/>
<field
name=
"node_exception_reason_id"
options=
"{'no_create':True}"
/>
<field
name=
"node_exception_reason_id"
options=
"{'no_create':True}"
/>
<field
name=
"state_explain"
/>
<field
name=
"state_explain"
/>
<field
name=
"is_batch"
invisible=
"1"
/>
</group>
</group>
<group>
<group>
<field
name=
"is_ok"
/>
<field
name=
"is_ok"
/>
...
...
ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
31e4b309
...
@@ -47,12 +47,15 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -47,12 +47,15 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
package_ids
=
[]
package_ids
=
[]
package_obj
=
False
package_obj
=
False
package_model
=
self
.
env
[
'cc.ship.package'
]
package_model
=
self
.
env
[
'cc.ship.package'
]
bl_objs
=
self
.
get_order
()
if
item
.
select_type
==
'tracking_no'
:
if
item
.
select_type
==
'tracking_no'
:
if
item
.
select_tracking_no
:
if
item
.
select_tracking_no
:
tracking_no_list
=
item
.
select_tracking_no
.
split
(
'
\n
'
)
tracking_no_list
=
item
.
select_tracking_no
.
split
(
'
\n
'
)
tracking_no_list
=
[
i
.
strip
()
for
i
in
tracking_no_list
if
i
.
strip
()]
tracking_no_list
=
[
i
.
strip
()
for
i
in
tracking_no_list
if
i
.
strip
()]
# package_obj = package_model.search(
# [('bl_id', '=', item.bl_id.id), ('tracking_no', 'in', tracking_no_list)])
package_obj
=
package_model
.
search
(
package_obj
=
package_model
.
search
(
[(
'bl_id'
,
'
='
,
item
.
bl_id
.
id
),
(
'tracking_no'
,
'in'
,
tracking_no_list
)])
[(
'bl_id'
,
'
in'
,
bl_objs
.
ids
),
(
'tracking_no'
,
'in'
,
tracking_no_list
)])
# 如果不是同一个状态 进行提示
# 如果不是同一个状态 进行提示
state_arr
=
[
package
.
state
.
id
for
package
in
package_obj
]
state_arr
=
[
package
.
state
.
id
for
package
in
package_obj
]
if
len
(
state_arr
)
>
0
:
if
len
(
state_arr
)
>
0
:
...
@@ -63,8 +66,10 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -63,8 +66,10 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
else
:
else
:
# 获取所有的小包
# 获取所有的小包
if
item
.
current_status
:
if
item
.
current_status
:
# package_obj = package_model.search(
# [('bl_id', '=', item.bl_id.id), ('state', '=', item.current_status.id)])
package_obj
=
package_model
.
search
(
package_obj
=
package_model
.
search
(
[(
'bl_id'
,
'
='
,
item
.
bl_id
.
id
),
(
'state'
,
'='
,
item
.
current_status
.
id
)])
[(
'bl_id'
,
'
in'
,
bl_objs
.
ids
),
(
'state'
,
'='
,
item
.
current_status
.
id
)])
if
package_obj
and
not
item
.
is_skip_check
:
if
package_obj
and
not
item
.
is_skip_check
:
if
item
.
current_status
:
if
item
.
current_status
:
# 更新日志里没有 当前节点(不包括默认节点) 【已提货】的小包
# 更新日志里没有 当前节点(不包括默认节点) 【已提货】的小包
...
@@ -83,6 +88,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -83,6 +88,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
def
submit
(
self
):
def
submit
(
self
):
# 判断排除的面单号是否都存在 异常小包中
# 判断排除的面单号是否都存在 异常小包中
bl_objs
=
self
.
get_order
()
if
not
self
.
is_skip_check
:
if
not
self
.
is_skip_check
:
if
self
.
select_type
==
'node'
:
if
self
.
select_type
==
'node'
:
exclude_waybill_no_list
=
[]
exclude_waybill_no_list
=
[]
...
@@ -115,11 +121,19 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -115,11 +121,19 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
[
package
.
tracking_no
for
package
in
self
.
ship_package_ids
]))
[
package
.
tracking_no
for
package
in
self
.
ship_package_ids
]))
obj
=
super
(
BatchInputShipPackageStatusWizard
,
self
)
.
submit
()
obj
=
super
(
BatchInputShipPackageStatusWizard
,
self
)
.
submit
()
# 生成sns日志
# 生成sns日志
self
.
bl_id
.
message_post
(
body
=
_
(
'[
%
s]
%
sUpdate to[
%
s]
%
s'
)
%
(
# self.bl_id.message_post(body=_('[%s]%sUpdate to[%s]%s') % (
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 ''))
# 如果提单有小包变成了清关开始,提单状态变为清关中
# # 如果提单有小包变成了清关开始,提单状态变为清关中
if
self
.
bl_id
.
state
==
'draft'
and
self
.
bl_id
.
ship_package_ids
.
filtered
(
# if self.bl_id.state == 'draft' and self.bl_id.ship_package_ids.filtered(
lambda
line
:
line
.
state
.
tk_code
==
'cb_imcustoms_start'
):
# lambda line: line.state.tk_code == 'cb_imcustoms_start'):
self
.
bl_id
.
ccing_func
()
# self.bl_id.ccing_func()
for
bl_obj
in
bl_objs
:
bl_obj
.
message_post
(
body
=
_
(
'[
%
s]
%
sUpdate to[
%
s]
%
s'
)
%
(
self
.
current_status
.
tk_code
or
''
,
self
.
current_status
.
name
or
''
,
self
.
update_status
.
tk_code
or
''
,
self
.
update_status
.
name
or
''
))
# 如果提单有小包变成了清关开始,提单状态变为清关中
if
bl_obj
.
state
==
'draft'
and
bl_obj
.
ship_package_ids
.
filtered
(
lambda
line
:
line
.
state
.
tk_code
==
'cb_imcustoms_start'
):
bl_obj
.
ccing_func
()
return
obj
return
obj
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论