From e297a3ad47672633b1ddcd6c00a121bee8a05d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Mar 2024 10:41:23 +0100 Subject: [PATCH] Support generate barcode of different type --- modules/product/CHANGELOG | 1 + modules/product/product.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/product/CHANGELOG b/modules/product/CHANGELOG index 4d8eb49430..9439eaada3 100644 --- a/modules/product/CHANGELOG +++ b/modules/product/CHANGELOG @@ -1,3 +1,4 @@ +* Support generate barcode of different type * Add code on product category * Add product deactivable mixins diff --git a/modules/product/product.py b/modules/product/product.py index e0a36915a0..84e8fcc66c 100644 --- a/modules/product/product.py +++ b/modules/product/product.py @@ -860,7 +860,9 @@ class ProductIdentifier(sequence_ordered(), ModelSQL, ModelView): code=self.code, product=product)) - def barcode(self, format='svg', **options): - if barcode and self.type in barcode.BARCODES: + def barcode(self, format='svg', type=None, **options): + if type is None: + type = self.type + if barcode and type in barcode.BARCODES: generator = getattr(barcode, 'generate_%s' % format) - return generator(self.type, self.on_change_with_code(), **options) + return generator(type, self.on_change_with_code(), **options)