diff --git a/account_asset_number/models/account_asset_profile.py b/account_asset_number/models/account_asset_profile.py index 730776a4b..a157ea46f 100644 --- a/account_asset_number/models/account_asset_profile.py +++ b/account_asset_number/models/account_asset_profile.py @@ -17,7 +17,28 @@ class AccountAssetProfile(models.Model): string="Asset Number Sequence", domain=lambda self: self._get_domain_sequence_id(), ) + barcode_type = fields.Selection( + selection=[("barcode", "Barcode"), ("qr", "QR")], + default="barcode", + ) + barcode_width = fields.Integer( + default=350, + help="Width (in px) of the barcode or the QR code", + ) + barcode_height = fields.Integer( + default=75, + help="Height (in px) of the barcode or the QR code", + ) @api.model def _get_domain_sequence_id(self): return [("company_id", "in", [False, self.env.company.id])] + + @api.onchange("barcode_type") + def _onchange_barcode_type(self): + # Set default values when type is changed + if self.barcode_type == "barcode": + self.barcode_width = 300 + self.barcode_height = 75 + elif self.barcode_type == "qr": + self.barcode_width = 150 diff --git a/account_asset_number/report/account_asset_number_report.xml b/account_asset_number/report/account_asset_number_report.xml index d60e34b45..8d177e8f9 100644 --- a/account_asset_number/report/account_asset_number_report.xml +++ b/account_asset_number/report/account_asset_number_report.xml @@ -10,26 +10,36 @@