[IMP] print_zpl2 : quick move

This commit is contained in:
Florent de Labarre
2020-03-05 20:41:33 +01:00
committed by Lois Rilo
parent 6bb38387f7
commit f920445f6a
8 changed files with 320 additions and 135 deletions

View File

@@ -70,7 +70,8 @@ class PrintingLabelZpl2(models.Model):
record_id = fields.Integer(string="Record ID", default=1) record_id = fields.Integer(string="Record ID", default=1)
extra = fields.Text(string="Extra", default="{}") extra = fields.Text(string="Extra", default="{}")
printer_id = fields.Many2one(comodel_name="printing.printer", string="Printer") printer_id = fields.Many2one(comodel_name="printing.printer", string="Printer")
labelary_image = fields.Binary(string="Image from Labelary", readonly=True) labelary_image = fields.Binary(string='Image from Labelary',
compute='_compute_labelary_image')
labelary_dpmm = fields.Selection( labelary_dpmm = fields.Selection(
selection=[ selection=[
("6dpmm", "6dpmm (152 pdi)"), ("6dpmm", "6dpmm (152 pdi)"),
@@ -407,16 +408,14 @@ class PrintingLabelZpl2(models.Model):
if record: if record:
label.print_label(label.printer_id, record, **extra) label.print_label(label.printer_id, record, **extra)
@api.onchange( @api.depends(
"record_id", 'record_id', 'labelary_dpmm', 'labelary_width', 'labelary_height',
"labelary_dpmm", 'component_ids', 'origin_x', 'origin_y', 'test_labelary_mode')
"labelary_width", def _compute_labelary_image(self):
"labelary_height", for label in self:
"component_ids", label.labelary_image = label._generate_labelary_image()
"origin_x",
"origin_y", def _generate_labelary_image(self):
)
def _on_change_labelary(self):
self.ensure_one() self.ensure_one()
if not ( if not (
self.test_labelary_mode self.test_labelary_mode
@@ -426,7 +425,7 @@ class PrintingLabelZpl2(models.Model):
and self.labelary_dpmm and self.labelary_dpmm
and self.component_ids and self.component_ids
): ):
return return False
record = self._get_record() record = self._get_record()
if record: if record:
# If case there an error (in the data field with the safe_eval # If case there an error (in the data field with the safe_eval
@@ -454,15 +453,12 @@ class PrintingLabelZpl2(models.Model):
new_im.paste(im, (1, 1)) new_im.paste(im, (1, 1))
imgByteArr = io.BytesIO() imgByteArr = io.BytesIO()
new_im.save(imgByteArr, format="PNG") new_im.save(imgByteArr, format="PNG")
self.labelary_image = base64.b64encode(imgByteArr.getvalue()) return base64.b64encode(imgByteArr.getvalue())
else: else:
return { _logger.warning(
"warning": { _(
"title": _("Error with Labelary API."), "Error with Labelary API. %s") % response.status_code)
"message": response.status_code,
}
}
except Exception as e: except Exception as e:
self.labelary_image = False _logger.warning(_("Error with Labelary API. %s") % e)
return {"warning": {"title": _("Some thing is wrong."), "message": e}} return False

View File

@@ -232,3 +232,19 @@ class PrintingLabelZpl2Component(models.Model):
help="This field holds a static image to print. " help="This field holds a static image to print. "
"If not set, the data field is evaluated.", "If not set, the data field is evaluated.",
) )
def action_plus_origin_x(self):
self.ensure_one()
self.origin_x += 10
def action_minus_origin_x(self):
self.ensure_one()
self.origin_x -= 10
def action_plus_origin_y(self):
self.ensure_one()
self.origin_y += 10
def action_minus_origin_y(self):
self.ensure_one()
self.origin_y -= 10

View File

@@ -67,10 +67,10 @@ class TestPrintingLabelZpl2(TransactionCase):
def test_print_empty_label(self, cups): def test_print_empty_label(self, cups):
""" Check that printing an empty label works """ """ Check that printing an empty label works """
label = self.new_label() label = self.new_label()
file_name = 'test.zpl' file_name = "test.zpl"
label.print_label(self.printer, self.printer) label.print_label(self.printer, self.printer)
cups.Connection().printFile.assert_called_once_with( cups.Connection().printFile.assert_called_once_with(
printer.system_name, file_name, file_name, options={} self.printer.system_name, file_name, file_name, options={}
) )
def test_empty_label_contents(self): def test_empty_label_contents(self):
@@ -1170,3 +1170,24 @@ class TestPrintingLabelZpl2(TransactionCase):
self.assertEqual( self.assertEqual(
contents, "^XA\n" "^PW480\n" "^CI28\n" "^LH10,10\n" "^JUR\n" "^XZ" contents, "^XA\n" "^PW480\n" "^CI28\n" "^LH10,10\n" "^JUR\n" "^XZ"
) )
def test_zpl2_component_quick_move(self):
""" Check component quick move """
label = self.new_label()
component = self.new_component(
{
"label_id": label.id,
"component_type": "zpl2_raw",
"data": '""',
"origin_x": 20,
"origin_y": 30,
}
)
component.action_plus_origin_x()
self.assertEqual(30, component.origin_x)
component.action_minus_origin_x()
self.assertEqual(20, component.origin_x)
component.action_plus_origin_y()
self.assertEqual(40, component.origin_y)
component.action_minus_origin_y()
self.assertEqual(30, component.origin_y)

View File

@@ -51,16 +51,15 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.label.test_print_mode = True self.label.test_print_mode = True
self.label.printer_id = self.printer self.label.printer_id = self.printer
self.label.record_id = 10 self.label.record_id = 10
file_name = 'test.zpl' file_name = "test.zpl"
self.label.print_test_label() self.label.print_test_label()
cups.Connection().printFile.assert_called_once_with( cups.Connection().printFile.assert_called_once_with(
self.printer.system_name, file_name, file_name, options={} self.printer.system_name, file_name, file_name, options={}
) )
def test_emulation_without_params(self): def test_emulation_without_params(self):
""" Check if not execute next if not in this mode """ """ Check if not execute next if not in this mode """
self.label.test_labelary_mode = False self.label.test_labelary_mode = False
self.label._on_change_labelary()
self.assertIs(self.label.labelary_image, False) self.assertIs(self.label.labelary_image, False)
def test_emulation_with_bad_header(self): def test_emulation_with_bad_header(self):
@@ -72,7 +71,6 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.env["printing.label.zpl2.component"].create( self.env["printing.label.zpl2.component"].create(
{"name": "ZPL II Label", "label_id": self.label.id, "data": '"Test"'} {"name": "ZPL II Label", "label_id": self.label.id, "data": '"Test"'}
) )
self.label._on_change_labelary()
self.assertFalse(self.label.labelary_image) self.assertFalse(self.label.labelary_image)
def test_emulation_with_bad_data_compute(self): def test_emulation_with_bad_data_compute(self):
@@ -84,7 +82,6 @@ class TestWizardPrintRecordLabel(TransactionCase):
component = self.env["printing.label.zpl2.component"].create( component = self.env["printing.label.zpl2.component"].create(
{"name": "ZPL II Label", "label_id": self.label.id, "data": "wrong_data"} {"name": "ZPL II Label", "label_id": self.label.id, "data": "wrong_data"}
) )
self.label._on_change_labelary()
component.unlink() component.unlink()
self.assertIs(self.label.labelary_image, False) self.assertIs(self.label.labelary_image, False)
@@ -97,5 +94,4 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.env["printing.label.zpl2.component"].create( self.env["printing.label.zpl2.component"].create(
{"name": "ZPL II Label", "label_id": self.label.id, "data": '"good_data"'} {"name": "ZPL II Label", "label_id": self.label.id, "data": '"good_data"'}
) )
self.label._on_change_labelary()
self.assertTrue(self.label.labelary_image) self.assertTrue(self.label.labelary_image)

View File

@@ -48,9 +48,9 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.assertEqual(wizard.printer_id, self.printer) self.assertEqual(wizard.printer_id, self.printer)
self.assertEqual(wizard.label_id, self.label) self.assertEqual(wizard.label_id, self.label)
wizard.print_label() wizard.print_label()
file_name = 'test.zpl' file_name = "test.zpl"
cups.Connection().printFile.assert_called_once_with( cups.Connection().printFile.assert_called_once_with(
self.printer.system_name, file_name, file_name, options={} self.printer.system_name, file_name, file_name, options={}
) )
def test_wizard_multiple_printers_and_labels(self): def test_wizard_multiple_printers_and_labels(self):

View File

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

View File

@@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" ?>
<!-- <!--
Copyright 2016 SYLEAM Copyright 2016 SYLEAM
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -10,12 +10,17 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Print Label"> <form string="Print Label">
<group> <group>
<field name="printer_id"/> <field name="printer_id" />
<field name="label_id"/> <field name="label_id" />
</group> </group>
<footer> <footer>
<button type="special" special="cancel" string="Cancel"/> <button type="special" special="cancel" string="Cancel" />
<button string="Print label" type="object" name="print_label" class="oe_highlight"/> <button
string="Print label"
type="object"
name="print_label"
class="oe_highlight"
/>
</footer> </footer>
</form> </form>
</field> </field>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" ?>
<odoo> <odoo>
<record id="view_wizard_import_zpl2_form" model="ir.ui.view"> <record id="view_wizard_import_zpl2_form" model="ir.ui.view">
<field name="name">wizard.import.zpl2.form</field> <field name="name">wizard.import.zpl2.form</field>
@@ -7,16 +7,21 @@
<form string="Print Label"> <form string="Print Label">
<group> <group>
<group> <group>
<field name="label_id"/> <field name="label_id" />
<field name="delete_component"/> <field name="delete_component" />
</group> </group>
</group> </group>
<group string="ZPL2"> <group string="ZPL2">
<field name="data" widget="ace" nolabel="1"/> <field name="data" widget="ace" nolabel="1" />
</group> </group>
<footer> <footer>
<button string="Cancel" class="btn-default" special="cancel"/> <button string="Cancel" class="btn-default" special="cancel" />
<button string="Import" type="object" name="import_zpl2" class="btn-primary"/> <button
string="Import"
type="object"
name="import_zpl2"
class="btn-primary"
/>
</footer> </footer>
</form> </form>
</field> </field>