Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
1c838c27
提交
1c838c27
authored
8月 23, 2024
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、小包状态增加sns
2、提单变更状态增加查询已有节点更新的小包
上级
f594f246
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
197 行增加
和
18 行删除
+197
-18
__manifest__.py
ccs_base/__manifest__.py
+2
-2
__init__.py
ccs_base/models/__init__.py
+1
-0
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+2
-2
mail_thread.py
ccs_base/models/mail_thread.py
+103
-0
cc_node_exception_reason_view.xml
ccs_base/views/cc_node_exception_reason_view.xml
+5
-5
batch_input_ship_package_statu_wizard.py
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
+1
-1
batch_input_ship_package_statu_wizard.xml
ccs_base/wizard/batch_input_ship_package_statu_wizard.xml
+1
-1
__manifest__.py
ccs_connect_tiktok/__manifest__.py
+1
-1
__init__.py
ccs_connect_tiktok/wizard/__init__.py
+2
-6
batch_input_ship_package_statu_wizard.py
...ct_tiktok/wizard/batch_input_ship_package_statu_wizard.py
+51
-0
batch_input_ship_package_statu_wizard.xml
...t_tiktok/wizard/batch_input_ship_package_statu_wizard.xml
+28
-0
没有找到文件。
ccs_base/__manifest__.py
浏览文件 @
1c838c27
...
...
@@ -13,7 +13,7 @@
"""
,
'category'
:
'Clearance of customs'
,
'website'
:
'https://www.yizuo.ltd'
,
'depends'
:
[
'base'
,
'mail'
,
'web'
],
'depends'
:
[
'base'
,
'mail'
,
'web'
],
'data'
:
[
'security/account_security.xml'
,
'security/ir.model.access.csv'
,
...
...
@@ -28,7 +28,7 @@
'views/cc_big_package_view.xml'
,
'views/cc_node_exception_reason_view.xml'
,
'views/cc_bl_view.xml'
,
#'views/cc_customers_declaration_order_view.xml',
#
'views/cc_customers_declaration_order_view.xml',
'templates/login.xml'
,
],
'demo'
:
[
...
...
ccs_base/models/__init__.py
浏览文件 @
1c838c27
...
...
@@ -3,4 +3,5 @@ from . import cc_node
from
.
import
cc_bill_loading
from
.
import
cc_customs_declaration_order
from
.
import
cc_node_exception_reason
from
.
import
mail_thread
ccs_base/models/cc_bill_loading.py
浏览文件 @
1c838c27
...
...
@@ -318,11 +318,11 @@ class CcShipPackage(models.Model):
string
=
'Invoice Attachments'
)
# 进度状态, 包括已提货、 小包查验、海关放行、小包出库、小包入库、清关失败,包裹交接
state
=
fields
.
Many2one
(
'cc.node'
,
string
=
'Progress state'
,
domain
=
"[('node_type', '=', 'package')]"
,
state
=
fields
.
Many2one
(
'cc.node'
,
string
=
'Progress state'
,
domain
=
"[('node_type', '=', 'package')]"
,
tracking
=
True
,
default
=
lambda
self
:
self
.
env
[
'cc.node'
]
.
search
(
[(
'node_type'
,
'='
,
'package'
),
(
'is_default'
,
'='
,
True
)],
limit
=
1
))
node_exception_reason_id
=
fields
.
Many2one
(
'cc.node.exception.reason'
,
'Exception Reason'
)
process_time
=
fields
.
Datetime
(
'Process Time
(UTC)
'
)
process_time
=
fields
.
Datetime
(
'Process Time'
)
# 重载write方法,在进度状态变化时,将is_sync置为False, 同时检查is_sync为false时,不允许修改进度状态
def
write
(
self
,
vals
):
...
...
ccs_base/models/mail_thread.py
0 → 100644
浏览文件 @
1c838c27
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import
ast
import
base64
import
datetime
import
dateutil
import
email
import
email.policy
import
hashlib
import
hmac
import
json
import
lxml
import
logging
import
pytz
import
re
import
time
import
threading
from
collections
import
namedtuple
from
email.message
import
EmailMessage
from
email
import
message_from_string
from
lxml
import
etree
from
werkzeug
import
urls
from
xmlrpc
import
client
as
xmlrpclib
from
markupsafe
import
Markup
from
odoo
import
_
,
api
,
exceptions
,
fields
,
models
,
tools
,
registry
,
SUPERUSER_ID
,
Command
from
odoo.exceptions
import
MissingError
,
AccessError
from
odoo.osv
import
expression
from
odoo.tools
import
is_html_empty
from
odoo.tools.misc
import
clean_context
,
split_every
_logger
=
logging
.
getLogger
(
__name__
)
class
MailThread
(
models
.
AbstractModel
):
''' mail_thread model is meant to be inherited by any model that needs to
act as a discussion topic on which messages can be attached. Public
methods are prefixed with ``message_`` in order to avoid name
collisions with methods of the models that will inherit from this class.
``mail.thread`` defines fields used to handle and display the
communication history. ``mail.thread`` also manages followers of
inheriting classes. All features and expected behavior are managed
by mail.thread. Widgets has been designed for the 7.0 and following
versions of Odoo.
Inheriting classes are not required to implement any method, as the
default implementation will work for any model. However it is common
to override at least the ``message_new`` and ``message_update``
methods (calling ``super``) to add model-specific behavior at
creation and update of a thread when processing incoming emails.
Options:
- _mail_flat_thread: if set to True, all messages without parent_id
are automatically attached to the first message posted on the
resource. If set to False, the display of Chatter is done using
threads, and no parent_id is automatically set.
MailThread features can be somewhat controlled through context keys :
- ``mail_create_nosubscribe``: at create or message_post, do not subscribe
uid to the record thread
- ``mail_create_nolog``: at create, do not log the automatic '<Document>
created' message
- ``mail_notrack``: at create and write, do not perform the value tracking
creating messages
- ``tracking_disable``: at create and write, perform no MailThread features
(auto subscription, tracking, post, ...)
- ``mail_notify_force_send``: if less than 50 email notifications to send,
send them directly instead of using the queue; True by default
'''
_inherit
=
'mail.thread'
_description
=
'Email Thread'
def
_message_compute_author
(
self
,
author_id
=
None
,
email_from
=
None
,
raise_on_email
=
True
):
""" Tool method computing author information for messages. Purpose is
to ensure maximum coherence between author / current user / email_from
when sending emails.
:param raise_on_email: if email_from is not found, raise an UserError
:return tuple: res.partner ID (may be False or None), email_from
"""
if
author_id
is
None
:
if
email_from
:
author
=
self
.
_mail_find_partner_from_emails
([
email_from
])[
0
]
else
:
author
=
self
.
env
.
user
.
partner_id
email_from
=
author
.
email_formatted
author_id
=
author
.
id
if
email_from
is
None
:
if
author_id
:
author
=
self
.
env
[
'res.partner'
]
.
browse
(
author_id
)
email_from
=
author
.
email_formatted
# superuser mode without author email -> probably public user; anyway we don't want to crash
# if not email_from and raise_on_email and not self.env.su:
# raise exceptions.UserError(_("Unable to send message, please configure the sender's email address."))
return
author_id
,
email_from
ccs_base/views/cc_node_exception_reason_view.xml
浏览文件 @
1c838c27
...
...
@@ -7,9 +7,9 @@
<field
name=
"model"
>
cc.node.exception.reason
</field>
<field
name=
"arch"
type=
"xml"
>
<tree
string=
"CC Node Exception Reason"
editable=
"bottom"
>
<field
optional=
"show"
name=
"code_id"
string=
"Node"
options=
"{'no_create':True}"
/>
<field
optional=
"show"
name=
"name"
string=
"Node Name"
/>
<field
optional=
"show"
name=
"desc"
string=
"Node Description"
/>
<field
optional=
"show"
name=
"code_id"
options=
"{'no_create':True}"
/>
<field
optional=
"show"
name=
"name"
/>
<field
optional=
"show"
name=
"desc"
/>
</tree>
</field>
</record>
...
...
@@ -21,8 +21,8 @@
<field
name=
"arch"
type=
"xml"
>
<search
string=
"Search Node"
>
<field
name=
"code_id"
/>
<field
name=
"name"
string=
"Node Name"
/>
<field
name=
"desc"
string=
"Node Description"
/>
<field
name=
"name"
/>
<field
name=
"desc"
/>
<group
expand=
"0"
string=
"Group By"
>
<filter
string=
"Node"
name=
"group_code_id"
context=
"{'group_by':'code_id'}"
/>
</group>
...
...
ccs_base/wizard/batch_input_ship_package_statu_wizard.py
浏览文件 @
1c838c27
...
...
@@ -81,7 +81,7 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
{
'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
''
))
#
self.bl_id.message_post(body='%s更新为%s' % (self.current_status.name or '', self.update_status.name or ''))
# 跳转显示本次更新状态的小包
return
{
'name'
:
'更新小包状态'
,
...
...
ccs_base/wizard/batch_input_ship_package_statu_wizard.xml
浏览文件 @
1c838c27
...
...
@@ -26,7 +26,7 @@
<separator/>
<!-- domain="[('id','in',next_code_ids),('node_type','=','package')]"-->
<field
name=
"update_status"
required=
"1"
/>
<field
name=
"process_time"
required=
"1"
string=
"Process Time
(UTC)
"
/>
<field
name=
"process_time"
required=
"1"
string=
"Process Time"
/>
<field
name=
"node_exception_reason_id"
options=
"{'no_create':True}"
/>
<field
name=
"state_explain"
/>
</group>
...
...
ccs_connect_tiktok/__manifest__.py
浏览文件 @
1c838c27
...
...
@@ -17,7 +17,7 @@
# data
# 'data/data.xml',
# wizard
# 'wizard/push_result
.xml',
'wizard/batch_input_ship_package_statu_wizard
.xml'
,
# 'wizard/again_push_wizard.xml',
# 'wizard/batch_push_tiktok.xml',
# view
...
...
ccs_connect_tiktok/wizard/__init__.py
浏览文件 @
1c838c27
# -*- coding: utf-8 -*-
# from . import push_result
# from . import again_push_wizard
# from . import parcel_exception_wizard
# from . import big_bag_pickup_wizard
# from . import batch_push_tiktok
# from . import big_bag_check_wizard
from
.
import
batch_input_ship_package_statu_wizard
ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py
0 → 100644
浏览文件 @
1c838c27
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from
odoo
import
models
,
api
,
fields
from
odoo.exceptions
import
Warning
,
ValidationError
# 定义一个批量更新小包状态的向导, 用于批量更新小包状态
# 包括以下字段,提单, 当前节点, 更新节点, 排除面单号, 排除状态
class
BatchInputShipPackageStatusWizard
(
models
.
TransientModel
):
_inherit
=
'batch.input.ship.package.status.wizard'
_description
=
'批量更新小包状态向导'
@api.depends
(
'select_type'
,
'update_status'
,
'current_status'
)
def
cal_ship_package_ids
(
self
):
"""
比如 已提货 --- 清关开始,选择了清关开始之后 把已提货状态的小包且更新日志明细包含了 清关开始 的编码的 小包显示出来
"""
for
item
in
self
:
package_ids
=
[]
package_obj
=
False
package_model
=
self
.
env
[
'cc.ship.package'
]
if
item
.
select_type
==
'tracking_no'
:
if
item
.
select_tracking_no
:
tracking_no_list
=
item
.
select_tracking_no
.
split
(
','
)
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
)])
else
:
# 获取所有的小包
if
item
.
current_status
:
package_obj
=
package_model
.
search
(
[(
'bl_id'
,
'='
,
item
.
bl_id
.
id
),
(
'state'
,
'='
,
item
.
current_status
.
id
)])
if
package_obj
:
# 更新日志明细包含了 清关开始 的 小包
log_obj
=
self
.
env
[
'cc.ship.package.sync.log'
]
.
search
(
[(
'package_id'
,
'in'
,
package_obj
.
ids
),
(
'process_code'
,
'='
,
item
.
update_status
.
tk_code
)])
package_ids
=
log_obj
.
mapped
(
'package_id'
)
.
ids
item
.
ship_package_ids
=
[(
6
,
0
,
package_ids
)]
ship_package_ids
=
fields
.
Many2many
(
'cc.ship.package'
,
'_update_state_package_wizard_rel'
,
'wizard_id'
,
'package_id'
,
'Have Node Package'
,
compute
=
'cal_ship_package_ids'
)
def
submit
(
self
):
obj
=
super
(
BatchInputShipPackageStatusWizard
,
self
)
.
submit
()
# 生成sns日志
self
.
bl_id
.
message_post
(
body
=
'[
%
s]
%
s更新为[
%
s]
%
s'
%
(
self
.
current_status
.
tk_code
or
''
,
self
.
current_status
.
name
or
''
,
self
.
update_status
.
tk_code
or
''
,
self
.
update_status
.
name
or
''
))
# 跳转显示本次更新状态的小包
return
obj
ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.xml
0 → 100644
浏览文件 @
1c838c27
<?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_batch_input_ship_package_wizard"
model=
"ir.ui.view"
>
<field
name=
"name"
>
更新包裹进度
</field>
<field
name=
"model"
>
batch.input.ship.package.status.wizard
</field>
<field
name=
"inherit_id"
ref=
"ccs_base.view_batch_input_ship_package_wizard"
/>
<field
name=
"arch"
type=
"xml"
>
<field
name=
"update_status"
position=
"after"
>
<field
name=
"ship_package_ids"
widget=
"one2many"
readonly=
"1"
>
<tree>
<field
name=
"logistic_order_no"
/>
<field
name=
"tracking_no"
/>
<field
name=
"state"
/>
</tree>
</field>
</field>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论