diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-05-27 10:19:09 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-05-27 10:19:09 +0700 |
| commit | f0f414383b3bd34e6fce12e68e171014c08d2a55 (patch) | |
| tree | f9eef4c1331f6507fadc680bdd801656ff9f8ea7 /indoteknik_api/models | |
| parent | 431229f2a6f1203fbdfe470229e55da8ebd3ea01 (diff) | |
| parent | d3f530b94569059106164172485aaa9665e80709 (diff) | |
Merge branch 'odoo-backup' into CR/repeat-order
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/product_pricelist.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py index 6e88517c..e0debf38 100644 --- a/indoteknik_api/models/product_pricelist.py +++ b/indoteknik_api/models/product_pricelist.py @@ -95,18 +95,24 @@ class ProductPricelist(models.Model): ], limit=1, order='start_date asc') return pricelist - def get_is_show_program_flash_sale(self): + def get_is_show_program_flash_sale(self, is_show_program): """ Check whether have active flash sale in range of date @return: returns pricelist: object """ + + if is_show_program == 'true': + is_show_program = True + else: + is_show_program = False + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') pricelist = self.search([ ('is_flash_sale', '=', True), - ('is_show_program', '=', True), + ('is_show_program', '=', is_show_program), ('start_date', '<=', current_time), ('end_date', '>=', current_time) - ], order='start_date asc') + ], order='number asc') return pricelist def is_flash_sale_product(self, product_id: int): |
