提交 f2ac2de9 authored 作者: 贺阳's avatar 贺阳

处理单号的方法移到base模块

上级 f631be82
......@@ -6,16 +6,14 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-14 08:39+0000\n"
"PO-Revision-Date: 2025-07-14 16:41+0800\n"
"POT-Creation-Date: 2025-07-14 08:55+0000\n"
"PO-Revision-Date: 2025-07-14 08:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.5\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: ccs_base
#. odoo-python
......@@ -67,29 +65,23 @@ msgid ""
" <br>\n"
" <!-- 检查 big_package_ids 是否有值 -->\n"
" <t t-if=\"object.big_package_ids\">\n"
" <t t-foreach=\"object.big_package_ids\" t-"
"as=\"big_package_id\">\n"
" <t t-foreach=\"object.big_package_ids\" t-as=\"big_package_id\">\n"
" <div>Package:\n"
" <t t-esc=\"big_package_id.big_package_no or "
"''\"></t>\n"
" <t t-esc=\"big_package_id.big_package_no or ''\"></t>\n"
" </div>\n"
" </t>\n"
" </t>\n"
" <!-- 检查 ship_package_ids 是否有值 -->\n"
" <t t-if=\"object.ship_package_ids\">\n"
" <t t-foreach=\"object.ship_package_ids\" t-"
"as=\"ship_package_id\">\n"
" <t t-foreach=\"object.ship_package_ids\" t-as=\"ship_package_id\">\n"
" <div>Package:\n"
" <t t-esc=\"ship_package_id."
"logistic_order_no or ''\"></t>\n"
" <t t-esc=\"ship_package_id.logistic_order_no or ''\"></t>\n"
" </div>\n"
" </t>\n"
" </t>\n"
" <div>Please know that there is an exception and the "
"cause of the exception is\n"
" <div>Please know that there is an exception and the cause of the exception is\n"
" <t t-if=\"object.exception_ids\">\n"
" <t t-esc=\"'/'.join([ex.reason for ex in object."
"exception_ids])\"></t>\n"
" <t t-esc=\"'/'.join([ex.reason for ex in object.exception_ids])\"></t>\n"
" </t>\n"
" <t t-if=\"not object.exception_ids\">\n"
" No Exception\n"
......@@ -110,28 +102,23 @@ msgid ""
" <br>\n"
" <!-- 检查 big_package_ids 是否有值 -->\n"
" <t t-if=\"object.big_package_ids\">\n"
" <t t-foreach=\"object.big_package_ids\" t-"
"as=\"big_package_id\">\n"
" <t t-foreach=\"object.big_package_ids\" t-as=\"big_package_id\">\n"
" <div>包裹:\n"
" <t t-esc=\"big_package_id.big_package_no or "
"''\"></t>\n"
" <t t-esc=\"big_package_id.big_package_no or ''\"></t>\n"
" </div>\n"
" </t>\n"
" </t>\n"
" <!-- 检查 ship_package_ids 是否有值 -->\n"
" <t t-if=\"object.ship_package_ids\">\n"
" <t t-foreach=\"object.ship_package_ids\" t-"
"as=\"ship_package_id\">\n"
" <t t-foreach=\"object.ship_package_ids\" t-as=\"ship_package_id\">\n"
" <div>包裹:\n"
" <t t-esc=\"ship_package_id."
"logistic_order_no or ''\"></t>\n"
" <t t-esc=\"ship_package_id.logistic_order_no or ''\"></t>\n"
" </div>\n"
" </t>\n"
" </t>\n"
" <div>出现异常,异常原因:\n"
" <t t-if=\"object.exception_ids\">\n"
" <t t-esc=\"'/'.join([ex.reason for ex in object."
"exception_ids])\"></t>,请知晓。\n"
" <t t-esc=\"'/'.join([ex.reason for ex in object.exception_ids])\"></t>,请知晓。\n"
" </t>\n"
" <t t-if=\"not object.exception_ids\">\n"
" 无异常,请知晓。\n"
......@@ -147,13 +134,11 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:ccs_base.view_batch_update_transfer_bl_no_wizard
msgid ""
"<span class=\"label label-warning\">\n"
" If there is abnormal data, please download "
"the error file, fix the data as prompted, and re-import!\n"
" If there is abnormal data, please download the error file, fix the data as prompted, and re-import!\n"
" </span>"
msgstr ""
"<span class=\"label label-warning\">\n"
" 如果数据异常,请下载错误文件,按提示修正数"
"据,然后重新导入!\n"
" 如果数据异常,请下载错误文件,按提示修正数据,然后重新导入!\n"
" </span>"
#. module: ccs_base
......@@ -188,13 +173,10 @@ msgstr "<span class=\"o_stat_text\">已理货大包</span>"
#. module: ccs_base
#: model_terms:ir.ui.view,arch_db:ccs_base.view_batch_update_transfer_bl_no_wizard
msgid ""
"<span style=\"color:red;font-size:15px;\">Tip: Please fill in the "
"information strictly according to the template, otherwise the system will "
"not recognize it.\n"
"<span style=\"color:red;font-size:15px;\">Tip: Please fill in the information strictly according to the template, otherwise the system will not recognize it.\n"
" </span>"
msgstr ""
"<span style=\"color:red;font-size:15px;\">提示:请务必按照模板填写信息,否则"
"系统无法识别。\n"
"<span style=\"color:red;font-size:15px;\">提示:请务必按照模板填写信息,否则系统无法识别。\n"
" </span>"
#. module: ccs_base
......@@ -419,6 +401,7 @@ msgstr "添加异常信息"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: model_terms:ir.ui.view,arch_db:ccs_base.form_cc_big_package_view
#: model_terms:ir.ui.view,arch_db:ccs_base.form_cc_ship_package_view
#, python-format
......@@ -489,6 +472,7 @@ msgstr "提单列表"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: model:ir.model.fields,field_description:ccs_base.field_cc_bl__bl_no
#: model:ir.model.fields.selection,name:ccs_base.selection__export_bl_big_package_xlsx_wizard__file_name_type__bl_no
#, python-format
......@@ -907,6 +891,7 @@ msgstr "已理货"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/wizard/add_exception_info_wizard.py:0
#: code:addons/ccs_base/wizard/add_exception_info_wizard.py:0
#: model:ir.model.fields.selection,name:ccs_base.selection__add_exception_info_wizard__email_language__zh_cn
#, python-format
msgid "Chinese"
......@@ -1328,6 +1313,7 @@ msgstr "目的地港口代码"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/wizard/add_exception_info_wizard.py:0
#: code:addons/ccs_base/wizard/add_exception_info_wizard.py:0
#: model:ir.model.fields.selection,name:ccs_base.selection__add_exception_info_wizard__email_language__en_us
#, python-format
msgid "English"
......@@ -1336,6 +1322,7 @@ msgstr "英文"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: model:ir.model.fields,field_description:ccs_base.field_batch_update_transfer_bl_no_wizard__error_file_ids
#, python-format
msgid "Error Data"
......@@ -1544,6 +1531,8 @@ msgstr "商品税号"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_history_big_package.py:0
#: model:ir.model.fields,field_description:ccs_base.field_cc_big_package__goods_ids
#: model:ir.model.fields,field_description:ccs_base.field_cc_bl__good_ids
......@@ -2556,8 +2545,8 @@ msgstr "请检查导入文件和内容是否正确,请根据模板文件导入
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#, python-format
msgid ""
"Please configure the default customs clearance status of the bill of "
"loading node type first."
"Please configure the default customs clearance status of the bill of loading"
" node type first."
msgstr "请先配置默认的提单节点类型的清关节点"
#. module: ccs_base
......@@ -3079,6 +3068,7 @@ msgstr "节点序号"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_history_big_package.py:0
#: model:ir.actions.act_window,name:ccs_base.action_cc_ship_package
#: model:ir.model,name:ccs_base.model_cc_history_ship_package
......@@ -3330,6 +3320,7 @@ msgstr "物流订单号必须唯一。"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#: code:addons/ccs_base/models/cc_bill_loading.py:0
#, python-format
msgid "The Transfer B/L No. cannot be the same as the B/L No."
msgstr "转单号不能与本单提单号重复"
......@@ -3509,6 +3500,7 @@ msgstr "交易类型"
#. module: ccs_base
#. odoo-python
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: code:addons/ccs_base/wizard/batch_update_transfer_bl_no_wizard.py:0
#: model:ir.model.fields,field_description:ccs_base.field_cc_bl__transfer_bl_no
#: model:ir.model.fields.selection,name:ccs_base.selection__export_bl_big_package_xlsx_wizard__file_name_type__transfer_bl_no
#, python-format
......@@ -3764,8 +3756,8 @@ msgstr "【清关公司】还没!点击左上角的创建按钮,沙发就是
#. module: ccs_base
#: model_terms:ir.actions.act_window,help:ccs_base.action_cc_clearance_file
msgid ""
"[Clearance File] Not yet! Click the Create button in the top left corner "
"and the sofa is yours!"
"[Clearance File] Not yet! Click the Create button in the top left corner and"
" the sofa is yours!"
msgstr "【清关文件】 还没有!点击左上角的“创建”按钮,沙发就是你的了!"
#. module: ccs_base
......@@ -3840,8 +3832,7 @@ msgstr ""
#. module: ccs_base
#: model:mail.template,subject:ccs_base.email_template_exception_notification
msgid ""
"{{ ('大包异常' if object.action_type == 'big package' else '小包异常') }}"
msgid "{{ ('大包异常' if object.action_type == 'big package' else '小包异常') }}"
msgstr ""
#. module: ccs_base
......
......@@ -582,65 +582,6 @@ class CcBL(models.Model):
if other:
raise ValidationError(_('The Transfer B/L No. cannot be the same as the B/L No.'))
def action_batch_export_package(self):
"""
导出报关文件
"""
return {
'name': _('Export customs declaration documents'), # 导出报关文件
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'export.bl.big.package.xlsx.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_action_type': '报关文件'},
}
# 导出清关提单文件
def action_export_bl_attachment_png(self):
return {
'name': _('Export Customs Clearance Bill of Lading'), # 导出清关提单文件
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'export.bl.big.package.xlsx.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_action_type': '清关提单文件'},
}
def batch_input_ship_package_status_wizard(self):
"""批量更新小包状态"""
return {
'name': _('Update the status of the small package'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'batch.input.ship.package.status.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_is_batch': True, 'default_bl_id': self.ids}
}
def batch_update_bl_status_wizard(self):
"""批量更新提单状态"""
# 检查关务提单状态必须是同一个
customs_clearance_status_list = self.filtered(lambda x: x.customs_clearance_status.id).mapped(
'customs_clearance_status.id')
if len(customs_clearance_status_list) == 0:
# 请先配置默认的提单节点类型的清关节点
raise ValidationError(
_('Please configure the default customs clearance status of the bill of loading node type first.'))
if len(customs_clearance_status_list) > 1:
raise ValidationError(_('The customs clearance status of the selected bill of loading must be the same.'))
# 最近操作时间取最晚的一条提单状态操作时间。
last_process_time = \
sorted(self.filtered(lambda x: x.customs_clearance_status.id).mapped('process_time'), reverse=True)[0]
return {
'name': _('Update the status of the bill of loading'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'update.bl.status.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_is_batch': True, 'default_last_process_time': last_process_time,
'default_current_status': customs_clearance_status_list[0]}
}
@api.depends('big_package_ids', 'big_package_ids.tally_state', 'big_package_ids.is_cancel')
def cal_tally_big_package_qty(self):
"""
......@@ -777,19 +718,6 @@ class CcBL(models.Model):
else:
raise UserError(reason)
def action_link_transfer_bl_no(self):
"""
批量关联转单号
"""
return {
'name': _('Link Transfer B/L No'),
'type': 'ir.actions.act_window',
'views': [[False, "form"]],
'res_model': 'batch.update.transfer.bl.no.wizard',
'target': 'new',
'context': {}
}
# 添加计算方法,根据bl_line_ids计算bl_total_line,bl_total_qty,bl_total_amount
@api.depends('ship_package_ids', 'big_package_ids', 'good_ids', 'ship_package_ids.is_cancel',
'big_package_ids.is_cancel', 'good_ids.is_cancel', 'ship_package_ids.total_value')
......@@ -819,6 +747,60 @@ class CcBL(models.Model):
state = fields.Selection([('draft', 'Draft'), ('ccing', 'CCing'), ('done', 'Done')], string='Status',
default='draft')
# 增加清关截止日期
cc_deadline = fields.Date(string='CC Deadline', default=fields.Date.today() + timedelta(days=5))
# 增加当前清关进度和进度日期
cc_progress = fields.Char(string='Current CC Progress')
cc_progress_date = fields.Date(string='Current CC Progress Date')
# 增加清关公司, 关联到res.partner
cc_company_id = fields.Many2one('res.partner', string='CC Company')
# 定义清关国家,关联到国家字段
cc_country_id = fields.Many2one('res.country', string='CC Country')
def push_clear_customs_start(self, utc_time):
# 创建向导
push_node_obj = self.env['cc.node'].sudo().search(
[('node_type', '=', 'package'), ('tk_code', '=', 'cb_imcustoms_start')], limit=1)
node_obj = self.env['cc.node'].sudo().search([('node_type', '=', 'package'), ('seq', '<', push_node_obj.seq)],
order='seq desc',
limit=1)
vals = {
'bl_id': self.id,
'bl_count': 1,
'current_status': node_obj.id,
'update_status': push_node_obj.id,
'process_time': utc_time,
'is_ok': True
}
wizard_obj = self.env['batch.input.ship.package.status.wizard'].sudo().create(vals)
wizard_obj.change_ship_package_ids()
wizard_obj = wizard_obj.with_context(dict(self._context, active_id=self.id))
wizard_obj.submit()
def push_clear_customs_end(self, utc_time):
# 创建向导
push_node_obj = self.env['cc.node'].sudo().search(
[('node_type', '=', 'package'), ('tk_code', '=', 'cb_imcustoms_finished')], limit=1)
node_obj = self.env['cc.node'].sudo().search([('node_type', '=', 'package'), ('seq', '<', push_node_obj.seq)],
order='seq desc',
limit=1)
vals = {
'bl_id': self.id,
'bl_count': 1,
'current_status': node_obj.id,
'update_status': push_node_obj.id,
'process_time': utc_time,
'is_ok': True
}
wizard_obj = self.env['batch.input.ship.package.status.wizard'].sudo().create(vals)
wizard_obj.change_ship_package_ids()
wizard_obj = wizard_obj.with_context(dict(self._context, active_id=self.id))
# print(wizard_obj.get_order())
wizard_obj.submit()
def ccing_func(self):
"""
变为清关中
......@@ -896,59 +878,116 @@ class CcBL(models.Model):
'domain': [('bl_line_id', 'in', ids), ('is_cancel', '=', False)],
}
# 增加清关截止日期
cc_deadline = fields.Date(string='CC Deadline', default=fields.Date.today() + timedelta(days=5))
def deal_bl_no(self, bl_no, state_arr=[]):
"""
处理提单号:去掉杠和空格,并转换为小写
:param bl_no:
:return:
"""
processed_bl_no = bl_no.replace('-', '').replace(' ', '').lower()
# 查询所有提单并处理它们的 bl_no
domain = [('state', 'in', state_arr)] if state_arr else []
all_bl_obj = self.env['cc.bl'].sudo().search(domain)
bl_obj = all_bl_obj.filtered(
lambda r: r.bl_no.replace('-', '').replace(' ', '').lower() == processed_bl_no) # 提单
return bl_obj
def deal_bl_no_and_transfer_bl_no(self, bl_no, state_arr=[]):
"""
优先匹配提单号,匹配不到则匹配转单号
匹配规则与提单号匹配规则一致:去掉杠和空格,转换为小写
:param bl_no:
:param state_arr:
:return:
"""
processed_bl_no = bl_no.replace('-', '').replace(' ', '').lower()
# 查询所有提单并处理它们的 bl_no
domain = [('state', 'in', state_arr)] if state_arr else []
all_bl_obj = self.env['cc.bl'].sudo().search(domain)
# 增加当前清关进度和进度日期
cc_progress = fields.Char(string='Current CC Progress')
cc_progress_date = fields.Date(string='Current CC Progress Date')
# 优先匹配提单号
bl_obj = all_bl_obj.filtered(
lambda r: r.bl_no and r.bl_no.replace('-', '').replace(' ', '').lower() == processed_bl_no)
# 增加清关公司, 关联到res.partner
cc_company_id = fields.Many2one('res.partner', string='CC Company')
# 如果提单号匹配不到,则匹配转单号
if not bl_obj:
bl_obj = all_bl_obj.filtered(
lambda r: r.transfer_bl_no and r.transfer_bl_no.replace('-', '').replace(' ',
'').lower() == processed_bl_no)
# 定义清关国家,关联到国家字段
cc_country_id = fields.Many2one('res.country', string='CC Country')
return bl_obj
def push_clear_customs_start(self, utc_time):
# 创建向导
push_node_obj = self.env['cc.node'].sudo().search(
[('node_type', '=', 'package'), ('tk_code', '=', 'cb_imcustoms_start')], limit=1)
node_obj = self.env['cc.node'].sudo().search([('node_type', '=', 'package'), ('seq', '<', push_node_obj.seq)],
order='seq desc',
limit=1)
vals = {
'bl_id': self.id,
'bl_count': 1,
'current_status': node_obj.id,
'update_status': push_node_obj.id,
'process_time': utc_time,
'is_ok': True
def action_batch_export_package(self):
"""
导出报关文件
"""
return {
'name': _('Export customs declaration documents'), # 导出报关文件
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'export.bl.big.package.xlsx.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_action_type': '报关文件'},
}
wizard_obj = self.env['batch.input.ship.package.status.wizard'].sudo().create(vals)
wizard_obj.change_ship_package_ids()
wizard_obj = wizard_obj.with_context(dict(self._context, active_id=self.id))
wizard_obj.submit()
def push_clear_customs_end(self, utc_time):
# 创建向导
push_node_obj = self.env['cc.node'].sudo().search(
[('node_type', '=', 'package'), ('tk_code', '=', 'cb_imcustoms_finished')], limit=1)
node_obj = self.env['cc.node'].sudo().search([('node_type', '=', 'package'), ('seq', '<', push_node_obj.seq)],
order='seq desc',
limit=1)
vals = {
'bl_id': self.id,
'bl_count': 1,
'current_status': node_obj.id,
'update_status': push_node_obj.id,
'process_time': utc_time,
'is_ok': True
# 导出清关提单文件
def action_export_bl_attachment_png(self):
return {
'name': _('Export Customs Clearance Bill of Lading'), # 导出清关提单文件
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'export.bl.big.package.xlsx.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_action_type': '清关提单文件'},
}
def batch_input_ship_package_status_wizard(self):
"""批量更新小包状态"""
return {
'name': _('Update the status of the small package'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'batch.input.ship.package.status.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_is_batch': True, 'default_bl_id': self.ids}
}
def action_link_transfer_bl_no(self):
"""
批量关联转单号
"""
return {
'name': _('Link Transfer B/L No'),
'type': 'ir.actions.act_window',
'views': [[False, "form"]],
'res_model': 'batch.update.transfer.bl.no.wizard',
'target': 'new',
'context': {}
}
def batch_update_bl_status_wizard(self):
"""批量更新提单状态"""
# 检查关务提单状态必须是同一个
customs_clearance_status_list = self.filtered(lambda x: x.customs_clearance_status.id).mapped(
'customs_clearance_status.id')
if len(customs_clearance_status_list) == 0:
# 请先配置默认的提单节点类型的清关节点
raise ValidationError(
_('Please configure the default customs clearance status of the bill of loading node type first.'))
if len(customs_clearance_status_list) > 1:
raise ValidationError(_('The customs clearance status of the selected bill of loading must be the same.'))
# 最近操作时间取最晚的一条提单状态操作时间。
last_process_time = \
sorted(self.filtered(lambda x: x.customs_clearance_status.id).mapped('process_time'), reverse=True)[0]
return {
'name': _('Update the status of the bill of loading'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'update.bl.status.wizard',
'target': 'new',
'context': {'active_id': self.ids, 'default_is_batch': True, 'default_last_process_time': last_process_time,
'default_current_status': customs_clearance_status_list[0]}
}
wizard_obj = self.env['batch.input.ship.package.status.wizard'].sudo().create(vals)
wizard_obj.change_ship_package_ids()
wizard_obj = wizard_obj.with_context(dict(self._context, active_id=self.id))
# print(wizard_obj.get_order())
wizard_obj.submit()
# 增加一个清关进度的业务对象,继承自models.Model, 用于管理业务数据.业务数据包括提单号、清关节点(业务对象)、进度日期、进度描述、更新人
......
......@@ -799,45 +799,6 @@ class CcBl(models.Model):
return [{'pallet_number': k, 'pallet_usage_time': v} for k, v in pallet_info.items()]
def deal_bl_no(self, bl_no, state_arr=[]):
"""
处理提单号:去掉杠和空格,并转换为小写
:param bl_no:
:return:
"""
processed_bl_no = bl_no.replace('-', '').replace(' ', '').lower()
# 查询所有提单并处理它们的 bl_no
domain = [('state', 'in', state_arr)] if state_arr else []
all_bl_obj = self.env['cc.bl'].sudo().search(domain)
bl_obj = all_bl_obj.filtered(
lambda r: r.bl_no.replace('-', '').replace(' ', '').lower() == processed_bl_no) # 提单
return bl_obj
def deal_bl_no_and_transfer_bl_no(self, bl_no, state_arr=[]):
"""
优先匹配提单号,匹配不到则匹配转单号
匹配规则与提单号匹配规则一致:去掉杠和空格,转换为小写
:param bl_no:
:param state_arr:
:return:
"""
processed_bl_no = bl_no.replace('-', '').replace(' ', '').lower()
# 查询所有提单并处理它们的 bl_no
domain = [('state', 'in', state_arr)] if state_arr else []
all_bl_obj = self.env['cc.bl'].sudo().search(domain)
# 优先匹配提单号
bl_obj = all_bl_obj.filtered(
lambda r: r.bl_no and r.bl_no.replace('-', '').replace(' ', '').lower() == processed_bl_no)
# 如果提单号匹配不到,则匹配转单号
if not bl_obj:
bl_obj = all_bl_obj.filtered(
lambda r: r.transfer_bl_no and r.transfer_bl_no.replace('-', '').replace(' ', '').lower() == processed_bl_no)
return bl_obj
def try_callback_track(self, max_retries=3, ship_package_ids=[], user_obj=False):
""" 封装的重试逻辑 """
for i in range(max_retries):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论