diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-13 09:13:15 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-06-13 09:13:15 +0700 |
| commit | 4af22ad4f15865626f0a99fed233cb19d04d9b8c (patch) | |
| tree | 303b95b45f562d7fc2b829c9a44a810ea25dfae0 | |
| parent | 8a025fe63ea44b93d3978da7df3aa31533da5300 (diff) | |
| parent | 4db20f77298f38c52d9930da1942225f8b8eac50 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into tukar_guling
| -rw-r--r-- | indoteknik_api/controllers/api_v1/cart.py | 35 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 8 |
2 files changed, 22 insertions, 21 deletions
diff --git a/indoteknik_api/controllers/api_v1/cart.py b/indoteknik_api/controllers/api_v1/cart.py index 7a40b1e2..fdc237cf 100644 --- a/indoteknik_api/controllers/api_v1/cart.py +++ b/indoteknik_api/controllers/api_v1/cart.py @@ -16,24 +16,31 @@ class Cart(controller.Controller): offset = int(kw.get('offset', 0)) query = [('user_id', '=', user_id)] carts = user_cart.search(query, limit=limit, offset=offset, order='create_date desc') - # carts.write({'source': 'add_to_cart'}) + products = [] products_inactive = [] + for cart in carts: - if cart.product_id: - price = cart.product_id._v2_get_website_price_include_tax() - if cart.product_id.active and price > 0: - product = cart.with_context(price_for="web").get_products() - for product_active in product: - products.append(product_active) + try: + if cart.product_id: + price = cart.product_id._v2_get_website_price_include_tax() + + if cart.product_id.active and price > 0: + product = cart.with_context(price_for="web").get_products() + for product_active in product: + products.append(product_active) + else: + product_inactives = cart.with_context(price_for="web").get_products() + for inactives in product_inactives: + products_inactive.append(inactives) else: - product_inactives = cart.with_context(price_for="web").get_products() - for inactives in product_inactives: - products_inactive.append(inactives) - else: - program = cart.with_context(price_for="web").get_products() - for programs in program: - products.append(programs) + program = cart.with_context(price_for="web").get_products() + for programs in program: + products.append(programs) + + except Exception as e: + continue + data = { 'product_total': user_cart.search_count(query), 'products': products, diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 3921ed5a..9dfc8b78 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -529,13 +529,7 @@ class StockPicking(models.Model): record.kgx_pod_photo = "No image available." def action_fetch_lalamove_order(self): - pickings = self.env['stock.picking'].search([ - ('picking_type_code', '=', 'outgoing'), - ('state', '=', 'done'), - ('carrier_id', '=', 9), - ('lalamove_order_id', '!=', False) - ]) - for picking in pickings: + for picking in self: try: order_id = picking.lalamove_order_id apikey = self.env['ir.config_parameter'].sudo().get_param('lalamove.apikey') |
