提交 0e5f03fb authored 作者: 伍姿英's avatar 伍姿英

Merge branch 'release/3.8.0'

......@@ -26,6 +26,7 @@
'wizard/email_template.xml',
'wizard/bl_done_wizard_views.xml',
'wizard/batch_get_pod_info_wizard_views.xml',
'wizard/batch_get_lastmile_pod_info_wizard_views.xml',
'data/data.xml',
'data/timer.xml',
'data/sequence.xml',
......
......@@ -68,6 +68,10 @@
# OCR可能将:识别为多个空格,如"DATETIMEOFRELEASE 1623420-SEP-2025"把:识别成了2 1333113-NOV-2025,把:识别成了3
r'DATETIMEOFRELEASE\s+(\d)(\d)[2,3](\d{2})(\d{2})-([A-Z]{3})-(\d{4})',
r'DATETIMEQFRELEASE\s+(\d)(\d)[2,3](\d{2})(\d{2})-([A-Z]{3})-(\d{4})',
r'DATE\.?TIME\.?OF\.?RELEASE[^\n]*?(\d{2}:\d{2})\s+(\d{2}-[A-Z]{3}-\d{4})',
r'DATETIME\.OFRELEASE(\d{2}:\d{2})\s+(\d{2}-[A-Z]{3}-\d{4})',
r'DATETIME\.OFRELEASE(\d)(\d)(\d{2})(\d{2})-([A-Z]{3})-(\d{4})',
r'DATETIME\.OFRELEASE\s+(\d)(\d)(\d{2})(\d{2})-([A-Z]{3})-(\d{4})',
]</field>
</record>
</data>
......
差异被折叠。
......@@ -722,7 +722,7 @@ class CcBL(models.Model):
def cron_get_pod(self):
"""
状态为清关中且附件信息尾程交接POD(待大包数量和箱号),为空的提单,自动获取尾程POD信息
状态为清关中且附件信息尾程交接POD(待大包数量和箱号),为空的提单,自动获取尾程POD信息 暂时不用
"""
fix_name = '尾程交接POD(待大包数量和箱号)'
bl_objs = self.env['cc.bl'].search(
......@@ -741,8 +741,7 @@ class CcBL(models.Model):
})
wizard_obj.confirm()
def _get_pod_files(self):
fix_name = '尾程交接POD(待大包数量和箱号)'
def _get_pod_files(self, fix_name):
res = []
for bl in self:
files = self.env['cc.clearance.file'].sudo().search(
......@@ -762,8 +761,13 @@ class CcBL(models.Model):
res.append((name, f.file))
return res
def action_download_pod(self):
files = self._get_pod_files()
def action_download_pod(self, pod_name):
"""
下载POD
:return:
"""
files = self._get_pod_files(pod_name)
if not files:
return {'type': 'ir.actions.act_window_close'}
if len(self) == 1 and len(files) == 1:
......@@ -1239,20 +1243,32 @@ class CcBL(models.Model):
}
def action_batch_get_pod_info(self):
"""批量获取尾程POD信息"""
"""批量获取货站提货POD信息"""
is_temp = self.filtered(lambda x: x.bl_type == 'temu')
if is_temp:
raise ValidationError(_('TEMU提单不支持获取尾程POD信息,请点击批量创建提单!'))
raise ValidationError(_('TEMU提单不支持获取货站提货POD信息,请点击批量创建提单!'))
return {
'name': _('Batch Get POD Info'),
'name': _('Batch Get PickUp POD Info'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'batch.get.pod.info.wizard',
'context': {'active_id': self.ids, 'default_action_type': '获取尾程POD信息'},
'context': {'active_id': self.ids, 'default_action_type': '获取货站提货POD信息'},
'views': [[self.env.ref('ccs_base.view_batch_get_pod_info_wizard_form').id, "form"]],
'target': 'new',
}
def action_batch_get_last_mile_pod_info(self):
"""批量获取尾程POD信息"""
return {
'name': _('Batch Get Last Mile POD Info'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'batch.get.lastmile.pod.info.wizard',
'context': {'active_id': self.ids},
'views': [[self.env.ref('ccs_base.view_batch_get_lastmile_pod_info_wizard_form').id, "form"]],
'target': 'new',
}
def action_create_temu_bl(self):
"""
创建temu提单
......@@ -1267,20 +1283,19 @@ class CcBL(models.Model):
'target': 'new'
}
def action_batch_download_pod(self):
def action_batch_download_pod(self, pod_name=''):
"""
将选中的提单以提单号命名下载尾程交接POD文件,若文件有多个则以提单-1/-2进行命名下载,若选择多个提单,则将所有文件打包成zip,zip命名则以POD进行命名
"""
# 检查是否有选中的提单
if not self:
raise UserError(_('Please select at least one bill of loading.'))
# 检查是否有尾程交接POD文件
fix_name = '尾程交接POD(待大包数量和箱号)'
# 检查是否有尾程交接POD文件或货站提货POD文件
has_files = self.env['cc.clearance.file'].search_count(
[('bl_id', 'in', self.ids), ('file_name', '=', fix_name), ('file', '!=', False)])
[('bl_id', 'in', self.ids), ('file_name', '=', pod_name), ('file', '!=', False)])
if not has_files:
raise UserError(_('Please configure the tail-end handover POD file of the bill of loading first.'))
return self.action_download_pod()
raise UserError(_('Please configure %s file of the bill of loading first.') % pod_name)
return self.action_download_pod(pod_name)
# 增加一个清关进度的业务对象,继承自models.Model, 用于管理业务数据.业务数据包括提单号、清关节点(业务对象)、进度日期、进度描述、更新人
......
......@@ -118,19 +118,17 @@ class OrderStateChangeRule(models.Model):
file_obj.is_upload = False
file_obj.action_sync()
def upload_pod_attachment(self, bl_obj, name, data):
"""尾程交接POD(待大包数量和箱号) 文件上传与同步"""
def upload_pod_attachment(self, bl_obj, name, data,file_name='货站提货POD'):
"""尾程交接POD(待大包数量和箱号)/货站提货POD 文件上传与同步"""
arr = [
{
'file_name': '尾程交接POD(待大包数量和箱号)',
'file_name': file_name,
'file': base64.encodebytes(data),
'attachment_name': name,
'is_upload': False,
'bl_id': bl.id
} for bl in bl_obj
]
# file_objs = self.env['cc.clearance.file'].sudo().search([('file_name', '=', '尾程交接POD(待大包数量和箱号)'),
# ('bl_id', 'in', bl_obj.ids)])
file_objs = self.env['cc.clearance.file'].sudo().create(arr)
# 最大重试次数
max_retries = 2
......@@ -138,10 +136,6 @@ class OrderStateChangeRule(models.Model):
retries = 0
while retries <= max_retries:
try:
# 设置文件内容
# file_obj.file = base64.encodebytes(data)
# file_obj.attachment_name = name
# file_obj.is_upload = False # 确保文件状态是未上传
# 尝试上传操作
file_obj.action_sync()
# 检查是否上传成功,假设 is_upload 为 False 表示上传失败
......
......@@ -8,6 +8,7 @@ batch_update_transfer_bl_no_wizard_group_user,batch_update_transfer_bl_no_wizard
bl_done_wizard_group_user,bl_done_wizard_group_user,ccs_base.model_bl_done_wizard,base.group_user,1,1,1,1
batch_get_pod_info_wizard_group_user,batch_get_pod_info_wizard_group_user,ccs_base.model_batch_get_pod_info_wizard,base.group_user,1,1,1,1
access_group_user_common_common,access_group_user_common_common,model_common_common,base.group_user,1,1,1,1
batch_get_lastmile_pod_info_wizard_group_user,batch_get_lastmile_pod_info_wizard_group_user,ccs_base.model_batch_get_lastmile_pod_info_wizard,base.group_user,1,1,1,1
access_cc_node_base.group_user,cc_node base.group_user,ccs_base.model_cc_node,base.group_user,1,0,0,0
......
......@@ -412,9 +412,9 @@
</field>
</record>
<!-- 获取尾程POD -->
<!-- 获取货站提货POD -->
<record id="bl_get_pod_info_server_action" model="ir.actions.server">
<field name="name">Batch Get POD Info</field>
<field name="name">Batch Get PickUp POD Info</field>
<field name="model_id" ref="model_cc_bl"/>
<field name="binding_model_id" ref="model_cc_bl"/>
<field name="state">code</field>
......@@ -426,10 +426,23 @@
</field>
</record>
<!-- 获取尾程快递POD -->
<record id="bl_get_delivery_pod_info_server_action" model="ir.actions.server">
<field name="name">Batch Get Last Mile POD Info</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="binding_view_types">list,form</field>
<field name="groups_id" eval="[(4, ref('ccs_base.group_clearance_of_customs_user'))]"/>
<field name="code">
if records:
action = records.action_batch_get_last_mile_pod_info()
</field>
</record>
<!-- 下载POD -->
<!-- 下载货站提货POD-->
<record id="bl_download_pod_server_action" model="ir.actions.server">
<field name="name">Batch Download POD</field>
<field name="name">Batch Download PickUp POD</field>
<field name="model_id" ref="model_cc_bl"/>
<field name="binding_model_id" ref="model_cc_bl"/>
<field name="state">code</field>
......@@ -437,8 +450,21 @@
<field name="groups_id" eval="[(4, ref('ccs_base.group_clearance_of_customs_user'))]"/>
<field name="code">
if records:
action = records.action_batch_download_pod()
action = records.action_batch_download_pod('货站提货POD')
</field>
</record>
<!-- 下载尾程交接POD -->
<record id="bl_download_delivery_pod_server_action" model="ir.actions.server">
<field name="name">Batch Download Last Mile POD</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="binding_view_types">list,form</field>
<field name="groups_id" eval="[(4, ref('ccs_base.group_clearance_of_customs_user'))]"/>
<field name="code">
if records:
action = records.action_batch_download_pod(pod_name='尾程交接POD(待大包数量和箱号)')
</field>
</record>
</odoo>
\ No newline at end of file
......@@ -8,4 +8,6 @@ from . import update_bl_status_wizard
from . import batch_update_transfer_bl_no_wizard
from . import bl_done_wizard
from . import batch_get_pod_info_wizard
from . import batch_get_lastmile_pod_info_wizard
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Batch Get Last Mile POD Info Wizard Form View 批量获取尾程POD信息向导表单视图 -->
<record id="view_batch_get_lastmile_pod_info_wizard_form" model="ir.ui.view">
<field name="name">batch.get.lastmile.pod.info.wizard.form</field>
<field name="model">batch.get.lastmile.pod.info.wizard</field>
<field name="arch" type="xml">
<form string="Batch Get Last Mile POD Info"> <!-- 批量获取尾程POD信息 -->
<sheet>
<div class="oe_title" attrs="{'invisible': [('pdf_file','!=',False)]}">
<h3>Click to preview and start downloading the file</h3> <!-- 点击预览开始获取文件 -->
</div>
<group>
<group>
<field name="get_last_mile_pod" widget="boolean_toggle"
attrs="{'invisible': [('pdf_file','=',False)]}"/>
<field name="sync_last_mile_pod" widget="boolean_toggle"
attrs="{'invisible': ['|', ('pdf_file','=',False), ('show_sync_last_mile_pod','=',False)]}"/>
<field name="show_sync_last_mile_pod" invisible="1"/>
</group>
</group>
<group attrs="{'invisible': ['|', ('pdf_file', '=', False), ('show_error_message', '=', False)]}">
<field name="generate_successful_processed" widget="boolean_toggle"/>
</group>
<div class="alert alert-info" role="alert" attrs="{'invisible': [('pdf_file', '=', False)]}">
<strong>Description:</strong> <!-- 说明: -->
<ul>
<li>
<strong>Upload to Last Mile POD:</strong>
Write fetched PDF to BL attachments with name "Last Mile POD (pending big package
count and box no.)"
</li>
<li attrs="{'invisible': [('show_sync_last_mile_pod','=',False)]}">
<strong>Sync to TK:</strong>
Sync the attachment information to TK.
</li>
</ul>
</div>
<div class="alert alert-danger" role="alert"
attrs="{'invisible': [('show_error_message', '=', False)]}">
<field name="show_error_message"/>
</div>
<div>
<field name="pdf_file" filename="pdf_filename" widget="pdf_viewer" readonly="1"
attrs="{'invisible': [('pdf_file', '=', False)]}"/>
</div>
<footer>
<!-- 预览按钮:处理PDF并显示合并后的文件 -->
<button string="Preview" type="object" name="action_preview" class="btn-primary"
attrs="{'invisible': [('pdf_file', '!=', False)]}"/>
<!-- 确认按钮:使用已处理的文件数据进行回写 -->
<!-- 勾了上传或同步尾程POD信息,才显示确认按钮 -->
<button string="Confirm" type="object" name="confirm" class="btn-primary"
attrs="{'invisible': ['|', ('pdf_file','=',False), '&amp;', ('get_last_mile_pod','=',False), ('sync_last_mile_pod','=',False)]}"/>
</footer>
</sheet>
</form>
</field>
</record>
</data>
</odoo>
......@@ -36,10 +36,9 @@
Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files
</li> <!-- 涂抹指定文字:对PDF文件中的指定文字进行涂抹处理 -->
<li attrs="{'invisible': [('sync_successful_processed', '=', False)]}">
<strong>Sync Last Mile POD:</strong>
Synchronize POD (Proof of Delivery) attachment information with TK system, including
big package quantities and container numbers
</li> <!-- 同步尾程POD:向TK同步尾程交接POD(待大包数量和箱号)的附件信息 -->
<strong>Sync Cargo Terminal Pickup POD:</strong>
Synchronize the attachment information of the POD for picking up goods from TK cargo station
</li> <!-- 同步货站提货POD:向TK同步货站提货POD的附件信息 -->
<li attrs="{'invisible': [('sync_successful_processed', '=', False)]}">
<strong>Sync Push Match Node:</strong>
......@@ -106,10 +105,9 @@
<strong>Description:</strong> <!-- 说明: -->
<ul>
<li>
<strong>Get Last Mile POD:</strong>
Generate a last mile POD (Proof of Delivery) attachment information, including
big package quantities and container numbers
</li> <!-- 获取尾程POD:生成一条尾程交接POD(待大包数量和箱号)的附件信息 -->
<strong>Get Cargo Terminal Pickup POD:</strong>
Generate a attachment information of the POD for picking up goods cargo station
</li> <!-- 获取货站提货POD:生成一条货站提货POD的附件信息 -->
<li attrs="{'invisible': [('get_last_mile_pod', '=', False)]}">
<strong>Remove Specified Text:</strong>
Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论