打印配置初步优化并测试成功,自测流程成功
This commit is contained in:
12
sf_base/commons/Printer.py
Normal file
12
sf_base/commons/Printer.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class PrinterConfiguration(models.Model):
|
||||
_name = 'printer.configuration'
|
||||
_description = 'Printer Configuration'
|
||||
|
||||
name = fields.Char(string='名称', required=True)
|
||||
ip_address = fields.Char(string='IP 地址', required=True)
|
||||
port = fields.Integer(string='端口', default=9100)
|
||||
model = fields.Many2one('ir.model', string='模型名称')
|
||||
# 其他相关字段...
|
||||
@@ -1 +1,2 @@
|
||||
from . import common
|
||||
from . import Printer
|
||||
|
||||
@@ -54,7 +54,7 @@ class PrintingUtils(models.AbstractModel):
|
||||
# 假设{code}文本需要位于资产编号和二维码下方,中间位置
|
||||
# 设置{code}文本位置并启用自动换行
|
||||
zpl_code += "^FO300,120\n" # {code}文本的起始位置
|
||||
zpl_code += "^FB500,4,0,L,0\n" # 定义一个宽度为500点的文本框,最多4行,左对齐
|
||||
zpl_code += "^FB400,4,0,L,0\n" # 定义一个宽度为500点的文本框,最多4行,左对齐
|
||||
zpl_code += f"^A1N,40,40^FD{code}^FS\n"
|
||||
|
||||
# 在{code}文本框周围绘制线框
|
||||
|
||||
Reference in New Issue
Block a user