diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-10-11 15:58:58 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-10-11 15:58:58 +0700 |
| commit | dae117ce9bb219557c9a4fc995e93bc4a88ea03f (patch) | |
| tree | 62f51e1c8290651606759fc8d31a2662e7878590 /indoteknik_api/controllers/product_controller.py | |
| parent | fd6af0fbd83042c8471c3c58ff459f52bed45938 (diff) | |
init commit
Diffstat (limited to 'indoteknik_api/controllers/product_controller.py')
| -rw-r--r-- | indoteknik_api/controllers/product_controller.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/indoteknik_api/controllers/product_controller.py b/indoteknik_api/controllers/product_controller.py index a57cf0a5..abb48f7d 100644 --- a/indoteknik_api/controllers/product_controller.py +++ b/indoteknik_api/controllers/product_controller.py @@ -13,7 +13,7 @@ class ProductController(controller.Controller): # TODO: separate function for get manufacture and promotion by product_id @http.route(prefix_url + '/search', auth='public', methods=['GET']) def search_product(self, **kw): - self.authenticate(kw) + self.authenticate() base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') query = kw.get('query') @@ -42,7 +42,7 @@ class ProductController(controller.Controller): product_variant_ids = [x.id for x in product_variants] domain = [('product_variant_ids', 'in', product_variant_ids)] - product_templates = self.search_with_api_params('product.template', kw, domain) + product_templates = self.search_filter('product.template', kw, domain) data = { 'total_records': len(request.env['product.template'].search(domain)), 'products': [] @@ -51,9 +51,9 @@ class ProductController(controller.Controller): discount_price = 0 price = product_template.web_price if price > 0: - if product_template.taxes_id: - if not product_template.taxes_id.price_include: - price += (price * product_template.taxes_id.amount / 100) + if product_template.web_tax_id: + if not product_template.web_tax_id.price_include: + price += (price * product_template.web_tax_id.amount / 100) else: price += (price * 11 / 100) @@ -95,7 +95,7 @@ class ProductController(controller.Controller): } product_pricelist_item = request.env['product.pricelist.item'].search([('pricelist_id', '=', active_flash_sale.id)]) product_variant_ids = [x.product_id.id for x in product_pricelist_item] - product_templates = self.search_with_api_params('product.template', kw, [('product_variant_ids', 'in', product_variant_ids)]) + product_templates = self.search_filter('product.template', kw, [('product_variant_ids', 'in', product_variant_ids)]) for product in product_templates: flash_sale['products'].append({ 'id': product.id, |
