提交 d975d6da authored 作者: 刘擎阳's avatar 刘擎阳

Merge branch 'develop' of https://e.coding.net/yizuo/hh_ccs/hh_ccs into develop

# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import models, api, fields, _ from odoo import models, api, fields, _
from odoo.exceptions import Warning, ValidationError from odoo.exceptions import Warning, ValidationError
...@@ -91,12 +92,11 @@ class BatchInputShipPackageStatusWizard(models.TransientModel): ...@@ -91,12 +92,11 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
if not parcels: if not parcels:
raise ValidationError(_('No package to update found.')) # 没有找到要更新的小包 raise ValidationError(_('No package to update found.')) # 没有找到要更新的小包
# 判断操作时间不能大于当前时间,不能小于 小包的最晚操作时间 # 1.若选择的更新节点为是当前节点【清关节点设置,是当前节点字段名称改为初始节点】,当更新节点为初始节点时,无需填写操作时间;
current_time = fields.Datetime.now() # if self.update_status and not self.update_status.is_default:
if self.process_time and (self.process_time > current_time or ( # 2.若选择的更新节点为“选择节点”的后续节点(根据节点设置排序),则按照操作时间不能大于当前时间,且不能早于最近的操作时间。
self.last_process_time and self.process_time < self.last_process_time)): # 3.若选择的“更新节点”为“选择节点”的前序节点(根据节点设置排序),则查找“选择节点”是否已有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。若有多条,以同步时间最晚的一条为准。
raise ValidationError( # 4.若选择的“更新节点”和“选择节点”一致时,需检查该节点的前序节点是否有同步日志,若有,则操作时间不允许早于前序节点同步日志里的操作时间,且不能大于当前时间。同一节点若有多条同步日志,以同步时间最晚的一条为准。
_('The operation time cannot be greater than the current time and cannot be less than the latest operation time!')) # 操作时间不能大于当前时间且不能小于最晚操作时间
# 判断异常状态是否选择了异常原因 # 判断异常状态是否选择了异常原因
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:
...@@ -109,6 +109,18 @@ class BatchInputShipPackageStatusWizard(models.TransientModel): ...@@ -109,6 +109,18 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
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': is_sync}) 'process_time': self.process_time, 'state_explain': self.state_explain, 'is_sync': is_sync})
# if parcels:
# where_sql = " where id={0}".format(parcels[0].id) if len(
# parcels) == 1 else " where id in {0}".format(tuple(parcels.ids))
# update_sql = """update cc_ship_package set node_exception_reason_id={0},process_time='{1}',state_explain='{2}',is_sync={3} {4}""".format(
# self.node_exception_reason_id.id if self.node_exception_reason_id else False,
# self.process_time, self.state_explain or '', is_sync,
# where_sql)
# update_sql = update_sql.replace("'False'", "null").replace("False", "null")
# self._cr.execute(update_sql)
# parcels.write({'state': self.update_status.id})
# for parcel in parcels:
# parcel.message_post(body='%s改为%s' % (self.current_status.name, self.update_status.name))
# 生成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 ''))
# 跳转显示本次更新状态的小包 更新小包状态 # 跳转显示本次更新状态的小包 更新小包状态
......
...@@ -6,11 +6,11 @@ msgid "" ...@@ -6,11 +6,11 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-19 08:24+0000\n" "POT-Creation-Date: 2024-10-16 08:24+0000\n"
"PO-Revision-Date: 2024-09-19 16:26+0800\n" "PO-Revision-Date: 2024-10-16 16:25+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: zh_CN\n" "Language: zh\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
...@@ -20,12 +20,12 @@ msgstr "" ...@@ -20,12 +20,12 @@ msgstr ""
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#: model_terms:ir.ui.view,arch_db:ccs_connect_tiktok.form_cc_bl_view_inherit #: model_terms:ir.ui.view,arch_db:ccs_connect_tiktok.form_cc_bl_view_inherit
msgid "<span class=\"o_stat_text\">Not Sync Ship Packages</span>" msgid "<span class=\"o_stat_text\">Not Sync Ship Packages</span>"
msgstr "<span class=\"o_stat_text\">待同步小包</span>" msgstr "<span class=\"o_stat_text\">小包</span>"
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#: model_terms:ir.ui.view,arch_db:ccs_connect_tiktok.form_cc_bl_view_inherit #: model_terms:ir.ui.view,arch_db:ccs_connect_tiktok.form_cc_bl_view_inherit
msgid "<span class=\"o_stat_text\">Ship Packages</span>" msgid "<span class=\"o_stat_text\">Ship Packages</span>"
msgstr "<span class=\"o_stat_text\">小包</span>" msgstr "Ship Package"
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#: model:ir.model.fields,field_description:ccs_connect_tiktok.field_cc_ship_package_sync_log__api_customer #: model:ir.model.fields,field_description:ccs_connect_tiktok.field_cc_ship_package_sync_log__api_customer
...@@ -272,6 +272,15 @@ msgstr "编码" ...@@ -272,6 +272,15 @@ msgstr "编码"
msgid "TK Process Code" msgid "TK Process Code"
msgstr "进度编码" msgstr "进度编码"
#. module: ccs_connect_tiktok
#. odoo-python
#: code:addons/ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py:0
#, python-format
msgid ""
"The operation time cannot be greater than the current time and cannot be "
"less than the latest operation time!"
msgstr "操作时间不能大于当前时间,也不能小于最近的操作时间!"
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#. odoo-python #. odoo-python
#: code:addons/ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py:0 #: code:addons/ccs_connect_tiktok/wizard/batch_input_ship_package_statu_wizard.py:0
...@@ -354,6 +363,11 @@ msgstr "" ...@@ -354,6 +363,11 @@ msgstr ""
msgid "客户" msgid "客户"
msgstr "" msgstr ""
#. module: ccs_connect_tiktok
#: model:ir.actions.server,name:ccs_connect_tiktok.action_batch_update_package_status
msgid "批量手动处理小包异常数据"
msgstr ""
#. module: ccs_connect_tiktok #. module: ccs_connect_tiktok
#: model:ir.model.fields,field_description:ccs_connect_tiktok.field_res_config_settings__tt_url #: model:ir.model.fields,field_description:ccs_connect_tiktok.field_res_config_settings__tt_url
msgid "接口地址" msgid "接口地址"
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import models, api, fields, _ from odoo import models, api, fields, _
from odoo.exceptions import Warning, ValidationError from odoo.exceptions import Warning, ValidationError
...@@ -71,25 +71,47 @@ class BatchInputShipPackageStatusWizard(models.TransientModel): ...@@ -71,25 +71,47 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
package_obj = package_model.search( package_obj = package_model.search(
[('bl_id', 'in', bl_objs.ids), ('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 and not item.current_status.is_default:
# 更新日志里没有 当前节点(不包括默认节点) 【已提货】的小包 # 更新日志里没有 当前节点(不包括默认节点) 【已提货】的小包
for package_item in package_obj: where_sql = " and package_id={0}".format(package_obj[0].id) if len(
if not item.current_status.is_default: package_obj) == 1 else " and package_id in {0}".format(tuple(package_obj.ids))
current_state_log_obj = self.env['cc.ship.package.sync.log'].search( select_sql = "select id from cc_ship_package_sync_log where process_code='{0}' {1}".format(
[('package_id', '=', package_item.id), ('process_code', '=', item.current_status.tk_code)]) item.current_status.tk_code, where_sql)
if not current_state_log_obj: # logging.info('select_sql:%s' % select_sql)
package_ids += package_item.ids self._cr.execute(select_sql)
sync_log_obj = self._cr.fetchall()
if len(sync_log_obj) <= 0:
package_ids += package_obj.ids
# for package_item in package_obj:
# if not item.current_status.is_default:
# current_state_log_obj = self.env['cc.ship.package.sync.log'].search(
# [('package_id', '=', package_item.id), ('process_code', '=', item.current_status.tk_code)])
# if not current_state_log_obj:
# package_ids += package_item.ids
if item.update_status: if item.update_status:
# 更新日志明细包含了 更新节点 【清关开始】 的 小包 # 更新日志明细包含了 更新节点 【清关开始】 的 小包
update_state_log_obj = self.env['cc.ship.package.sync.log'].search( # update_state_log_obj = self.env['cc.ship.package.sync.log'].search(
[('package_id', 'in', package_obj.ids), ('process_code', '=', item.update_status.tk_code)]) # [('package_id', 'in', package_obj.ids), ('process_code', '=', item.update_status.tk_code)])
package_ids += update_state_log_obj.mapped('package_id').ids # package_ids += update_state_log_obj.mapped('package_id').ids
where_sql = " and package_id={0}".format(package_obj[0].id) if len(
package_obj) == 1 else " and package_id in {0}".format(tuple(package_obj.ids))
select_sql = "select package_id from cc_ship_package_sync_log where process_code='{0}' {1}".format(
item.update_status.tk_code, where_sql)
self._cr.execute(select_sql)
package_ids += [r[0] for r in self._cr.fetchall()]
return package_ids return package_ids
def submit(self): def submit(self):
# 判断排除的面单号是否都存在 异常小包中 # 判断排除的面单号是否都存在 异常小包中
bl_objs = self.get_order() bl_objs = self.get_order()
if not self.is_skip_check: if not self.is_skip_check:
# 判断操作时间不能大于当前时间,不能小于 小包的最晚操作时间 去掉
current_time = fields.Datetime.now()
if self.process_time and (self.process_time > current_time or (
self.last_process_time and self.process_time < self.last_process_time)):
raise ValidationError(
_('The operation time cannot be greater than the current time and cannot be less than the latest operation time!')) # 操作时间不能大于当前时间且不能小于最晚操作时间
if self.select_type == 'node': if self.select_type == 'node':
exclude_waybill_no_list = [] exclude_waybill_no_list = []
if self.exclude_tracking_no: if self.exclude_tracking_no:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论