增加物流面单打印报告
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'views/res_partner_view.xml',
|
'views/res_partner_view.xml',
|
||||||
'views/view.xml',
|
'views/view.xml',
|
||||||
|
'report/bill_report.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ class JdEclp(models.Model):
|
|||||||
# bill = fields.Char(string='物流面单')
|
# bill = fields.Char(string='物流面单')
|
||||||
|
|
||||||
bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
|
bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
|
||||||
|
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
|
||||||
|
bill_show = fields.Binary(string='物流面单展示', readonly=True)
|
||||||
|
|
||||||
@api.depends('carrier_tracking_ref')
|
@api.depends('carrier_tracking_ref')
|
||||||
def query_bill_pdf(self):
|
def query_bill_pdf(self):
|
||||||
@@ -109,6 +111,7 @@ class JdEclp(models.Model):
|
|||||||
bill_url = 'http:' + bill_url_str
|
bill_url = 'http:' + bill_url_str
|
||||||
data = base64.b64encode(requests.get(bill_url).content)
|
data = base64.b64encode(requests.get(bill_url).content)
|
||||||
# self.bill = ''
|
# self.bill = ''
|
||||||
|
self.bill_show = data
|
||||||
_logger.info('调用成功2')
|
_logger.info('调用成功2')
|
||||||
attachment = self.env['ir.attachment'].sudo().create({
|
attachment = self.env['ir.attachment'].sudo().create({
|
||||||
'datas': data,
|
'datas': data,
|
||||||
|
|||||||
84
sf_bf_connect/report/bill_report.xml
Normal file
84
sf_bf_connect/report/bill_report.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<!-- 托盘码打印尺寸-->
|
||||||
|
<!-- <record id="sf_tray1" model="report.paperformat">-->
|
||||||
|
<!-- <field name="name">Dymo Label Sheet</field>-->
|
||||||
|
<!-- <field name="default" eval="True"/>-->
|
||||||
|
<!-- <field name="format">custom</field>-->
|
||||||
|
<!-- <field name="page_height">100</field>-->
|
||||||
|
<!-- <field name="page_width">60</field>-->
|
||||||
|
<!-- <field name="orientation">Landscape</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="disable_shrinking" eval="True"/>-->
|
||||||
|
<!-- <field name="dpi">96</field>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
<record model="ir.actions.report" id="stock_picking_report">
|
||||||
|
<field name="name">面单打印</field>
|
||||||
|
<field name="model">stock.picking</field>
|
||||||
|
<field name="report_type">qweb-pdf</field>
|
||||||
|
<field name="report_name">sf_bf_connect.bill_report_template</field>
|
||||||
|
<field name="print_report_name">(object.carrier_tracking_ref)</field>
|
||||||
|
<field name="binding_model_id" ref="stock.model_stock_picking"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- 托盘码打印动作-->
|
||||||
|
<!-- <record id="label_sf_tray_code" model="ir.actions.report">-->
|
||||||
|
<!-- <field name="name">打印条形码</field>-->
|
||||||
|
<!-- <field name="model">sf.tray</field>-->
|
||||||
|
<!-- <field name="report_type">qweb-pdf</field>-->
|
||||||
|
<!-- <field name="report_name">sf_manufacturing.sf_tray_template</field>-->
|
||||||
|
<!-- <field name="report_file">sf_manufacturing.sf_tray_template</field>-->
|
||||||
|
<!-- <field name="binding_model_id" ref="model_sf_tray"/>-->
|
||||||
|
<!-- <field name="binding_type">report</field>-->
|
||||||
|
<!-- <field name="paperformat_id" ref="sf_manufacturing.sf_tray1"/>-->
|
||||||
|
|
||||||
|
<!-- </record>-->
|
||||||
|
<!-- 托盘码打印模板-->
|
||||||
|
<template id="bill_report_template">
|
||||||
|
<t t-call="web.html_container">
|
||||||
|
<t t-call="web.external_layout">
|
||||||
|
|
||||||
|
<t t-foreach="docs" t-as="o">
|
||||||
|
<div class="page">
|
||||||
|
<!-- <div t-field="o.bill_show"-->
|
||||||
|
<!-- t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>-->
|
||||||
|
<div t-field="o.bill_show"/>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- <!– 产品信息打印动作–>-->
|
||||||
|
<!-- <record id="label_sf_tray_code1" model="ir.actions.report">-->
|
||||||
|
<!-- <field name="name">打印产品信息</field>-->
|
||||||
|
<!-- <field name="model">mrp.workorder</field>-->
|
||||||
|
<!-- <field name="report_type">qweb-pdf</field>-->
|
||||||
|
<!-- <field name="report_name">sf_manufacturing.sf_tray_template1</field>-->
|
||||||
|
<!-- <field name="report_file">sf_manufacturing.sf_tray_template1</field>-->
|
||||||
|
<!-- <field name="binding_model_id" ref="model_mrp_workorder"/>-->
|
||||||
|
<!-- <field name="binding_type">report</field>-->
|
||||||
|
<!-- <field name="paperformat_id" ref="sf_manufacturing.sf_tray1"/>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
<!-- <!– 产品信息打印模板–>-->
|
||||||
|
<!-- <template id="sf_tray_template1">-->
|
||||||
|
<!-- <t t-call="web.html_container">-->
|
||||||
|
<!-- <t t-call="web.external_layout">-->
|
||||||
|
<!-- <t t-foreach="docs" t-as="o">-->
|
||||||
|
<!-- <div class="page">-->
|
||||||
|
<!-- <div t-field="o.production_id.name"-->
|
||||||
|
<!-- t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>-->
|
||||||
|
<!-- <div t-field="o.production_id" style="text-align: center"/>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </t>-->
|
||||||
|
<!-- </t>-->
|
||||||
|
<!-- </t>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
@@ -22,6 +22,10 @@
|
|||||||
<field name="pickupBeginTime"/>
|
<field name="pickupBeginTime"/>
|
||||||
<field name="bill"/>
|
<field name="bill"/>
|
||||||
|
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//group//field[@name='group_id']" position="after">
|
||||||
|
<field name="bill_show" widget="pdf_viewer"/>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//group[@name='other_infos']" position="after">
|
<xpath expr="//group[@name='other_infos']" position="after">
|
||||||
<!-- <group>-->
|
<!-- <group>-->
|
||||||
|
|||||||
Reference in New Issue
Block a user