Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
3b57bdd7
提交
3b57bdd7
authored
10月 10, 2024
作者:
刘擎阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.导出清关文件
上级
963de709
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
49 行增加
和
0 行删除
+49
-0
export_bl_and_package_xlsx.py
ccs_base/controllers/export_bl_and_package_xlsx.py
+23
-0
zh_CN.po
ccs_base/i18n/zh_CN.po
+5
-0
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+9
-0
cc_bl_view.xml
ccs_base/views/cc_bl_view.xml
+12
-0
没有找到文件。
ccs_base/controllers/export_bl_and_package_xlsx.py
浏览文件 @
3b57bdd7
...
@@ -157,3 +157,26 @@ class ExportBlAndPackageXlsx(http.Controller):
...
@@ -157,3 +157,26 @@ class ExportBlAndPackageXlsx(http.Controller):
]
]
response
=
http
.
request
.
make_response
(
zip_buffer
.
getvalue
(),
headers
=
headers
)
response
=
http
.
request
.
make_response
(
zip_buffer
.
getvalue
(),
headers
=
headers
)
return
response
return
response
@http.route
([
'/export/flight_png/xls/<string:arr>'
],
type
=
'http'
,
auth
=
"public"
)
def
export_flight_png_xls
(
self
,
arr
):
arr
=
json
.
loads
(
arr
)
flight_objs
=
http
.
request
.
env
[
'cc.bl'
]
.
sudo
()
.
search
([(
'id'
,
'in'
,
arr
)],
order
=
'id'
)
zip_buffer
=
io
.
BytesIO
()
with
zipfile
.
ZipFile
(
zip_buffer
,
'w'
,
zipfile
.
ZIP_DEFLATED
)
as
zip_file
:
for
flight
in
flight_objs
:
bl_attachment_objs
=
flight
.
bl_attachment_ids
for
bl_attachment_obj
in
bl_attachment_objs
:
# 获取图片数据
image_data
=
base64
.
b64decode
(
bl_attachment_obj
.
datas
)
# 创建文件名,前缀为单据号
file_name
=
f
"{flight.bl_no}.png"
# 将图片添加到 ZIP 文件
zip_file
.
writestr
(
file_name
,
image_data
)
zip_buffer
.
seek
(
0
)
headers
=
[
(
'Content-Type'
,
'application/x-zip-compressed'
),
(
'Content-Disposition'
,
'attachment; filename="customs_clearance_data.zip"'
),
]
response
=
http
.
request
.
make_response
(
zip_buffer
.
getvalue
(),
headers
=
headers
)
return
response
ccs_base/i18n/zh_CN.po
浏览文件 @
3b57bdd7
...
@@ -797,6 +797,11 @@ msgstr "出口HSCode"
...
@@ -797,6 +797,11 @@ msgstr "出口HSCode"
msgid "Export customs declaration data"
msgid "Export customs declaration data"
msgstr "导出报关数据"
msgstr "导出报关数据"
#. module: ccs_base
#: model:ir.actions.server,name:ccs_base.export_flight_png_server
msgid "Export customs clearance bill of lading file"
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
浏览文件 @
3b57bdd7
...
@@ -470,6 +470,15 @@ class CcBL(models.Model):
...
@@ -470,6 +470,15 @@ class CcBL(models.Model):
(
'bl_no_uniq'
,
'unique(bl_no)'
,
'The Bill of Loading No. must be unique.'
)
(
'bl_no_uniq'
,
'unique(bl_no)'
,
'The Bill of Loading No. must be unique.'
)
]
]
# 导出清关提单文件
def
export_bl_attachment_png
(
self
):
arr
=
[
item
.
id
for
item
in
self
]
return
{
'type'
:
'ir.actions.act_url'
,
'url'
:
'/export/flight_png/xls/
%
s'
%
arr
,
'target'
:
'new'
,
}
@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
浏览文件 @
3b57bdd7
...
@@ -335,4 +335,15 @@
...
@@ -335,4 +335,15 @@
</field>
</field>
</record>
</record>
<record
id=
"export_flight_png_server"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Export customs clearance bill of lading file
</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.export_bl_attachment_png()
</field>
</record>
</odoo>
</odoo>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论