[IMP] print_zpl2 : quick move

This commit is contained in:
Florent de Labarre
2020-03-05 20:41:33 +01:00
committed by mreficent
parent 7c10f698ba
commit be18cfda93
10 changed files with 327 additions and 135 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" ?>
<!--
Copyright 2016 SUBTENO-IT
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -8,8 +8,8 @@
<field name="model">printing.label.zpl2</field>
<field name="arch" type="xml">
<tree string="ZPL II Label">
<field name="name"/>
<field name="model_id"/>
<field name="name" />
<field name="model_id" />
</tree>
</field>
</record>
@@ -18,7 +18,7 @@
<field name="arch" type="xml">
<form string="ZPL II Label">
<header>
<button name="import_zpl2" string="Import ZPL2" type="object"/>
<button name="import_zpl2" string="Import ZPL2" type="object" />
</header>
<sheet>
<widget
@@ -29,117 +29,227 @@
/>
<div class="oe_button_box" name="button_box">
<field name="active" invisible="1"/>
<field name="action_window_id" invisible="1"/>
<button name="create_action" string="Add in the 'Action' menu" type="object" attrs="{'invisible':[('action_window_id','!=',False)]}" icon="fa-plus-square" help="Display an option on related documents." class="oe_stat_button"/>
<button name="unlink_action" string="Remove from the 'Action' menu" type="object" attrs="{'invisible':[('action_window_id','=',False)]}" icon="fa-minus-square" help="Remove the contextual action." class="oe_stat_button"/>
<field name="action_window_id" invisible="1" />
<button
name="create_action"
string="Add in the 'Action' menu"
type="object"
attrs="{'invisible':[('action_window_id','!=',False)]}"
icon="fa-plus-square"
help="Display an option on related documents."
class="oe_stat_button"
/>
<button
name="unlink_action"
string="Remove from the 'Action' menu"
type="object"
attrs="{'invisible':[('action_window_id','=',False)]}"
icon="fa-minus-square"
help="Remove the contextual action."
class="oe_stat_button"
/>
</div>
<group col="4">
<field name="name"/>
<field name="model_id"/>
<field name="description"/>
<field name="width"/>
<field name="origin_x"/>
<field name="origin_y"/>
<field name="data_type"/>
<field name="restore_saved_config"/>
<field name="name" />
<field name="model_id" />
<field name="description" />
<field name="width" />
<field name="origin_x" />
<field name="origin_y" />
<field name="data_type" />
<field name="restore_saved_config" />
</group>
<group attrs="{'invisible':[('test_print_mode', '=', False)]}">
<button name="print_test_label" string="Print Test" type="object" class="oe_highlight"/>
<button
name="print_test_label"
string="Print Test"
type="object"
class="oe_highlight"
/>
</group>
<notebook>
<page string="Components">
<field name="component_ids" nolabel="1" colspan="4">
<tree string="Label Component">
<field name="sequence"/>
<field name="name"/>
<field name="component_type"/>
<field name="origin_x"/>
<field name="origin_y"/>
<field name="sequence" />
<field name="name" />
<field name="component_type" />
<field name="origin_x" />
<button
name="action_minus_origin_x"
type="object"
string="-"
icon="fa-minus-square"
/>
<button
name="action_plus_origin_x"
type="object"
string="+"
icon="fa-plus-square"
/>
<field name="origin_y" />
<button
name="action_minus_origin_y"
type="object"
string="-"
icon="fa-minus-square"
/>
<button
name="action_plus_origin_y"
type="object"
string="+"
icon="fa-plus-square"
/>
</tree>
<form string="Label Component">
<group>
<group>
<field name="name"/>
<field name="sequence"/>
<field name="name" />
<field name="sequence" />
</group>
<group>
<field name="component_type"/>
<field name="repeat" attrs="{'invisible': [('component_type', '=', 'zpl2_raw')]}"/>
<field name="component_type" />
<field
name="repeat"
attrs="{'invisible': [('component_type', '=', 'zpl2_raw')]}"
/>
</group>
<group attrs="{'invisible': [('component_type', '=', 'zpl2_raw')]}">
<field name="origin_x"/>
<field name="origin_y"/>
<group
attrs="{'invisible': [('component_type', '=', 'zpl2_raw')]}"
>
<field name="origin_x" />
<field name="origin_y" />
</group>
<group>
<field name="graphic_image" attrs="{'invisible': [('component_type', '!=', 'graphic')]}"/>
<field name="sublabel_id" attrs="{'invisible': [('component_type', '!=', 'sublabel')]}"/>
<field
name="graphic_image"
attrs="{'invisible': [('component_type', '!=', 'graphic')]}"
/>
<field
name="sublabel_id"
attrs="{'invisible': [('component_type', '!=', 'sublabel')]}"
/>
</group>
</group>
<group attrs="{'invisible': [('component_type', 'in', ('rectangle', 'diagonal', 'circle'))]}" string="Data">
<field name="data" widget="ace" options="{'mode': 'python'}" nolabel="1"/>
<group
attrs="{'invisible': [('component_type', 'in', ('rectangle', 'diagonal', 'circle'))]}"
string="Data"
>
<field
name="data"
widget="ace"
options="{'mode': 'python'}"
nolabel="1"
/>
</group>
<notebook colspan="4">
<page string="Format" attrs="{'invisible': [('component_type', 'in', ('sublabel', 'qr_code', 'zpl2_raw'))]}">
<page
string="Format"
attrs="{'invisible': [('component_type', 'in', ('sublabel', 'qr_code', 'zpl2_raw'))]}"
>
<group>
<field name="height"/>
<field name="only_product_barcode"/>
<field name="width" attrs="{'invisible': [('component_type', 'not in', ('text', 'rectangle', 'diagonal', 'circle', 'graphic'))]}"/>
<field name="reverse_print"/>
<field name="orientation" attrs="{'invisible': [('component_type', 'in', ('rectangle', 'diagonal', 'circle'))]}"/>
<field name="font" attrs="{'invisible': [('component_type', '!=', 'text')]}"/>
<field name="in_block" attrs="{'invisible': [('component_type', '!=', 'text')]}"/>
<field name="thickness" attrs="{'invisible': [('component_type', 'not in', ('rectangle', 'diagonal', 'circle'))]}"/>
<field name="color" attrs="{'invisible': [('component_type', 'not in', ('rectangle', 'diagonal', 'circle'))]}"/>
<field name="diagonal_orientation" attrs="{'invisible': [('component_type', '!=', 'diagonal')], 'required': [('component_type', '=', 'diagonal')]}"/>
<field name="height" />
<field name="only_product_barcode" />
<field
name="width"
attrs="{'invisible': [('component_type', 'not in', ('text', 'rectangle', 'diagonal', 'circle', 'graphic'))]}"
/>
<field name="reverse_print" />
<field
name="orientation"
attrs="{'invisible': [('component_type', 'in', ('rectangle', 'diagonal', 'circle'))]}"
/>
<field
name="font"
attrs="{'invisible': [('component_type', '!=', 'text')]}"
/>
<field
name="in_block"
attrs="{'invisible': [('component_type', '!=', 'text')]}"
/>
<field
name="thickness"
attrs="{'invisible': [('component_type', 'not in', ('rectangle', 'diagonal', 'circle'))]}"
/>
<field
name="color"
attrs="{'invisible': [('component_type', 'not in', ('rectangle', 'diagonal', 'circle'))]}"
/>
<field
name="diagonal_orientation"
attrs="{'invisible': [('component_type', '!=', 'diagonal')], 'required': [('component_type', '=', 'diagonal')]}"
/>
</group>
</page>
<!-- Barcode specific arguments -->
<page string="Barcode Format" attrs="{'invisible': [('component_type', 'in', ('text', 'rectangle', 'diagonal', 'circle', 'sublabel', 'graphic', 'qr_code', 'zpl2_raw'))]}">
<page
string="Barcode Format"
attrs="{'invisible': [('component_type', 'in', ('text', 'rectangle', 'diagonal', 'circle', 'sublabel', 'graphic', 'qr_code', 'zpl2_raw'))]}"
>
<group>
<field name="check_digits"/>
<field name="interpretation_line"/>
<field name="interpretation_line_above"/>
<field name="module_width"/>
<field name="bar_width_ratio"/>
<field name="security_level"/>
<field name="columns_count"/>
<field name="rows_count"/>
<field name="truncate"/>
<field name="check_digits" />
<field name="interpretation_line" />
<field
name="interpretation_line_above"
/>
<field name="module_width" />
<field name="bar_width_ratio" />
<field name="security_level" />
<field name="columns_count" />
<field name="rows_count" />
<field name="truncate" />
</group>
</page>
<!-- 2D Barcode arguments -->
<page string="2D Barcode Arguments" attrs="{'invisible': [('component_type', '!=', 'qr_code')]}">
<page
string="2D Barcode Arguments"
attrs="{'invisible': [('component_type', '!=', 'qr_code')]}"
>
<group>
<field name="model"/>
<field name="magnification_factor"/>
<field name="error_correction"/>
<field name="mask_value"/>
<field name="model" />
<field name="magnification_factor" />
<field name="error_correction" />
<field name="mask_value" />
</group>
</page>
<!-- Text block specific arguments -->
<page string="Text Block Format" attrs="{'invisible': ['|', ('component_type', '!=', 'text'), ('in_block', '=', False)]}">
<page
string="Text Block Format"
attrs="{'invisible': ['|', ('component_type', '!=', 'text'), ('in_block', '=', False)]}"
>
<group>
<field name="block_width"/>
<field name="block_lines"/>
<field name="block_spaces"/>
<field name="block_justify"/>
<field name="block_left_margin"/>
<field name="block_width" />
<field name="block_lines" />
<field name="block_spaces" />
<field name="block_justify" />
<field name="block_left_margin" />
</group>
</page>
<!-- Repeat specific arguments -->
<page string="Repeat" attrs="{'invisible': [('repeat', '=', False)]}">
<page
string="Repeat"
attrs="{'invisible': [('repeat', '=', False)]}"
>
<group>
<field name="repeat_offset"/>
<field name="repeat_count"/>
<field name="repeat_offset_x"/>
<field name="repeat_offset_y"/>
<field name="repeat_offset" />
<field name="repeat_count" />
<field name="repeat_offset_x" />
<field name="repeat_offset_y" />
</group>
</page>
</notebook>
</form>
</field>
<group string="Emulation" attrs="{'invisible':[('test_labelary_mode', '=', False)]}">
<field name="labelary_image" widget="image" nolabel="1" force_save="1"/>
<group
string="Emulation"
attrs="{'invisible':[('test_labelary_mode', '=', False)]}"
>
<field
name="labelary_image"
widget="image"
nolabel="1"
force_save="1"
/>
<p class="oe_grey" colspan="4">
Note : It is an emulation from http://labelary.com/, the result on printer can be different.
</p>
@@ -148,21 +258,42 @@
<page string="Test Mode">
<group>
<group>
<field name="test_print_mode"/>
<field name="test_labelary_mode"/>
<field name="test_print_mode" />
<field name="test_labelary_mode" />
</group>
</group>
<group>
<group>
<field name="record_id" attrs="{'invisible':[('test_print_mode', '=', False), ('test_labelary_mode', '=', False)], 'required':['|', ('test_print_mode', '=', True), ('test_labelary_mode', '=', True)]}"/>
<field name="printer_id" attrs="{'invisible':[('test_print_mode', '=', False)], 'required':[('test_print_mode', '=', True)]}"/>
<field name="labelary_dpmm" attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"/>
<field name="labelary_width" attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"/>
<field name="labelary_height" attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"/>
<field
name="record_id"
attrs="{'invisible':[('test_print_mode', '=', False), ('test_labelary_mode', '=', False)], 'required':['|', ('test_print_mode', '=', True), ('test_labelary_mode', '=', True)]}"
/>
<field
name="printer_id"
attrs="{'invisible':[('test_print_mode', '=', False)], 'required':[('test_print_mode', '=', True)]}"
/>
<field
name="labelary_dpmm"
attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"
/>
<field
name="labelary_width"
attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"
/>
<field
name="labelary_height"
attrs="{'invisible':[('test_labelary_mode', '=', False)], 'required':[('test_labelary_mode', '=', True)]}"
/>
</group>
</group>
<group string="Extra">
<field name="extra" nolabel="1" widget="ace" options="{'mode': 'python'}" attrs="{'invisible':[('test_print_mode', '=', False), ('test_labelary_mode', '=', False)]}"/>
<field
name="extra"
nolabel="1"
widget="ace"
options="{'mode': 'python'}"
attrs="{'invisible':[('test_print_mode', '=', False), ('test_labelary_mode', '=', False)]}"
/>
</group>
</page>
</notebook>
@@ -174,9 +305,13 @@
<field name="model">printing.label.zpl2</field>
<field name="arch" type="xml">
<search string="ZPL II Label">
<field name="name"/>
<field name="model_id"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<field name="name" />
<field name="model_id" />
<filter
string="Archived"
name="inactive"
domain="[('active','=',False)]"
/>
</search>
</field>
</record>
@@ -185,21 +320,32 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">printing.label.zpl2</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_printing_label_zpl2_search"/>
<field name="search_view_id" ref="view_printing_label_zpl2_search" />
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
<record model="ir.actions.act_window.view" id="act_open_printing_label_zpl2_view_form">
<field name="act_window_id" ref="act_open_printing_label_zpl2_view"/>
<field name="sequence" eval="20"/>
<record
model="ir.actions.act_window.view"
id="act_open_printing_label_zpl2_view_form"
>
<field name="act_window_id" ref="act_open_printing_label_zpl2_view" />
<field name="sequence" eval="20" />
<field name="view_mode">form</field>
<field name="view_id" ref="view_printing_label_zpl2_form"/>
<field name="view_id" ref="view_printing_label_zpl2_form" />
</record>
<record model="ir.actions.act_window.view" id="act_open_printing_label_zpl2_view_tree">
<field name="act_window_id" ref="act_open_printing_label_zpl2_view"/>
<field name="sequence" eval="10"/>
<record
model="ir.actions.act_window.view"
id="act_open_printing_label_zpl2_view_tree"
>
<field name="act_window_id" ref="act_open_printing_label_zpl2_view" />
<field name="sequence" eval="10" />
<field name="view_mode">tree</field>
<field name="view_id" ref="view_printing_label_zpl2_tree"/>
<field name="view_id" ref="view_printing_label_zpl2_tree" />
</record>
<menuitem id="menu_printing_label_zpl2" parent="base_report_to_printer.printing_menu" sequence="20" action="act_open_printing_label_zpl2_view"/>
<menuitem
id="menu_printing_label_zpl2"
parent="base_report_to_printer.printing_menu"
sequence="20"
action="act_open_printing_label_zpl2_view"
/>
</odoo>