调整打印代码结构
This commit is contained in:
@@ -7,9 +7,6 @@ class MaintenancePrinting(models.Model):
|
||||
|
||||
print('self.name========== %s' % self.name)
|
||||
self.ensure_one()
|
||||
qr_code_data = self.qr_code_image
|
||||
if not qr_code_data:
|
||||
raise UserError("没有找到二维码数据。")
|
||||
# maintenance_equipment_id = self.id
|
||||
# # host = "192.168.50.110" # 可以根据实际情况修改
|
||||
# # port = 9100 # 可以根据实际情况修改
|
||||
@@ -23,9 +20,9 @@ class MaintenancePrinting(models.Model):
|
||||
# self.print_qr_code(maintenance_equipment_id, host, port)
|
||||
|
||||
# 切换成A4打印机
|
||||
printer = self.env['printing.printer'].get_default()
|
||||
|
||||
try:
|
||||
printer.print_document(report=None, content = qr_code_data)
|
||||
self.env['jikimo.printing'].print_qr_code(self.id)
|
||||
except Exception as e:
|
||||
raise UserError(f"打印失败: {str(e)}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user