打印配置初步优化并测试成功,自测流程成功
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
'views/tool_menu.xml',
|
||||
'views/menu_fixture_view.xml',
|
||||
'views/change_base_view.xml',
|
||||
'views/Printer.xml',
|
||||
|
||||
],
|
||||
'demo': [
|
||||
|
||||
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}文本框周围绘制线框
|
||||
|
||||
@@ -188,3 +188,6 @@ access_sf_machine_brand_tags_group_sale_director,sf_machine_brand_tags_group_sal
|
||||
access_sf_machine_brand_tags_group_plan_director,sf_machine_brand_tags_group_plan_director,model_sf_machine_brand_tags,sf_base.group_plan_director,1,0,0,0
|
||||
access_sf_machine_brand_tags_group_purchase,sf_machine_brand_tags_group_purchase,model_sf_machine_brand_tags,sf_base.group_purchase,1,0,0,0
|
||||
access_sf_machine_brand_tags_group_purchase_director,sf_machine_brand_tags_group_purchase_director,model_sf_machine_brand_tags,sf_base.group_purchase_director,1,0,0,0
|
||||
|
||||
|
||||
access_printer_configuration,printer.configuration,model_printer_configuration,base.group_user,1,1,1,1
|
||||
|
53
sf_base/views/Printer.xml
Normal file
53
sf_base/views/Printer.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_printer_configuration_tree" model="ir.ui.view">
|
||||
<field name="name">printer.configuration.tree</field>
|
||||
<field name="model">printer.configuration</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Printer Configuration">
|
||||
<field name="name"/>
|
||||
<field name="ip_address"/>
|
||||
<field name="port"/>
|
||||
<field name="model"/>
|
||||
<!-- 其他字段... -->
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_printer_configuration_form" model="ir.ui.view">
|
||||
<field name="name">printer.configuration.form</field>
|
||||
<field name="model">printer.configuration</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Printer Configuration">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="ip_address"/>
|
||||
<field name="port"/>
|
||||
<field name="model"/>
|
||||
<!-- 其他字段... -->
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 其他视图... -->
|
||||
|
||||
<!-- Action to open the printer configuration list -->
|
||||
<record id="action_printer_configuration" model="ir.actions.act_window">
|
||||
<field name="name">打印配置</field>
|
||||
<field name="res_model">printer.configuration</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<!-- Add a menu item for the printer configuration -->
|
||||
<record id="menu_printer_configuration" model="ir.ui.menu">
|
||||
<field name="name">打印配置</field>
|
||||
<field name="action" ref="action_printer_configuration"/>
|
||||
<field name="parent_id" ref="base.menu_administration"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user