[FIX] base: barcode fallback
- Set a product barcode to a 8 letters value, e.g. 'AAAAAAAA' - Print 'Product Barcode (PDF)' (or any other report containing the barcode) The barcode doesn't print. All templates assume that: - a 13 characters barcode is EAN13 - a 8 characters barcode is EAN8 But this assumption is too restrictive: one could want to generate barcodes with such length without following the EAN13 or EAN8 structure. We fall back on Code128 when the barcode generation fails. opw-1937858 closes odoo/odoo#30912
This commit is contained in:
@@ -467,7 +467,10 @@ class IrActionsReport(models.Model):
|
||||
)
|
||||
return barcode.asString('png')
|
||||
except (ValueError, AttributeError):
|
||||
raise ValueError("Cannot convert into barcode.")
|
||||
if barcode_type == 'Code128':
|
||||
raise ValueError("Cannot convert into barcode.")
|
||||
else:
|
||||
return self.barcode('Code128', value, width=width, height=height, humanreadable=humanreadable)
|
||||
|
||||
@api.multi
|
||||
def render_template(self, template, values=None):
|
||||
|
||||
Reference in New Issue
Block a user