add barcode_generator_partner from OCA/stock-logistics-barcode/pull/536

This commit is contained in:
Luis 2025-03-03 10:16:19 +01:00
parent 8d39b937a8
commit 7c8d1e4342
27 changed files with 1581 additions and 16 deletions

View file

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_barcodes_generator_partner

View file

@ -0,0 +1,33 @@
# Copyright (C) 2016-Today GRAP (http://www.grap.coop)
# Copyright (C) 2016-Today La Louve (http://www.lalouve.net)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class Tests(TransactionCase):
"""Tests for 'Barcodes Generate"""
def setUp(self):
super().setUp()
self.partner_obj = self.env["res.partner"]
# Test Section
def test_01_sequence_generation_partner(self):
self.partner = self.partner_obj.browse(
self.ref("barcodes_generator_partner.res_partner_barcode")
)
self.partner.generate_barcode()
self.assertEqual(
self.partner.barcode_base,
1,
"Incorrect base Generation (by sequence) for Partner.",
)
self.assertEqual(
self.partner.barcode,
"0420000000013",
"Barcode Generation (by sequence) for Partner."
"Incorrect EAN13 Generated. Pattern : %s - Base : %s"
% (self.partner.barcode_rule_id.pattern, self.partner.barcode_base),
)