diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-11-01 09:48:23 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-11-01 09:48:23 +0700 |
| commit | d57c3cebb92a87686b14b794e9dd1a4e35e0e6cf (patch) | |
| tree | e899b39936cfee365ca41d9f6f9eab1a6712e7ae | |
| parent | 742213021f5e301518512c4f190b91df8182337a (diff) | |
| parent | b2ac5d8be2d426dd968cbc9244377ecf3040800b (diff) | |
Merge branch 'master'
| -rw-r--r-- | indoteknik_api/controllers/api_v1/category.py | 4 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/manufacture.py | 4 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/product.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 2 |
4 files changed, 11 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/category.py b/indoteknik_api/controllers/api_v1/category.py index 585e3eda..792b59b2 100644 --- a/indoteknik_api/controllers/api_v1/category.py +++ b/indoteknik_api/controllers/api_v1/category.py @@ -17,6 +17,10 @@ class Category(controller.Controller): active_flash_sale = request.env['product.pricelist'].get_active_flash_sale() if active_flash_sale: category_ids = [x.id for item in active_flash_sale.item_ids for x in item.product_id.public_categ_ids] + elif page == 'ready-stock': + product_templates = request.env['product.template'].search([('virtual_qty', '>', 0)]) + if product_templates: + category_ids = [x.id for product in product_templates for x in product.public_categ_ids] elif page == 'manufacture': manufacture_id = kw.get('manufacture_id') if not manufacture_id: diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index ba2e3be9..135a6e5d 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -17,6 +17,10 @@ class Manufacture(controller.Controller): active_flash_sale = request.env['product.pricelist'].get_active_flash_sale() if active_flash_sale: manufacture_ids = [x.product_id.x_manufacture.id for x in active_flash_sale.item_ids] + elif page == 'ready-stock': + product_templates = request.env['product.template'].search([('virtual_qty', '>', 0)]) + if product_templates: + manufacture_ids = [x.x_manufacture.id for x in product_templates] elif page == 'category': category_id = kw.get('category_id') if not category_id: diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index d8006873..15f75d98 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -84,7 +84,7 @@ class Product(controller.Controller): return self.response(data) - @http.route(prefix + 'product/<id>/similar', auth='public', methods=['GET']) + @http.route(prefix + 'product/<id>/similar', auth='public', methods=['GET'], cors="*") def get_product_similar_by_id(self, **kw): if not self.authenticate(): return self.response(code=401, description='Unauthorized') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 156cf381..28356a86 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -32,6 +32,7 @@ class ProductTemplate(models.Model): last_calculate_rating = fields.Datetime("Last Calculate Rating") web_price_sorting = fields.Float('Web Price Sorting', help='Hanya digunakan untuk sorting di web, harga tidak berlaku', default=0.0) virtual_qty = fields.Float(string='Virtual Qty', default=0) + solr_flag = fields.Integer(string='Solr Flag', default=0) def _compute_qty_stock_vendor(self): for product_template in self: @@ -142,6 +143,7 @@ class ProductProduct(models.Model): qty_stock_vendor = fields.Float( 'Qty Stock Vendor', compute='_compute_stock_vendor', help="Stock Vendor") + solr_flag = fields.Integer(string='Solr Flag', default=0) def _compute_web_price(self): for product in self: |
