[15.0][MIG] printer_zpl2: Migration to 15.0

This commit is contained in:
duyanh
2022-10-28 12:52:47 +07:00
committed by Nils Hamerlinck
parent a6a30d8b50
commit cb480f87b5
11 changed files with 32 additions and 27 deletions

View File

@@ -14,14 +14,14 @@ Printer ZPL II
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github
:target: https://github.com/OCA/report-print-send/tree/14.0/printer_zpl2
:target: https://github.com/OCA/report-print-send/tree/15.0/printer_zpl2
:alt: OCA/report-print-send
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/report-print-send-14-0/report-print-send-14-0-printer_zpl2
:target: https://translation.odoo-community.org/projects/report-print-send-15-0/report-print-send-15-0-printer_zpl2
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/144/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/report-print-send&target_branch=15.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -97,7 +97,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/report-print-send/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/report-print-send/issues/new?body=module:%20printer_zpl2%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/report-print-send/issues/new?body=module:%20printer_zpl2%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -134,6 +134,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/report-print-send <https://github.com/OCA/report-print-send/tree/14.0/printer_zpl2>`_ project on GitHub.
This module is part of the `OCA/report-print-send <https://github.com/OCA/report-print-send/tree/15.0/printer_zpl2>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,9 +1,9 @@
# Copyright (C) 2016 SUBTENO-IT (<https://subteno-it.fr>)
# Copyright (C) 2016-2022 SUBTENO-IT (<https://subteno-it.fr>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Printer ZPL II",
"version": "14.0.2.0.0",
"version": "15.0.1.0.0",
"category": "Printer",
"summary": "Add a ZPL II label printing feature",
"author": "SUBTENO-IT, FLorent de Labarre, "

View File

@@ -1,5 +1,5 @@
# Copyright (C) 2016 SYLEAM (<http://www.syleam.fr>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import printing_label_zpl2_component
from . import printing_label_zpl2
from . import printing_label_zpl2_component

View File

@@ -69,7 +69,7 @@ class PrintingLabelZpl2(models.Model):
test_print_mode = fields.Boolean(string="Mode Print")
test_labelary_mode = fields.Boolean(string="Mode Labelary")
record_id = fields.Integer(string="Record ID", default=1)
extra = fields.Text(string="Extra", default="{}")
extra = fields.Text(default="{}")
printer_id = fields.Many2one(comodel_name="printing.printer", string="Printer")
labelary_image = fields.Binary(
string="Image from Labelary", compute="_compute_labelary_image"
@@ -123,10 +123,8 @@ class PrintingLabelZpl2(models.Model):
def _get_component_data(self, record, component, eval_args):
if component.data_autofill:
data = component.autofill_data(record, eval_args)
else:
data = component.data
return safe_eval(str(data), eval_args) or ""
return component.autofill_data(record, eval_args)
return safe_eval(str(component.data), eval_args) or ""
def _get_to_data_to_print(
self,

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Printer ZPL II</title>
<style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/report-print-send/tree/14.0/printer_zpl2"><img alt="OCA/report-print-send" src="https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/report-print-send-14-0/report-print-send-14-0-printer_zpl2"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/144/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/report-print-send/tree/15.0/printer_zpl2"><img alt="OCA/report-print-send" src="https://img.shields.io/badge/github-OCA%2Freport--print--send-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/report-print-send-15-0/report-print-send-15-0-printer_zpl2"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/report-print-send&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the <strong>Report to printer</strong> (<tt class="docutils literal">base_report_to_printer</tt>)
module to add a ZPL II label printing feature.</p>
<p>This module is meant to be used as a base for module development, and does not provide a GUI on its own.
@@ -446,7 +446,7 @@ change tests to reflect this</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/report-print-send/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/report-print-send/issues/new?body=module:%20printer_zpl2%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/report-print-send/issues/new?body=module:%20printer_zpl2%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -477,7 +477,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/report-print-send/tree/14.0/printer_zpl2">OCA/report-print-send</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/report-print-send/tree/15.0/printer_zpl2">OCA/report-print-send</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -1,7 +1,7 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from unittest.mock import patch
from odoo import exceptions
from odoo.tests.common import TransactionCase
@@ -56,7 +56,7 @@ class TestPrintingLabelZpl2(TransactionCase):
with self.assertRaises(exceptions.UserError):
label.print_label(self.printer, label)
@mock.patch("%s.cups" % model)
@patch("%s.cups" % model)
def test_print_empty_label(self, cups):
"""Check that printing an empty label works"""
label = self.new_label()

View File

@@ -1,6 +1,6 @@
# Copyright (C) 2018 Florent de Labarre (<https://github.com/fmdl>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from unittest.mock import patch
from odoo.tests.common import TransactionCase
@@ -45,7 +45,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
record = Obj.search([], limit=1, order="id desc")
self.assertEqual(res, record)
@mock.patch("%s.cups" % model)
@patch("%s.cups" % model)
def test_print_label_test(self, cups):
"""Check if print test"""
self.label.test_print_mode = True

View File

@@ -1,7 +1,7 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from unittest.mock import patch
from odoo.tests.common import TransactionCase
@@ -35,7 +35,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
}
)
@mock.patch("%s.cups" % model)
@patch("%s.cups" % model)
def test_print_record_label(self, cups):
"""Check that printing a label using the generic wizard works"""
wizard_obj = self.Model.with_context(

View File

@@ -7,7 +7,7 @@
<record id="view_printing_label_zpl2_tree" model="ir.ui.view">
<field name="model">printing.label.zpl2</field>
<field name="arch" type="xml">
<tree string="ZPL II Label">
<tree>
<field name="name" />
<field name="model_id" />
</tree>
@@ -74,7 +74,7 @@
colspan="4"
context="{'default_model_id': model_id}"
>
<tree string="Label Component">
<tree>
<field name="sequence" />
<field name="name" />
<field name="component_type" />

View File

@@ -0,0 +1 @@
../../../../printer_zpl2

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)