Support generate barcode of different type

This commit is contained in:
Cédric Krier
2024-03-05 10:41:23 +01:00
parent 1415713e6b
commit e297a3ad47
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -1,3 +1,4 @@
* Support generate barcode of different type
* Add code on product category
* Add product deactivable mixins
+5 -3
View File
@@ -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)