From 8ae3fbf012539d286a5de3deb3d7c500920c2257 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 10 Jul 2023 15:00:17 +0700 Subject: Update voucher api response --- indoteknik_custom/models/voucher.py | 5 ++++- indoteknik_custom/views/voucher.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py index 4ca13bd3..c97e54fa 100644 --- a/indoteknik_custom/models/voucher.py +++ b/indoteknik_custom/models/voucher.py @@ -41,13 +41,16 @@ class Voucher(models.Model): return datas def format(self): + ir_attachment = self.env['ir.attachment'] data = { + 'id': self.id, + 'image': ir_attachment.api_image('voucher', 'image', self.id), 'name': self.name, 'code': self.code, 'description': self.description, 'discount_amount': self.discount_amount, 'discount_type': self.discount_type, - 'remaining_time': self._get_remaining_time(), + 'remaining_time': self.end_time.strftime('%d-%m-%Y'), 'min_purchase_amount': self.min_purchase_amount } return data diff --git a/indoteknik_custom/views/voucher.xml b/indoteknik_custom/views/voucher.xml index 32c15588..cd42586e 100755 --- a/indoteknik_custom/views/voucher.xml +++ b/indoteknik_custom/views/voucher.xml @@ -36,6 +36,7 @@ + -- cgit v1.2.3