diff options
| -rw-r--r-- | indoteknik_custom/models/voucher.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py index c97e54fa..e1497d9a 100644 --- a/indoteknik_custom/models/voucher.py +++ b/indoteknik_custom/models/voucher.py @@ -42,6 +42,8 @@ class Voucher(models.Model): def format(self): ir_attachment = self.env['ir.attachment'] + discount_type = self.discount_type + max_discount_amount = self.max_discount_amount if discount_type == 'percentage' else 0 data = { 'id': self.id, 'image': ir_attachment.api_image('voucher', 'image', self.id), @@ -49,9 +51,10 @@ class Voucher(models.Model): 'code': self.code, 'description': self.description, 'discount_amount': self.discount_amount, - 'discount_type': self.discount_type, + 'discount_type': discount_type, 'remaining_time': self.end_time.strftime('%d-%m-%Y'), - 'min_purchase_amount': self.min_purchase_amount + 'min_purchase_amount': self.min_purchase_amount, + 'max_discount_amount': max_discount_amount, } return data |
