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

Merge branch 'release/3.8.0'

...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
'wizard/email_template.xml', 'wizard/email_template.xml',
'wizard/bl_done_wizard_views.xml', 'wizard/bl_done_wizard_views.xml',
'wizard/batch_get_pod_info_wizard_views.xml', 'wizard/batch_get_pod_info_wizard_views.xml',
'wizard/batch_get_lastmile_pod_info_wizard_views.xml',
'data/data.xml', 'data/data.xml',
'data/timer.xml', 'data/timer.xml',
'data/sequence.xml', 'data/sequence.xml',
......
...@@ -68,6 +68,10 @@ ...@@ -68,6 +68,10 @@
# OCR可能将:识别为多个空格,如"DATETIMEOFRELEASE 1623420-SEP-2025"把:识别成了2 1333113-NOV-2025,把:识别成了3 # 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'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'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> ]</field>
</record> </record>
</data> </data>
......
差异被折叠。
...@@ -722,7 +722,7 @@ class CcBL(models.Model): ...@@ -722,7 +722,7 @@ class CcBL(models.Model):
def cron_get_pod(self): def cron_get_pod(self):
""" """
状态为清关中且附件信息尾程交接POD(待大包数量和箱号),为空的提单,自动获取尾程POD信息 状态为清关中且附件信息尾程交接POD(待大包数量和箱号),为空的提单,自动获取尾程POD信息 暂时不用
""" """
fix_name = '尾程交接POD(待大包数量和箱号)' fix_name = '尾程交接POD(待大包数量和箱号)'
bl_objs = self.env['cc.bl'].search( bl_objs = self.env['cc.bl'].search(
...@@ -741,8 +741,7 @@ class CcBL(models.Model): ...@@ -741,8 +741,7 @@ class CcBL(models.Model):
}) })
wizard_obj.confirm() wizard_obj.confirm()
def _get_pod_files(self): def _get_pod_files(self, fix_name):
fix_name = '尾程交接POD(待大包数量和箱号)'
res = [] res = []
for bl in self: for bl in self:
files = self.env['cc.clearance.file'].sudo().search( files = self.env['cc.clearance.file'].sudo().search(
...@@ -762,8 +761,13 @@ class CcBL(models.Model): ...@@ -762,8 +761,13 @@ class CcBL(models.Model):
res.append((name, f.file)) res.append((name, f.file))
return res return res
def action_download_pod(self): def action_download_pod(self, pod_name):
files = self._get_pod_files() """
下载POD
:return:
"""
files = self._get_pod_files(pod_name)
if not files: if not files:
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
if len(self) == 1 and len(files) == 1: if len(self) == 1 and len(files) == 1:
...@@ -1239,20 +1243,32 @@ class CcBL(models.Model): ...@@ -1239,20 +1243,32 @@ class CcBL(models.Model):
} }
def action_batch_get_pod_info(self): def action_batch_get_pod_info(self):
"""批量获取尾程POD信息""" """批量获取货站提货POD信息"""
is_temp = self.filtered(lambda x: x.bl_type == 'temu') is_temp = self.filtered(lambda x: x.bl_type == 'temu')
if is_temp: if is_temp:
raise ValidationError(_('TEMU提单不支持获取尾程POD信息,请点击批量创建提单!')) raise ValidationError(_('TEMU提单不支持获取货站提货POD信息,请点击批量创建提单!'))
return { return {
'name': _('Batch Get POD Info'), 'name': _('Batch Get PickUp POD Info'),
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'view_mode': 'form', 'view_mode': 'form',
'res_model': 'batch.get.pod.info.wizard', '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"]], 'views': [[self.env.ref('ccs_base.view_batch_get_pod_info_wizard_form').id, "form"]],
'target': 'new', '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): def action_create_temu_bl(self):
""" """
创建temu提单 创建temu提单
...@@ -1267,20 +1283,19 @@ class CcBL(models.Model): ...@@ -1267,20 +1283,19 @@ class CcBL(models.Model):
'target': 'new' 'target': 'new'
} }
def action_batch_download_pod(self): def action_batch_download_pod(self, pod_name=''):
""" """
将选中的提单以提单号命名下载尾程交接POD文件,若文件有多个则以提单-1/-2进行命名下载,若选择多个提单,则将所有文件打包成zip,zip命名则以POD进行命名 将选中的提单以提单号命名下载尾程交接POD文件,若文件有多个则以提单-1/-2进行命名下载,若选择多个提单,则将所有文件打包成zip,zip命名则以POD进行命名
""" """
# 检查是否有选中的提单 # 检查是否有选中的提单
if not self: if not self:
raise UserError(_('Please select at least one bill of loading.')) raise UserError(_('Please select at least one bill of loading.'))
# 检查是否有尾程交接POD文件 # 检查是否有尾程交接POD文件或货站提货POD文件
fix_name = '尾程交接POD(待大包数量和箱号)'
has_files = self.env['cc.clearance.file'].search_count( 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: if not has_files:
raise UserError(_('Please configure the tail-end handover POD file of the bill of loading first.')) raise UserError(_('Please configure %s file of the bill of loading first.') % pod_name)
return self.action_download_pod() return self.action_download_pod(pod_name)
# 增加一个清关进度的业务对象,继承自models.Model, 用于管理业务数据.业务数据包括提单号、清关节点(业务对象)、进度日期、进度描述、更新人 # 增加一个清关进度的业务对象,继承自models.Model, 用于管理业务数据.业务数据包括提单号、清关节点(业务对象)、进度日期、进度描述、更新人
......
...@@ -118,19 +118,17 @@ class OrderStateChangeRule(models.Model): ...@@ -118,19 +118,17 @@ class OrderStateChangeRule(models.Model):
file_obj.is_upload = False file_obj.is_upload = False
file_obj.action_sync() file_obj.action_sync()
def upload_pod_attachment(self, bl_obj, name, data): def upload_pod_attachment(self, bl_obj, name, data,file_name='货站提货POD'):
"""尾程交接POD(待大包数量和箱号) 文件上传与同步""" """尾程交接POD(待大包数量和箱号)/货站提货POD 文件上传与同步"""
arr = [ arr = [
{ {
'file_name': '尾程交接POD(待大包数量和箱号)', 'file_name': file_name,
'file': base64.encodebytes(data), 'file': base64.encodebytes(data),
'attachment_name': name, 'attachment_name': name,
'is_upload': False, 'is_upload': False,
'bl_id': bl.id 'bl_id': bl.id
} for bl in bl_obj } 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) file_objs = self.env['cc.clearance.file'].sudo().create(arr)
# 最大重试次数 # 最大重试次数
max_retries = 2 max_retries = 2
...@@ -138,10 +136,6 @@ class OrderStateChangeRule(models.Model): ...@@ -138,10 +136,6 @@ class OrderStateChangeRule(models.Model):
retries = 0 retries = 0
while retries <= max_retries: while retries <= max_retries:
try: try:
# 设置文件内容
# file_obj.file = base64.encodebytes(data)
# file_obj.attachment_name = name
# file_obj.is_upload = False # 确保文件状态是未上传
# 尝试上传操作 # 尝试上传操作
file_obj.action_sync() file_obj.action_sync()
# 检查是否上传成功,假设 is_upload 为 False 表示上传失败 # 检查是否上传成功,假设 is_upload 为 False 表示上传失败
......
...@@ -8,6 +8,7 @@ batch_update_transfer_bl_no_wizard_group_user,batch_update_transfer_bl_no_wizard ...@@ -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 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 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 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 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 @@ ...@@ -412,9 +412,9 @@
</field> </field>
</record> </record>
<!-- 获取尾程POD --> <!-- 获取货站提货POD -->
<record id="bl_get_pod_info_server_action" model="ir.actions.server"> <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="model_id" ref="model_cc_bl"/>
<field name="binding_model_id" ref="model_cc_bl"/> <field name="binding_model_id" ref="model_cc_bl"/>
<field name="state">code</field> <field name="state">code</field>
...@@ -426,10 +426,23 @@ ...@@ -426,10 +426,23 @@
</field> </field>
</record> </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"> <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="model_id" ref="model_cc_bl"/>
<field name="binding_model_id" ref="model_cc_bl"/> <field name="binding_model_id" ref="model_cc_bl"/>
<field name="state">code</field> <field name="state">code</field>
...@@ -437,8 +450,21 @@ ...@@ -437,8 +450,21 @@
<field name="groups_id" eval="[(4, ref('ccs_base.group_clearance_of_customs_user'))]"/> <field name="groups_id" eval="[(4, ref('ccs_base.group_clearance_of_customs_user'))]"/>
<field name="code"> <field name="code">
if records: if records:
action = records.action_batch_download_pod() action = records.action_batch_download_pod('货站提货POD')
</field> </field>
</record> </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> </odoo>
\ No newline at end of file
...@@ -8,4 +8,6 @@ from . import update_bl_status_wizard ...@@ -8,4 +8,6 @@ from . import update_bl_status_wizard
from . import batch_update_transfer_bl_no_wizard from . import batch_update_transfer_bl_no_wizard
from . import bl_done_wizard from . import bl_done_wizard
from . import batch_get_pod_info_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 @@ ...@@ -36,10 +36,9 @@
Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files
</li> <!-- 涂抹指定文字:对PDF文件中的指定文字进行涂抹处理 --> </li> <!-- 涂抹指定文字:对PDF文件中的指定文字进行涂抹处理 -->
<li attrs="{'invisible': [('sync_successful_processed', '=', False)]}"> <li attrs="{'invisible': [('sync_successful_processed', '=', False)]}">
<strong>Sync Last Mile POD:</strong> <strong>Sync Cargo Terminal Pickup POD:</strong>
Synchronize POD (Proof of Delivery) attachment information with TK system, including Synchronize the attachment information of the POD for picking up goods from TK cargo station
big package quantities and container numbers </li> <!-- 同步货站提货POD:向TK同步货站提货POD的附件信息 -->
</li> <!-- 同步尾程POD:向TK同步尾程交接POD(待大包数量和箱号)的附件信息 -->
<li attrs="{'invisible': [('sync_successful_processed', '=', False)]}"> <li attrs="{'invisible': [('sync_successful_processed', '=', False)]}">
<strong>Sync Push Match Node:</strong> <strong>Sync Push Match Node:</strong>
...@@ -106,10 +105,9 @@ ...@@ -106,10 +105,9 @@
<strong>Description:</strong> <!-- 说明: --> <strong>Description:</strong> <!-- 说明: -->
<ul> <ul>
<li> <li>
<strong>Get Last Mile POD:</strong> <strong>Get Cargo Terminal Pickup POD:</strong>
Generate a last mile POD (Proof of Delivery) attachment information, including Generate a attachment information of the POD for picking up goods cargo station
big package quantities and container numbers </li> <!-- 获取货站提货POD:生成一条货站提货POD的附件信息 -->
</li> <!-- 获取尾程POD:生成一条尾程交接POD(待大包数量和箱号)的附件信息 -->
<li attrs="{'invisible': [('get_last_mile_pod', '=', False)]}"> <li attrs="{'invisible': [('get_last_mile_pod', '=', False)]}">
<strong>Remove Specified Text:</strong> <strong>Remove Specified Text:</strong>
Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files Remove specified text (AGN, UCLINK LOGISITICS LTD) from PDF files
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论