From f67c1fb71908c6061bd60be954efb293441d964f Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 17 Feb 2023 15:17:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=A9=E6=B5=81=E9=9D=A2?= =?UTF-8?q?=E5=8D=95=E6=89=93=E5=8D=B0=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/__manifest__.py | 1 + sf_bf_connect/models/jd_eclp.py | 3 + sf_bf_connect/report/bill_report.xml | 84 ++++++++++++++++++++++++++++ sf_bf_connect/views/view.xml | 4 ++ 4 files changed, 92 insertions(+) create mode 100644 sf_bf_connect/report/bill_report.xml diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py index 6b893476..bcec62fa 100644 --- a/sf_bf_connect/__manifest__.py +++ b/sf_bf_connect/__manifest__.py @@ -14,6 +14,7 @@ 'data': [ 'views/res_partner_view.xml', 'views/view.xml', + 'report/bill_report.xml', ], 'demo': [ ], diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py index 5c775a9b..4733f2a6 100644 --- a/sf_bf_connect/models/jd_eclp.py +++ b/sf_bf_connect/models/jd_eclp.py @@ -30,6 +30,8 @@ class JdEclp(models.Model): # bill = fields.Char(string='物流面单') 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') def query_bill_pdf(self): @@ -109,6 +111,7 @@ class JdEclp(models.Model): bill_url = 'http:' + bill_url_str data = base64.b64encode(requests.get(bill_url).content) # self.bill = '' + self.bill_show = data _logger.info('调用成功2') attachment = self.env['ir.attachment'].sudo().create({ 'datas': data, diff --git a/sf_bf_connect/report/bill_report.xml b/sf_bf_connect/report/bill_report.xml new file mode 100644 index 00000000..6b7ce2dc --- /dev/null +++ b/sf_bf_connect/report/bill_report.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + 面单打印 + stock.picking + qweb-pdf + sf_bf_connect.bill_report_template + (object.carrier_tracking_ref) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml index 43d5ad3d..2aec5078 100644 --- a/sf_bf_connect/views/view.xml +++ b/sf_bf_connect/views/view.xml @@ -22,6 +22,10 @@ + + + +