Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
a05f8190
提交
a05f8190
authored
8月 07, 2025
作者:
伍姿英
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release/3.0.0'
上级
b4e351d5
bef8276e
全部展开
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
194 行增加
和
1 行删除
+194
-1
__manifest__.py
ccs_connect_tiktok/__manifest__.py
+1
-0
order_controller.py
ccs_connect_tiktok/controllers/order_controller.py
+0
-0
zh_CN.po
ccs_connect_tiktok/i18n/zh_CN.po
+0
-0
__init__.py
ccs_connect_tiktok/models/__init__.py
+1
-0
pda_scan_record.py
ccs_connect_tiktok/models/pda_scan_record.py
+88
-0
res_config_setting.py
ccs_connect_tiktok/models/res_config_setting.py
+7
-1
ir.model.access.csv
ccs_connect_tiktok/security/ir.model.access.csv
+3
-0
config_settings_views.xml
ccs_connect_tiktok/views/config_settings_views.xml
+4
-0
pda_scan_record_views.xml
ccs_connect_tiktok/views/pda_scan_record_views.xml
+90
-0
没有找到文件。
ccs_connect_tiktok/__manifest__.py
浏览文件 @
a05f8190
...
...
@@ -31,6 +31,7 @@
'views/cc_node_view.xml'
,
'views/cc_ship_package_view.xml'
,
'views/cc_bl_view.xml'
,
'views/pda_scan_record_views.xml'
,
],
'demo'
:
[
...
...
ccs_connect_tiktok/controllers/order_controller.py
浏览文件 @
a05f8190
差异被折叠。
点击展开。
ccs_connect_tiktok/i18n/zh_CN.po
浏览文件 @
a05f8190
差异被折叠。
点击展开。
ccs_connect_tiktok/models/__init__.py
浏览文件 @
a05f8190
...
...
@@ -8,6 +8,7 @@ from . import cc_node
from
.
import
cc_bill_loading
from
.
import
ir_attachment
from
.
import
http
from
.
import
pda_scan_record
ccs_connect_tiktok/models/pda_scan_record.py
0 → 100644
浏览文件 @
a05f8190
# -*- coding: utf-8 -*-
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
class
PDAScanRecord
(
models
.
Model
):
_name
=
'pda.scan.record'
_description
=
_
(
'PDA Scan Record'
)
# PDA扫码记录
_order
=
'create_date desc'
_rec_name
=
'bill_number'
@api.onchange
(
'operation'
)
def
_onchange_operation
(
self
):
"""根据操作自动设置类型"""
if
self
.
operation
:
if
'tally'
in
self
.
operation
:
self
.
record_type
=
'tally'
elif
'handover'
in
self
.
operation
:
self
.
record_type
=
'handover'
operator_id
=
fields
.
Many2one
(
'res.users'
,
string
=
'操作人'
,
required
=
True
)
operation_time
=
fields
.
Datetime
(
string
=
'操作时间'
,
required
=
True
,
default
=
fields
.
Datetime
.
now
)
operation
=
fields
.
Selection
([
(
'bill_tally'
,
_
(
'Bill Tally'
)),
# 按提单理货
(
'tail_tally'
,
_
(
'Tail Tally'
)),
# 按尾程理货
(
'bill_handover'
,
_
(
'Bill Handover'
)),
# 按提单交货
(
'tail_handover'
,
_
(
'Tail Handover'
))
# 按尾程交货
],
string
=
_
(
'Operation'
),
required
=
True
)
# 操作
record_type
=
fields
.
Selection
([
(
'tally'
,
_
(
'Tally'
)),
# 理货
(
'handover'
,
_
(
'Handover'
))
# 交货
],
string
=
_
(
'Type'
),
required
=
True
)
# 类型
bill_number
=
fields
.
Char
(
string
=
_
(
'Bill Number'
))
# 提单号
transfer_number
=
fields
.
Char
(
string
=
_
(
'Transfer Number'
))
# 转运单号
# 增加提单关联字段
bl_id
=
fields
.
Many2one
(
'cc.bl'
,
string
=
_
(
'Bill of Lading'
),
ondelete
=
'cascade'
)
# 提单对象
#增加状态 成功 失败
state
=
fields
.
Selection
([
(
'success'
,
_
(
'Success'
)),
(
'failed'
,
_
(
'Failed'
))
],
string
=
_
(
'State'
),
required
=
True
)
failure_reason
=
fields
.
Char
(
string
=
_
(
'Failure Reason'
))
# 失败原因
@api.model
def
create_scan_record
(
self
,
operation
,
record_type
,
bill_number
,
transfer_number
,
state
,
operator_id
=
False
,
bl_id
=
False
,
failure_reason
=
False
,
operation_time
=
False
):
"""
创建扫码记录的方法,供接口调用
Create scan record method for API calls
"""
try
:
if
not
operator_id
:
operator_id
=
self
.
env
[
'res.users'
]
.
search
([(
'login'
,
'='
,
'pda'
)],
limit
=
1
)
.
id
# 如果没有传入bl_id,根据bill_number查找提单对象
if
not
bl_id
and
bill_number
:
bl_obj
=
self
.
env
[
'cc.bl'
]
.
sudo
()
.
deal_bl_no_and_transfer_bl_no
(
bill_number
)
if
bl_obj
:
bl_id
=
bl_obj
.
id
# 准备创建记录的数据
record_data
=
{
'operator_id'
:
operator_id
,
'operation'
:
operation
,
'record_type'
:
record_type
,
'bill_number'
:
bill_number
,
'transfer_number'
:
transfer_number
,
'bl_id'
:
bl_id
,
'state'
:
state
,
'failure_reason'
:
failure_reason
}
# 如果传入了自定义操作时间,使用它
if
operation_time
:
record_data
[
'operation_time'
]
=
operation_time
record
=
self
.
create
(
record_data
)
return
{
'success'
:
True
,
'record_id'
:
record
.
id
,
'message'
:
''
}
except
Exception
as
e
:
return
{
'success'
:
False
,
'message'
:
_
(
'Creation failed:
%
s'
)
%
str
(
e
)
# 创建失败
}
\ No newline at end of file
ccs_connect_tiktok/models/res_config_setting.py
浏览文件 @
a05f8190
...
...
@@ -15,6 +15,8 @@ class ResConfigSettings(models.TransientModel):
tt_app_secret
=
fields
.
Char
(
'AppSecret'
,
default
=
''
)
tt_version
=
fields
.
Char
(
'接口版本'
,
default
=
'3.0'
)
tt_customer_id
=
fields
.
Many2one
(
'res.partner'
,
string
=
'客户'
)
#交货操作晚于提货操作X分钟【默认80分钟】
delivery_time
=
fields
.
Integer
(
'交货操作晚于提货操作X分钟'
,
default
=
80
,
config_parameter
=
'delivery_time'
)
@api.model
def
get_values
(
self
):
...
...
@@ -29,13 +31,15 @@ class ResConfigSettings(models.TransientModel):
tt_app_secret
=
config
.
get_param
(
'tt_app_secret'
,
default
=
''
)
tt_version
=
config
.
get_param
(
'tt_version'
,
default
=
''
)
tt_customer_id
=
config
.
get_param
(
'tt_customer_id'
,
default
=
False
)
delivery_time
=
config
.
get_param
(
'delivery_time'
,
default
=
80
)
customer
=
self
.
env
[
'res.partner'
]
.
sudo
()
.
search
([(
'id'
,
'='
,
tt_customer_id
)])
values
.
update
(
tt_url
=
tt_url
,
tt_app_key
=
tt_app_key
,
tt_app_secret
=
tt_app_secret
,
tt_version
=
tt_version
,
tt_customer_id
=
customer
tt_customer_id
=
customer
,
delivery_time
=
delivery_time
)
return
values
...
...
@@ -47,3 +51,4 @@ class ResConfigSettings(models.TransientModel):
ir_config
.
set_param
(
"tt_app_secret"
,
self
.
tt_app_secret
or
""
)
ir_config
.
set_param
(
"tt_version"
,
self
.
tt_version
or
""
)
ir_config
.
set_param
(
"tt_customer_id"
,
self
.
tt_customer_id
.
id
or
False
)
ir_config
.
set_param
(
"delivery_time"
,
self
.
delivery_time
or
80
)
\ No newline at end of file
ccs_connect_tiktok/security/ir.model.access.csv
浏览文件 @
a05f8190
...
...
@@ -12,3 +12,6 @@ access_cc_bl_sync_log_base.group_erp_manager,cc_bl_sync_log base.group_erp_manag
access_cc_bl_sync_log_ccs_base.group_clearance_of_customs_manager,cc_bl_sync_log ccs_base.group_clearance_of_customs_manager,ccs_connect_tiktok.model_cc_bl_sync_log,ccs_base.group_clearance_of_customs_manager,1,0,0,0
access_cc_bl_sync_log_ccs_base.group_clearance_of_customs_user,cc_bl_sync_log ccs_base.group_clearance_of_customs_user,ccs_connect_tiktok.model_cc_bl_sync_log,ccs_base.group_clearance_of_customs_user,1,0,0,0
access_pda_scan_record_user,pda.scan.record.user,model_pda_scan_record,base.group_user,1,1,1,0
access_pda_scan_record_manager,pda.scan.record.manager,model_pda_scan_record,base.group_system,1,1,1,1
ccs_connect_tiktok/views/config_settings_views.xml
浏览文件 @
a05f8190
...
...
@@ -25,6 +25,10 @@
<label
for=
"tt_customer_id"
/>
<field
name=
"tt_customer_id"
/>
</div>
<div
class=
"text-muted"
>
<label
for=
"delivery_time"
/>
<field
name=
"delivery_time"
/>
</div>
</div>
</div>
<div
class=
"col-12 col-lg-6 o_setting_box"
>
...
...
ccs_connect_tiktok/views/pda_scan_record_views.xml
0 → 100644
浏览文件 @
a05f8190
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- PDA扫码记录列表视图 -->
<record
id=
"view_pda_scan_record_tree"
model=
"ir.ui.view"
>
<field
name=
"name"
>
pda.scan.record.tree
</field>
<field
name=
"model"
>
pda.scan.record
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"PDA Scan Record"
decoration-info=
"state == 'success'"
decoration-danger=
"state == 'failed'"
>
<field
name=
"operator_id"
/>
<field
name=
"operation_time"
/>
<field
name=
"operation"
/>
<field
name=
"record_type"
/>
<field
name=
"bill_number"
/>
<field
name=
"transfer_number"
/>
<field
name=
"bl_id"
invisible=
"1"
/>
<field
name=
"state"
/>
<field
name=
"failure_reason"
optional=
"hide"
/>
</tree>
</field>
</record>
<!-- PDA扫码记录表单视图 -->
<record
id=
"view_pda_scan_record_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
pda.scan.record.form
</field>
<field
name=
"model"
>
pda.scan.record
</field>
<field
name=
"arch"
type=
"xml"
>
<form
string=
"PDA Scan Record"
>
<header>
<field
name=
"state"
widget=
"statusbar"
/>
</header>
<sheet>
<group>
<group>
<field
name=
"operator_id"
/>
<field
name=
"operation_time"
/>
<field
name=
"operation"
/>
</group>
<group>
<field
name=
"record_type"
/>
<field
name=
"bl_id"
invisible=
"1"
/>
<field
name=
"bill_number"
/>
<field
name=
"transfer_number"
/>
</group>
</group>
<group>
<field
name=
"failure_reason"
attrs=
"{'invisible': [('state', '=', 'success')]}"
/>
</group>
</sheet>
</form>
</field>
</record>
<!-- PDA扫码记录搜索视图 -->
<record
id=
"view_pda_scan_record_search"
model=
"ir.ui.view"
>
<field
name=
"name"
>
pda.scan.record.search
</field>
<field
name=
"model"
>
pda.scan.record
</field>
<field
name=
"arch"
type=
"xml"
>
<search
string=
"PDA Scan Record"
>
<field
name=
"operator_id"
/>
<field
name=
"operation_time"
/>
<field
name=
"operation"
/>
<field
name=
"record_type"
/>
<field
name=
"bill_number"
/>
<field
name=
"transfer_number"
/>
<filter
string=
"Tally"
name=
"tally"
domain=
"[('record_type', '=', 'tally')]"
/>
<filter
string=
"Handover"
name=
"handover"
domain=
"[('record_type', '=', 'handover')]"
/>
</search>
</field>
</record>
<!-- PDA扫码记录动作 -->
<record
id=
"action_pda_scan_record"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
PDA Scan Record
</field>
<field
name=
"res_model"
>
pda.scan.record
</field>
<field
name=
"view_mode"
>
tree,form
</field>
<field
name=
"search_view_id"
ref=
"view_pda_scan_record_search"
/>
<field
name=
"help"
type=
"html"
>
<p
class=
"o_view_nocontent_smiling_face"
>
Create your first PDA scan record
</p>
</field>
</record>
<!-- 菜单项 -->
<menuitem
id=
"menu_pda_scan_record"
name=
"PDA Scan Record"
action=
"action_pda_scan_record"
sequence=
"21"
/>
</odoo>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论