diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-10 15:00:17 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-10 15:00:17 +0700 |
| commit | 8ae3fbf012539d286a5de3deb3d7c500920c2257 (patch) | |
| tree | 30d7e71a960e9aa343becbbde598d93d091d986c /indoteknik_custom/models | |
| parent | 68c2e896a684e1dc68b4f01da38a444fe76bceac (diff) | |
Update voucher api response
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/voucher.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
