提交 2d04ffe8 authored 作者: 贺阳's avatar 贺阳

1、PDA扫码记录的操作增加 按托盘理货或按托盘交货

2、按托盘理货接口
上级 9344661e
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
""", """,
'category': 'Clearance of customs', 'category': 'Clearance of customs',
'website': 'https://www.yizuo.ltd', 'website': 'https://www.yizuo.ltd',
'depends': ['base_setup', 'ccs_base'], 'depends': ['base_setup', 'ccs_base', 'ccs_pallet'],
'data': [ 'data': [
'security/security.xml', 'security/security.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
......
...@@ -10,6 +10,7 @@ from . import ir_attachment ...@@ -10,6 +10,7 @@ from . import ir_attachment
from . import http from . import http
from . import pda_scan_record from . import pda_scan_record
from . import bl_patrol from . import bl_patrol
from . import cc_pallet
# -*- coding: utf-8 -*-
# 导入日志
import logging
from odoo import models, fields, api, _
# 获取日志
_logger = logging.getLogger(__name__)
class CcPallet(models.Model):
# 模型名称
_inherit = 'cc.pallet'
# 模型描述
_description = 'Pallet'
def search_pallet_info(self):
"""搜索托盘信息"""
return {
'id': self.id,#托盘id
'name': self.name,#托盘号
'express_company_id': self.express_company_id.id,#快递公司id
'express_company_name': self.express_company_id.name,#快递公司名称
'usage_state': self.usage_state,#使用状态 unused未使用 used已使用
'print_state': self.print_state,#打印状态 unprinted未打印 printed已打印
'sorting_time': self.sorting_time,#托盘理货时间
'delivery_time': self.delivery_time,#托盘交货时间
'package_count': self.package_count,#大包数量
'partner_id': self.partner_id.id,#使用客户id
'partner_name': self.partner_id.name,#使用客户名称
'delivery_plate_number': self.delivery_plate_number,#托盘交付车牌号
}
\ No newline at end of file
...@@ -24,8 +24,10 @@ class PDAScanRecord(models.Model): ...@@ -24,8 +24,10 @@ class PDAScanRecord(models.Model):
operation = fields.Selection([ operation = fields.Selection([
('bill_tally', _('Bill Tally')), # 按提单理货 ('bill_tally', _('Bill Tally')), # 按提单理货
('tail_tally', _('Tail Tally')), # 按尾程理货 ('tail_tally', _('Tail Tally')), # 按尾程理货
('pallet_tally', _('Pallet Tally')), # 按托盘理货
('bill_handover', _('Bill Handover')), # 按提单交货 ('bill_handover', _('Bill Handover')), # 按提单交货
('tail_handover', _('Tail Handover')) # 按尾程交货 ('tail_handover', _('Tail Handover')), # 按尾程交货
('pallet_handover', _('Pallet Handover')) # 按托盘交货
], string=_('Operation'), required=True) # 操作 ], string=_('Operation'), required=True) # 操作
record_type = fields.Selection([ record_type = fields.Selection([
('tally', _('Tally')), # 理货 ('tally', _('Tally')), # 理货
......
...@@ -124,6 +124,7 @@ class CcPallet(models.Model): ...@@ -124,6 +124,7 @@ class CcPallet(models.Model):
'target': 'new', 'target': 'new',
'context': { 'context': {
'default_pallet_ids': [(6, 0, self.ids)], 'default_pallet_ids': [(6, 0, self.ids)],
'active_ids': self.ids,
}, },
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- 托盘标签纸张格式 -->
<record id="paperformat_pallet_label" model="report.paperformat">
<field name="name">托盘标签 (10x15cm)</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="orientation">Portrait</field>
<field name="margin_top">0</field>
<field name="margin_bottom">0</field>
<field name="margin_left">0</field>
<field name="margin_right">0</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">0</field>
<field name="dpi">90</field>
<field name="page_width">10</field>
<field name="page_height">15</field>
</record>
<!-- 托盘标签打印报告 --> <!-- 托盘标签打印报告 -->
<record id="action_pallet_label_report" model="ir.actions.report"> <record id="action_pallet_label_report" model="ir.actions.report">
<field name="name">托盘标签</field> <field name="name">托盘标签</field>
...@@ -7,6 +24,7 @@ ...@@ -7,6 +24,7 @@
<field name="report_type">qweb-pdf</field> <field name="report_type">qweb-pdf</field>
<field name="report_name">ccs_pallet.pallet_label_report</field> <field name="report_name">ccs_pallet.pallet_label_report</field>
<field name="report_file">ccs_pallet.pallet_label_report</field> <field name="report_file">ccs_pallet.pallet_label_report</field>
<field name="paperformat_id" ref="paperformat_pallet_label"/>
<field name="binding_model_id" ref="model_cc_pallet"/> <field name="binding_model_id" ref="model_cc_pallet"/>
<field name="binding_type">report</field> <field name="binding_type">report</field>
</record> </record>
...@@ -15,22 +33,21 @@ ...@@ -15,22 +33,21 @@
<template id="pallet_label_report"> <template id="pallet_label_report">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="pallet"> <t t-foreach="docs" t-as="pallet">
<div class="page" style="width: 10cm; height: 15cm; margin: 0; padding: 0.5cm; border: 1px solid #ccc; page-break-after: always;"> <div class="page" style="width: 100%; height: 100%; margin: 0; padding: 0.3cm; page-break-after: always; font-family: 'DejaVu Sans', Arial, sans-serif; box-sizing: border-box; position: relative;">
<!-- 客户名称和快递简称 --> <!-- 客户名称和快递简称 -->
<div style="text-align: center; margin-bottom: 1cm;"> <div style="text-align: center; height: 2cm; display: flex; align-items: center; justify-content: center; margin-bottom: 0.2cm;">
<h2 style="margin: 0; font-size: 24px; font-weight: bold;"> <h2 style="margin: 0; font-size: 18px; font-weight: bold; line-height: 1.2;">
<t t-esc="pallet.customer_id.name or 'TIKTOK'"/> / <t t-esc="pallet.express_company_id.name or 'RM'"/> <t t-esc="pallet.partner_id.name or 'TIKTOK'"/> / <t t-esc="pallet.express_company_id.name or 'RM'"/>
</h2> </h2>
</div> </div>
<!-- 条形码区域 --> <!-- 条形码区域 -->
<div style="text-align: center; margin: 2cm 0; padding: 1cm; border: 2px dashed #999; background-color: #f9f9f9;"> <div style="text-align: center; height: 8cm; border: 2px dashed #999; background-color: #f9f9f9; display: flex; flex-direction: column; justify-content: center; margin-bottom: 0.2cm;">
<div style="font-size: 18px; color: #666; margin-bottom: 0.5cm;"> <div style="font-size: 14px; color: #666; margin-bottom: 0.5cm;">
<!-- 托盘号作为二维码 --> <!-- 托盘号作为条形码 -->
<t t-if="pallet.name"> <t t-if="pallet.name">
<!-- `quiet=0` to remove the left and right margins on the barcode --> <div t-out="pallet.name" style="padding:0; margin-bottom: 0.3cm;" t-options="{'widget': 'barcode', 'quiet': 0, 'symbology': 'auto', 'width': 2, 'height': 60}"/>
<div t-out="pallet.name" style="padding:0" t-options="{'widget': 'barcode', 'quiet': 0, 'symbology': 'auto', 'img_style': barcode_size}"/> <div class="o_label_name" style="height:1.2em;background-color: transparent; font-size: 12px;">
<div class="o_label_name" style="height:1.7em;background-color: transparent;">
<span t-out="pallet.name"/> <span t-out="pallet.name"/>
</div> </div>
</t> </t>
...@@ -38,8 +55,8 @@ ...@@ -38,8 +55,8 @@
</div> </div>
<!-- 托盘号 --> <!-- 托盘号 -->
<div style="text-align: center; margin-top: 1cm;"> <div style="text-align: center; height: 3cm; display: flex; align-items: center; justify-content: center;">
<h1 style="margin: 0; font-size: 28px; font-weight: bold;"> <h1 style="margin: 0; font-size: 22px; font-weight: bold; line-height: 1.2;">
<t t-esc="pallet.name"/> <t t-esc="pallet.name"/>
</h1> </h1>
</div> </div>
......
...@@ -31,13 +31,4 @@ class PalletPrintWizard(models.TransientModel): ...@@ -31,13 +31,4 @@ class PalletPrintWizard(models.TransientModel):
def _generate_print_report(self): def _generate_print_report(self):
"""生成打印报告""" """生成打印报告"""
return { return self.env.ref('ccs_pallet.action_pallet_label_report').report_action(self.pallet_ids)
'type': 'ir.actions.report',
'report_name': 'ccs_pallet.pallet_label_report',
'report_type': 'qweb-pdf',
'data': {
'ids': self.pallet_ids.ids,
'model': 'cc.pallet',
},
'context': self.env.context,
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论