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 | |
| parent | 68c2e896a684e1dc68b4f01da38a444fe76bceac (diff) | |
Update voucher api response
| -rw-r--r-- | indoteknik_custom/models/voucher.py | 5 | ||||
| -rwxr-xr-x | indoteknik_custom/views/voucher.xml | 1 |
2 files changed, 5 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 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 @@ <field name="start_time" required="1"/> <field name="end_time" required="1"/> </group> + <group></group> <group string="Discount Settings"> <field name="min_purchase_amount" widget="monetary" required="1" /> <field name="discount_type" required="1" /> |
