summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-28 13:47:19 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-28 13:47:19 +0700
commit9a293f7f718e5536dfaf57926657ad1d6dd5c581 (patch)
treeac03e44ed60c64aa4f74f63b175180a4c9b09702
parent508147aa709a936acbb7a7d0d988660ea553d58c (diff)
add field for top banner in flash sale
-rw-r--r--indoteknik_api/controllers/api_v1/flash_sale.py1
-rw-r--r--indoteknik_custom/models/product_pricelist.py1
-rw-r--r--indoteknik_custom/views/product_pricelist.xml3
3 files changed, 5 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v1/flash_sale.py b/indoteknik_api/controllers/api_v1/flash_sale.py
index a0aaa44e..dc7c3928 100644
--- a/indoteknik_api/controllers/api_v1/flash_sale.py
+++ b/indoteknik_api/controllers/api_v1/flash_sale.py
@@ -27,6 +27,7 @@ class FlashSale(controller.Controller):
'name': pricelist.name,
'banner': request.env['ir.attachment'].api_image('product.pricelist', 'banner', pricelist.id),
'banner_mobile': request.env['ir.attachment'].api_image('product.pricelist', 'banner_mobile', pricelist.id),
+ 'banner_top': request.env['ir.attachment'].api_image('product.pricelist', 'banner_top', pricelist.id),
'duration': round((pricelist.end_date - datetime.now()).total_seconds()),
'product_total': request.env['product.pricelist.item'].search_count(query),
})
diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py
index a309945d..2edaeb80 100644
--- a/indoteknik_custom/models/product_pricelist.py
+++ b/indoteknik_custom/models/product_pricelist.py
@@ -14,6 +14,7 @@ class ProductPricelist(models.Model):
('all', 'For All User'),
('registered_user', 'Only for Registered User')
], string='Flashsale Option')
+ banner_top = fields.Binary(string='Banner Top')
class ProductPricelistItem(models.Model):
diff --git a/indoteknik_custom/views/product_pricelist.xml b/indoteknik_custom/views/product_pricelist.xml
index 4cf06e18..0ad9e200 100644
--- a/indoteknik_custom/views/product_pricelist.xml
+++ b/indoteknik_custom/views/product_pricelist.xml
@@ -17,6 +17,9 @@
<field name="banner_mobile" widget="image" attrs="{
'invisible': [('is_flash_sale', '=', False)]
}" />
+ <field name="banner_top" widget="image" attrs="{
+ 'invisible': [('is_flash_sale', '=', False)]
+ }" />
<field name="start_date" attrs="{
'invisible': [('is_flash_sale', '=', False)],
'required': [('is_flash_sale', '=', True)]