Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
276c59df
提交
276c59df
authored
8月 27, 2024
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
导出报关数据
上级
847e9d52
全部展开
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
107 行增加
和
69 行删除
+107
-69
__init__.py
ccs_base/__init__.py
+1
-0
__manifest__.py
ccs_base/__manifest__.py
+1
-0
export_bl_and_package_xlsx.py
ccs_base/controllers/export_bl_and_package_xlsx.py
+0
-0
data.xml
ccs_base/data/data.xml
+5
-0
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+26
-1
cc_bl_view.xml
ccs_base/views/cc_bl_view.xml
+4
-7
batch_input_ship_package_statu_wizard.py
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
+6
-6
export_bl_big_package_xlsx_wizard.py
ccs_base/wizard/export_bl_big_package_xlsx_wizard.py
+18
-48
export_bl_big_package_xlsx_wizard.xml
ccs_base/wizard/export_bl_big_package_xlsx_wizard.xml
+37
-0
batch_input_ship_package_statu_wizard.py
...ct_tiktok/wizard/batch_input_ship_package_statu_wizard.py
+9
-7
没有找到文件。
ccs_base/__init__.py
浏览文件 @
276c59df
from
.
import
wizard
from
.
import
wizard
from
.
import
models
from
.
import
models
from
.
import
controllers
ccs_base/__manifest__.py
浏览文件 @
276c59df
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
'security/account_security.xml'
,
'security/account_security.xml'
,
'security/ir.model.access.csv'
,
'security/ir.model.access.csv'
,
'wizard/batch_input_ship_package_statu_wizard.xml'
,
'wizard/batch_input_ship_package_statu_wizard.xml'
,
'wizard/export_bl_big_package_xlsx_wizard.xml'
,
'data/data.xml'
,
'data/data.xml'
,
'views/menu_view.xml'
,
'views/menu_view.xml'
,
'views/cc_clearance_file_view.xml'
,
'views/cc_clearance_file_view.xml'
,
...
...
ccs_base/controllers/export_bl_and_package_xlsx.py
浏览文件 @
276c59df
差异被折叠。
点击展开。
ccs_base/data/data.xml
浏览文件 @
276c59df
...
@@ -10,5 +10,9 @@
...
@@ -10,5 +10,9 @@
<field
name=
"value"
>
{'https': 'socks5://192.168.0.254:1080'}
</field>
<field
name=
"value"
>
{'https': 'socks5://192.168.0.254:1080'}
</field>
</record>
</record>
<record
id=
"parcel_export_num"
model=
"ir.config_parameter"
>
<field
name=
"key"
>
parcel_export_num
</field>
<field
name=
"value"
>
50000
</field>
</record>
</data>
</data>
</odoo>
</odoo>
\ No newline at end of file
ccs_base/models/cc_bill_loading.py
浏览文件 @
276c59df
...
@@ -373,7 +373,7 @@ class CcShipPackage(models.Model):
...
@@ -373,7 +373,7 @@ class CcShipPackage(models.Model):
def
action_show_package_good
(
self
):
def
action_show_package_good
(
self
):
# 返回一个action,显示商品
# 返回一个action,显示商品
return
{
return
{
'name'
:
'Goods'
,
'name'
:
_
(
'Goods'
)
,
'type'
:
'ir.actions.act_window'
,
'type'
:
'ir.actions.act_window'
,
'res_model'
:
'cc.package.good'
,
'res_model'
:
'cc.package.good'
,
'view_mode'
:
'tree,form'
,
'view_mode'
:
'tree,form'
,
...
@@ -523,6 +523,31 @@ class CcBL(models.Model):
...
@@ -523,6 +523,31 @@ class CcBL(models.Model):
else
:
else
:
raise
UserError
(
reason
)
raise
UserError
(
reason
)
def
action_batch_export_package
(
self
):
"""
导出报关文件
"""
# error_order = []
# for item in order_obj:
# # item.ship_package_ids
# parcel_ids = item.big_package_ids.mapped('ship_package_ids')
# if not parcel_ids:
# error_order.append(item.bl_no)
# continue
# good_parcels = parcel_ids.mapped('good_ids')
# if len(good_parcels) == 0:
# error_order.append(item.bl_no)
# if error_order:
# raise ValidationError(f"{','.join(error_order)},没有任何商品信息可导出报关数据")
return
{
'name'
:
_
(
'导出报关文件'
),
'type'
:
'ir.actions.act_window'
,
'view_mode'
:
'form'
,
'res_model'
:
'export.bl.big.package.xlsx.wizard'
,
'target'
:
'new'
,
'context'
:
{
'active_id'
:
self
.
ids
,
},
}
# # 添加报关单字段
# # 添加报关单字段
# cdo_ids = fields.One2many('cc.customers.declaration.order', 'bl_id', string='Customers Declaration Order')
# cdo_ids = fields.One2many('cc.customers.declaration.order', 'bl_id', string='Customers Declaration Order')
#
#
...
...
ccs_base/views/cc_bl_view.xml
浏览文件 @
276c59df
...
@@ -173,7 +173,7 @@
...
@@ -173,7 +173,7 @@
<field
name=
"model"
>
cc.bl
</field>
<field
name=
"model"
>
cc.bl
</field>
<field
name=
"arch"
type=
"xml"
>
<field
name=
"arch"
type=
"xml"
>
<search
string=
"Bill of Loading"
>
<search
string=
"Bill of Loading"
>
<field
name=
"bl_no"
string=
"
模糊搜索
"
<field
name=
"bl_no"
string=
"
Search
"
filter_domain=
"['|', ('bl_no', 'ilike', self), ('customs_bl_no', 'ilike', self)]"
/>
filter_domain=
"['|', ('bl_no', 'ilike', self), ('customs_bl_no', 'ilike', self)]"
/>
<separator/>
<separator/>
...
@@ -243,9 +243,6 @@
...
@@ -243,9 +243,6 @@
<field
name=
"domain"
>
[]
</field>
<field
name=
"domain"
>
[]
</field>
<field
name=
"context"
>
{}
</field>
<field
name=
"context"
>
{}
</field>
<field
name=
"help"
type=
"html"
>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
[Bill of Loading] 还没有哦!点左上角的[创建]按钮,沙发归你了!
</p>
<p>
<p>
</p>
</p>
</field>
</field>
...
@@ -319,15 +316,15 @@
...
@@ -319,15 +316,15 @@
<!-- </field>-->
<!-- </field>-->
<!-- </record>-->
<!-- </record>-->
<!-- <menuitem sequence="10" name="Bill of Loading" id="menu_cc_bl" action="action_cc_bl" web_icon="ccs_base,static/description/icon3.png"/>-->
<!--
导出报关数据
<menuitem sequence="10" name="Bill of Loading" id="menu_cc_bl" action="action_cc_bl" web_icon="ccs_base,static/description/icon3.png"/>-->
<record
id=
"export_order_big_package_xls_server"
model=
"ir.actions.server"
>
<record
id=
"export_order_big_package_xls_server"
model=
"ir.actions.server"
>
<field
name=
"name"
>
导出报关数据
</field>
<field
name=
"name"
>
Export customs declaration data
</field>
<field
name=
"model_id"
ref=
"model_cc_bl"
/>
<field
name=
"model_id"
ref=
"model_cc_bl"
/>
<field
name=
"binding_model_id"
ref=
"model_cc_bl"
/>
<field
name=
"binding_model_id"
ref=
"model_cc_bl"
/>
<field
name=
"state"
>
code
</field>
<field
name=
"state"
>
code
</field>
<field
name=
"code"
>
<field
name=
"code"
>
if records:
if records:
action = records.
export_order_big_package_xls_action
()
action = records.
action_batch_export_package
()
</field>
</field>
</record>
</record>
...
...
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
276c59df
...
@@ -21,7 +21,7 @@ PUSH_TYPE = [
...
@@ -21,7 +21,7 @@ PUSH_TYPE = [
# 包括以下字段,提单, 当前节点, 更新节点, 排除面单号, 排除状态
# 包括以下字段,提单, 当前节点, 更新节点, 排除面单号, 排除状态
class
BatchInputShipPackageStatusWizard
(
models
.
TransientModel
):
class
BatchInputShipPackageStatusWizard
(
models
.
TransientModel
):
_name
=
'batch.input.ship.package.status.wizard'
_name
=
'batch.input.ship.package.status.wizard'
_description
=
'
批量更新小包状态向导'
_description
=
'
Batch Update the status of the small package'
#批量更新小包状态向导
@api.onchange
(
'select_type'
,
'current_status'
)
@api.onchange
(
'select_type'
,
'current_status'
)
def
onchange_select_type
(
self
):
def
onchange_select_type
(
self
):
...
@@ -68,25 +68,25 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -68,25 +68,25 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
def
submit
(
self
):
def
submit
(
self
):
# 确认数据
# 确认数据
if
not
self
.
is_ok
:
if
not
self
.
is_ok
:
raise
ValidationError
(
'
请确认以上数据正确.'
)
raise
ValidationError
(
'
Please confirm that the above data is correct.'
)
# 请确认以上数据正确
parcels
=
self
.
get_process_package
()
parcels
=
self
.
get_process_package
()
if
not
parcels
:
if
not
parcels
:
raise
ValidationError
(
'
没有找到要更新的小包.'
)
raise
ValidationError
(
'
No package to update found.'
)
# 没有找到要更新的小包
# 判断异常状态是否选择了异常原因
# 判断异常状态是否选择了异常原因
reason_obj
=
self
.
env
[
'cc.node.exception.reason'
]
.
search
([(
'code_id'
,
'='
,
self
.
update_status
.
id
)])
reason_obj
=
self
.
env
[
'cc.node.exception.reason'
]
.
search
([(
'code_id'
,
'='
,
self
.
update_status
.
id
)])
if
reason_obj
and
not
self
.
node_exception_reason_id
:
if
reason_obj
and
not
self
.
node_exception_reason_id
:
raise
ValidationError
(
'
请选择异常原因!'
)
raise
ValidationError
(
'
Please select the reason for the exception!'
)
# 请选择异常原因
# 更新状态
# 更新状态
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
,
'process_time'
:
self
.
process_time
,
'state_explain'
:
self
.
state_explain
,
'is_sync'
:
False
})
'process_time'
:
self
.
process_time
,
'state_explain'
:
self
.
state_explain
,
'is_sync'
:
False
})
# 生成sns日志
# 生成sns日志
# self.bl_id.message_post(body='%s更新为%s' % (self.current_status.name or '', self.update_status.name or ''))
# self.bl_id.message_post(body='%s更新为%s' % (self.current_status.name or '', self.update_status.name or ''))
# 跳转显示本次更新状态的小包
# 跳转显示本次更新状态的小包
更新小包状态
return
{
return
{
'name'
:
'更新小包状态'
,
'name'
:
_
(
'Update the status of the small package'
)
,
'type'
:
'ir.actions.act_window'
,
'type'
:
'ir.actions.act_window'
,
'res_model'
:
'cc.ship.package'
,
'res_model'
:
'cc.ship.package'
,
'view_mode'
:
'tree,form'
,
'view_mode'
:
'tree,form'
,
...
...
ccs_base/wizard/export_bl_big_package_xlsx_wizard.py
浏览文件 @
276c59df
...
@@ -4,62 +4,32 @@
...
@@ -4,62 +4,32 @@
from
odoo
import
models
,
api
,
fields
from
odoo
import
models
,
api
,
fields
from
odoo.exceptions
import
Warning
,
ValidationError
from
odoo.exceptions
import
Warning
,
ValidationError
class
ExportBlBigPackageXlsxWizard
(
models
.
TransientModel
):
class
ExportBlBigPackageXlsxWizard
(
models
.
TransientModel
):
_name
=
'export.bl.big.package.xlsx.wizard'
_name
=
'export.bl.big.package.xlsx.wizard'
_description
=
'导出报关文件'
_description
=
'导出报关文件'
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'
]
.
sudo
()
.
browse
(
order_id
)
# 增加选择类型字段, 按节点和按面单号(多条)
# 增加选择类型字段, 是否分大包导出
select_type
=
fields
.
Selection
([
select_type
=
fields
.
Selection
([(
'yes'
,
'YES'
),
(
'no'
,
'NO'
)],
string
=
'Whether to export in Big packages'
)
(
'yes'
,
'YES'
),
(
'no'
,
'NO'
)
],
string
=
'Whether to export in Big packages'
)
# 批量更新小包状态
def
submit
(
self
):
def
submit
(
self
):
# 确认数据
"""
if
not
self
.
is_ok
:
是否分大包,如果不分,就是提单一个文件,命名 提单号;如果分,一个提单一个大包一个文件,命名 提单号➕大包号
raise
ValidationError
(
'请确认以上数据正确.'
)
"""
parcels
=
self
.
get_process_package
()
order_obj
=
self
.
get_order
()
arr
=
[
item
.
id
for
item
in
order_obj
]
if
not
parcels
:
raise
ValidationError
(
'没有找到要更新的小包.'
)
# 判断异常状态是否选择了异常原因
reason_obj
=
self
.
env
[
'cc.node.exception.reason'
]
.
search
([(
'code_id'
,
'='
,
self
.
update_status
.
id
)])
if
reason_obj
and
not
self
.
node_exception_reason_id
:
raise
ValidationError
(
'请选择异常原因!'
)
# 更新状态
parcels
.
write
(
{
'state'
:
self
.
update_status
.
id
,
'node_exception_reason_id'
:
self
.
node_exception_reason_id
.
id
,
'process_time'
:
self
.
process_time
,
'state_explain'
:
self
.
state_explain
,
'is_sync'
:
False
})
# 生成sns日志
# self.bl_id.message_post(body='%s更新为%s' % (self.current_status.name or '', self.update_status.name or ''))
# 跳转显示本次更新状态的小包
return
{
'name'
:
'更新小包状态'
,
'type'
:
'ir.actions.act_window'
,
'res_model'
:
'cc.ship.package'
,
'view_mode'
:
'tree,form'
,
'domain'
:
[(
'id'
,
'in'
,
parcels
.
ids
)],
}
def
export_order_big_package_xls_action
(
self
):
error_order
=
[]
for
item
in
self
:
item
.
ship_package_ids
parcel_ids
=
item
.
big_package_ids
.
mapped
(
'ship_package_ids'
)
if
not
parcel_ids
:
error_order
.
append
(
item
.
master_business_no
)
continue
good_parcels
=
parcel_ids
.
filtered
(
lambda
x
:
x
.
item_text
)
if
len
(
good_parcels
)
==
0
:
error_order
.
append
(
item
.
master_business_no
)
if
error_order
:
raise
ValidationError
(
f
"{','.join(error_order)},没有任何商品信息可导出报关数据"
)
arr
=
[
item
.
id
for
item
in
self
]
return
{
return
{
'type'
:
'ir.actions.act_url'
,
'type'
:
'ir.actions.act_url'
,
'url'
:
'/export/
flight_package/xls/
%
s/
%
s'
%
(
arr
,
self
.
select_type
),
'url'
:
'/export/
bl/package/xls/
%
s/
%
s'
%
(
arr
,
self
.
select_type
),
'target'
:
'new'
,
'target'
:
'new'
,
}
}
ccs_base/wizard/export_bl_big_package_xlsx_wizard.xml
0 → 100644
浏览文件 @
276c59df
<?xml version="1.0" encoding="utf-8"?>
<!-- © <2016> <heyang>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo>
<data>
<record
id=
"view_export_bl_big_package_xlsx_wizard"
model=
"ir.ui.view"
>
<field
name=
"name"
>
导出报关文件
</field>
<field
name=
"model"
>
export.bl.big.package.xlsx.wizard
</field>
<field
name=
"arch"
type=
"xml"
>
<form
string=
"导出报关文件"
>
<sheet>
<group>
<field
name=
"select_type"
required=
"1"
/>
</group>
<footer>
<button
name=
"submit"
type=
"object"
string=
"Submit"
class=
"oe_highlight"
/>
<button
string=
"Close"
special=
"cancel"
/>
</footer>
</sheet>
</form>
</field>
</record>
<!--定义视图动作-->
<record
model=
"ir.actions.act_window"
id=
"action_export_bl_big_package_xlsx_wizard"
>
<field
name=
"name"
>
导出报关文件
</field>
<field
name=
"res_model"
>
export.bl.big.package.xlsx.wizard
</field>
<field
name=
"view_mode"
>
form
</field>
<field
name=
"target"
>
new
</field>
</record>
</data>
</odoo>
\ No newline at end of file
ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
276c59df
...
@@ -5,11 +5,8 @@ from odoo import models, api, fields
...
@@ -5,11 +5,8 @@ from odoo import models, api, fields
from
odoo.exceptions
import
Warning
,
ValidationError
from
odoo.exceptions
import
Warning
,
ValidationError
# 定义一个批量更新小包状态的向导, 用于批量更新小包状态
# 包括以下字段,提单, 当前节点, 更新节点, 排除面单号, 排除状态
class
BatchInputShipPackageStatusWizard
(
models
.
TransientModel
):
class
BatchInputShipPackageStatusWizard
(
models
.
TransientModel
):
_inherit
=
'batch.input.ship.package.status.wizard'
_inherit
=
'batch.input.ship.package.status.wizard'
_description
=
'批量更新小包状态向导'
is_skip_check
=
fields
.
Boolean
(
'Skip Check'
,
default
=
False
)
is_skip_check
=
fields
.
Boolean
(
'Skip Check'
,
default
=
False
)
...
@@ -61,7 +58,8 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -61,7 +58,8 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
if
len
(
state_arr
)
>
0
:
if
len
(
state_arr
)
>
0
:
state_arr
=
set
(
state_arr
)
state_arr
=
set
(
state_arr
)
if
len
(
state_arr
)
>
1
:
if
len
(
state_arr
)
>
1
:
raise
ValidationError
(
'填写的小包单号状态必须一致!'
)
# 填写的小包单号状态必须一致
raise
ValidationError
(
_
(
'The status of the small package number filled in must be consistent!'
))
else
:
else
:
# 获取所有的小包
# 获取所有的小包
if
item
.
current_status
:
if
item
.
current_status
:
...
@@ -90,15 +88,19 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
...
@@ -90,15 +88,19 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
exclude_waybill_no_list
=
[
i
.
strip
()
for
i
in
exclude_waybill_no_list
if
i
.
strip
()]
exclude_waybill_no_list
=
[
i
.
strip
()
for
i
in
exclude_waybill_no_list
if
i
.
strip
()]
package_obj
=
self
.
ship_package_ids
.
filtered
(
lambda
r
:
r
.
tracking_no
not
in
exclude_waybill_no_list
)
package_obj
=
self
.
ship_package_ids
.
filtered
(
lambda
r
:
r
.
tracking_no
not
in
exclude_waybill_no_list
)
if
len
(
package_obj
)
>
0
:
if
len
(
package_obj
)
>
0
:
# 单号[%s]需填写在排除单号中
raise
ValidationError
(
raise
ValidationError
(
'单号[
%
s]需填写在排除单号中'
%
'
\n
'
.
join
([
package
.
tracking_no
for
package
in
package_obj
]))
_
(
'The tracking number [
%
s] needs to be filled in the exclusion tracking number!'
)
%
'
\n
'
.
join
(
[
package
.
tracking_no
for
package
in
package_obj
]))
else
:
else
:
if
len
(
self
.
ship_package_ids
)
>
0
:
if
len
(
self
.
ship_package_ids
)
>
0
:
# 检查小包%s是否存在还未推送或 小包已经推送过将更变更的状态
raise
ValidationError
(
raise
ValidationError
(
'单号[
%
s]不能更新'
%
'
\n
'
.
join
([
package
.
tracking_no
for
package
in
self
.
ship_package_ids
]))
_
(
'Check if the package [
%
s] has a status that has not been pushed yet or if the package has already been pushed and will be updated!'
)
%
'
\n
'
.
join
(
[
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]
%
s更新为[
%
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
''
))
return
obj
return
obj
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论