增加物流面单打印报告

This commit is contained in:
mgw
2023-02-17 15:17:22 +08:00
parent 3423622a77
commit f67c1fb719
4 changed files with 92 additions and 0 deletions

View File

@@ -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,