From 12f1df2b2dabd0fba5dc0e2584c9a588c378118c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 23 Oct 2025 16:54:58 +0700 Subject: push maintenance partial delivery wizard --- indoteknik_custom/models/sale_order.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index a5e2f7c4..5c8f34c6 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -399,20 +399,21 @@ class SaleOrder(models.Model): ) def action_open_partial_delivery_wizard(self): - self.ensure_one() - pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name) - return { - 'type': 'ir.actions.act_window', - 'name': 'Partial Delivery', - 'res_model': 'partial.delivery.wizard', - 'view_mode': 'form', - 'target': 'new', - 'context': { - 'default_sale_id': self.id, - # kasih langsung list of int biar ga ribet di wizard - 'default_picking_ids': pickings.ids, - } - } + raise UserError("Fitur ini sedang dalam pengembangan") + # self.ensure_one() + # pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name) + # return { + # 'type': 'ir.actions.act_window', + # 'name': 'Partial Delivery', + # 'res_model': 'partial.delivery.wizard', + # 'view_mode': 'form', + # 'target': 'new', + # 'context': { + # 'default_sale_id': self.id, + # # kasih langsung list of int biar ga ribet di wizard + # 'default_picking_ids': pickings.ids, + # } + # } @api.depends('partner_id.is_cbd_locked') -- cgit v1.2.3 From 4b257da93f1eb1d025303113d6884b22df59c1b4 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 24 Oct 2025 11:27:57 +0700 Subject: refund barang kurang --- indoteknik_custom/models/refund_sale_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 47565dfc..e6547a88 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -753,10 +753,11 @@ class RefundSaleOrder(models.Model): line_vals = [] for so in self.sale_order_ids: for line in so.order_line: - if line.qty_delivered == 0: + barang_kurang = line.product_uom_qty - line.qty_delivered + if line.qty_delivered == 0 or barang_kurang > 0: line_vals.append((0, 0, { 'product_id': line.product_id.id, - 'quantity': line.product_uom_qty, + 'quantity': barang_kurang, 'from_name': so.name, 'prod_id': so.id, 'reason': '', -- cgit v1.2.3 From dc57520d3e0fe0bb8a314e1cb4ec4b3648fd8a37 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 24 Oct 2025 11:29:00 +0700 Subject: push --- indoteknik_custom/models/refund_sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index e6547a88..475f0355 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -754,7 +754,7 @@ class RefundSaleOrder(models.Model): for so in self.sale_order_ids: for line in so.order_line: barang_kurang = line.product_uom_qty - line.qty_delivered - if line.qty_delivered == 0 or barang_kurang > 0: + if line.qty_delivered == 0 or barang_kurang >= 0: line_vals.append((0, 0, { 'product_id': line.product_id.id, 'quantity': barang_kurang, -- cgit v1.2.3 From 64fcfa3daf65c8f5699544ce73d7ec930fa124af Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Fri, 24 Oct 2025 11:35:13 +0700 Subject: push --- indoteknik_custom/models/refund_sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 475f0355..e6547a88 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -754,7 +754,7 @@ class RefundSaleOrder(models.Model): for so in self.sale_order_ids: for line in so.order_line: barang_kurang = line.product_uom_qty - line.qty_delivered - if line.qty_delivered == 0 or barang_kurang >= 0: + if line.qty_delivered == 0 or barang_kurang > 0: line_vals.append((0, 0, { 'product_id': line.product_id.id, 'quantity': barang_kurang, -- cgit v1.2.3 From 24afe5ec17b16700aca266699a5963f23380f63e Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 24 Oct 2025 16:11:57 +0700 Subject: (andri) fix stock live --- indoteknik_api/controllers/api_v1/product.py | 72 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index e97a7ff8..2aeba7e8 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -108,10 +108,10 @@ class Product(controller.Controller): ('product_id', '=', id), ('is_winner', '=', True) ]) - stock_vendor = request.env['stock.vendor'].search([ - ('product_variant_id', '=', id), - ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) - ], limit=1) + # stock_vendor = request.env['stock.vendor'].search([ + # ('product_variant_id', '=', id), + # ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) + # ], limit=1) product = product_pruchase.product_id @@ -136,38 +136,38 @@ class Product(controller.Controller): sla_date = f'{slatime} Hari' # Qty Stock Vendor - qty_vendor = stock_vendor.quantity - qty_vendor -= int(qty_vendor * 0.1) - qty_vendor = math.ceil(float(qty_vendor)) - total_excell = qty_vendor - - is_altama_product = product.x_manufacture.id in [10, 122, 89] - if is_altama_product: - try: - # Qty Altama - qty_altama = request.env['product.template'].get_stock_altama( - product.default_code) - qty_altama -= int(qty_altama * 0.1) - qty_altama = math.ceil(float(qty_altama)) - total_adem = qty_altama - - if qty_available > 0: - qty = qty_available + total_adem + total_excell - sla_date = '1 Hari' - elif qty_altama > 0 or qty_vendor > 0: - qty = total_adem if qty_altama > 0 else total_excell - sla_date = f'{slatime} Hari' - else: - sla_date = f'{slatime} Hari' - except: - print('error') - else: - if qty_available > 0: - qty = qty_available - sla_date = f'1 Hari' - elif qty_vendor > 0: - qty = total_excell - sla_date = f'{slatime} Hari' + # qty_vendor = stock_vendor.quantity + # qty_vendor -= int(qty_vendor * 0.1) + # qty_vendor = math.ceil(float(qty_vendor)) + # total_excell = qty_vendor + + # is_altama_product = product.x_manufacture.id in [10, 122, 89] + # if is_altama_product: + # try: + # # Qty Altama + # qty_altama = request.env['product.template'].get_stock_altama( + # product.default_code) + # qty_altama -= int(qty_altama * 0.1) + # qty_altama = math.ceil(float(qty_altama)) + # total_adem = qty_altama + + # if qty_available > 0: + # qty = qty_available + total_adem + total_excell + # sla_date = '1 Hari' + # elif qty_altama > 0 or qty_vendor > 0: + # qty = total_adem if qty_altama > 0 else total_excell + # sla_date = f'{slatime} Hari' + # else: + # sla_date = f'{slatime} Hari' + # except: + # print('error') + # else: + # if qty_available > 0: + # qty = qty_available + # sla_date = f'1 Hari' + # elif qty_vendor > 0: + # qty = total_excell + # sla_date = f'{slatime} Hari' data = { 'qty': qty, -- cgit v1.2.3 From a45c6abe62390a45164ba27608f348954066c935 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 24 Oct 2025 16:21:23 +0700 Subject: (andri) fox --- indoteknik_api/controllers/api_v1/product.py | 72 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index 2aeba7e8..e97a7ff8 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -108,10 +108,10 @@ class Product(controller.Controller): ('product_id', '=', id), ('is_winner', '=', True) ]) - # stock_vendor = request.env['stock.vendor'].search([ - # ('product_variant_id', '=', id), - # ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) - # ], limit=1) + stock_vendor = request.env['stock.vendor'].search([ + ('product_variant_id', '=', id), + ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) + ], limit=1) product = product_pruchase.product_id @@ -136,38 +136,38 @@ class Product(controller.Controller): sla_date = f'{slatime} Hari' # Qty Stock Vendor - # qty_vendor = stock_vendor.quantity - # qty_vendor -= int(qty_vendor * 0.1) - # qty_vendor = math.ceil(float(qty_vendor)) - # total_excell = qty_vendor - - # is_altama_product = product.x_manufacture.id in [10, 122, 89] - # if is_altama_product: - # try: - # # Qty Altama - # qty_altama = request.env['product.template'].get_stock_altama( - # product.default_code) - # qty_altama -= int(qty_altama * 0.1) - # qty_altama = math.ceil(float(qty_altama)) - # total_adem = qty_altama - - # if qty_available > 0: - # qty = qty_available + total_adem + total_excell - # sla_date = '1 Hari' - # elif qty_altama > 0 or qty_vendor > 0: - # qty = total_adem if qty_altama > 0 else total_excell - # sla_date = f'{slatime} Hari' - # else: - # sla_date = f'{slatime} Hari' - # except: - # print('error') - # else: - # if qty_available > 0: - # qty = qty_available - # sla_date = f'1 Hari' - # elif qty_vendor > 0: - # qty = total_excell - # sla_date = f'{slatime} Hari' + qty_vendor = stock_vendor.quantity + qty_vendor -= int(qty_vendor * 0.1) + qty_vendor = math.ceil(float(qty_vendor)) + total_excell = qty_vendor + + is_altama_product = product.x_manufacture.id in [10, 122, 89] + if is_altama_product: + try: + # Qty Altama + qty_altama = request.env['product.template'].get_stock_altama( + product.default_code) + qty_altama -= int(qty_altama * 0.1) + qty_altama = math.ceil(float(qty_altama)) + total_adem = qty_altama + + if qty_available > 0: + qty = qty_available + total_adem + total_excell + sla_date = '1 Hari' + elif qty_altama > 0 or qty_vendor > 0: + qty = total_adem if qty_altama > 0 else total_excell + sla_date = f'{slatime} Hari' + else: + sla_date = f'{slatime} Hari' + except: + print('error') + else: + if qty_available > 0: + qty = qty_available + sla_date = f'1 Hari' + elif qty_vendor > 0: + qty = total_excell + sla_date = f'{slatime} Hari' data = { 'qty': qty, -- cgit v1.2.3 From b7658e977fb0697345fe34f88e6d0c312dc9bf4b Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 24 Oct 2025 17:00:07 +0700 Subject: (andri) fix --- indoteknik_api/controllers/api_v1/product.py | 85 +++++++++++++++------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index e97a7ff8..0eba92b4 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -103,17 +103,21 @@ class Product(controller.Controller): @controller.Controller.must_authorized() def get_product_template_stock_by_id(self, **kw): id = int(kw.get('id')) - date_7_days_ago = datetime.now() - timedelta(days=7) + # date_7_days_ago = datetime.now() - timedelta(days=7) + product = request.env['product.product'].search([('id', '=', id)], limit=1) + if not product: + return self.response({'qty': 0, 'sla_date': 'N/A'}, headers=[('Cache-Control', 'max-age=600, private')]) + product_pruchase = request.env['purchase.pricelist'].search([ ('product_id', '=', id), ('is_winner', '=', True) - ]) - stock_vendor = request.env['stock.vendor'].search([ - ('product_variant_id', '=', id), - ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) ], limit=1) + # stock_vendor = request.env['stock.vendor'].search([ + # ('product_variant_id', '=', id), + # ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) + # ], limit=1) - product = product_pruchase.product_id + # product = product_pruchase.product_id vendor_sla = request.env['vendor.sla'].search([('id_vendor', '=', product_pruchase.vendor_id.id)], limit=1) slatime = 15 @@ -132,42 +136,45 @@ class Product(controller.Controller): if qty_available < 1 : qty_available = 0 - qty = 0 + # qty = 0 + qty = qty_available sla_date = f'{slatime} Hari' + if qty_available > 0: + sla_date = '1 Hari' # Qty Stock Vendor - qty_vendor = stock_vendor.quantity - qty_vendor -= int(qty_vendor * 0.1) - qty_vendor = math.ceil(float(qty_vendor)) - total_excell = qty_vendor - - is_altama_product = product.x_manufacture.id in [10, 122, 89] - if is_altama_product: - try: - # Qty Altama - qty_altama = request.env['product.template'].get_stock_altama( - product.default_code) - qty_altama -= int(qty_altama * 0.1) - qty_altama = math.ceil(float(qty_altama)) - total_adem = qty_altama - - if qty_available > 0: - qty = qty_available + total_adem + total_excell - sla_date = '1 Hari' - elif qty_altama > 0 or qty_vendor > 0: - qty = total_adem if qty_altama > 0 else total_excell - sla_date = f'{slatime} Hari' - else: - sla_date = f'{slatime} Hari' - except: - print('error') - else: - if qty_available > 0: - qty = qty_available - sla_date = f'1 Hari' - elif qty_vendor > 0: - qty = total_excell - sla_date = f'{slatime} Hari' + # qty_vendor = stock_vendor.quantity + # qty_vendor -= int(qty_vendor * 0.1) + # qty_vendor = math.ceil(float(qty_vendor)) + # total_excell = qty_vendor + + # is_altama_product = product.x_manufacture.id in [10, 122, 89] + # if is_altama_product: + # try: + # # Qty Altama + # qty_altama = request.env['product.template'].get_stock_altama( + # product.default_code) + # qty_altama -= int(qty_altama * 0.1) + # qty_altama = math.ceil(float(qty_altama)) + # total_adem = qty_altama + + # if qty_available > 0: + # qty = qty_available + total_adem + total_excell + # sla_date = '1 Hari' + # elif qty_altama > 0 or qty_vendor > 0: + # qty = total_adem if qty_altama > 0 else total_excell + # sla_date = f'{slatime} Hari' + # else: + # sla_date = f'{slatime} Hari' + # except: + # print('error') + # else: + # if qty_available > 0: + # qty = qty_available + # sla_date = f'1 Hari' + # elif qty_vendor > 0: + # qty = total_excell + # sla_date = f'{slatime} Hari' data = { 'qty': qty, -- cgit v1.2.3 From 7a2361f0e6fbc4d3bcadd4f6c360f2337049f3cc Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 24 Oct 2025 18:53:56 +0700 Subject: (andri) fix --- indoteknik_api/controllers/api_v1/product.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/product.py b/indoteknik_api/controllers/api_v1/product.py index 0eba92b4..2f546078 100644 --- a/indoteknik_api/controllers/api_v1/product.py +++ b/indoteknik_api/controllers/api_v1/product.py @@ -252,6 +252,8 @@ class Product(controller.Controller): [('id', '=', id)], limit=1) qty_available = product.qty_free_bandengan + if qty_available < 1: + qty_available = 0 data = { 'qty': qty_available, -- cgit v1.2.3 From 2ee70365c70cb8de9570f456301dc85e5fc21ff7 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 25 Oct 2025 09:59:50 +0700 Subject: solr log --- indoteknik_custom/models/solr/apache_solr_queue.py | 18 ++++++++++-------- indoteknik_custom/views/apache_solr_queue.xml | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 1b51538f..ab03d569 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -1,10 +1,10 @@ from odoo import models, fields from datetime import datetime, timedelta -import logging, time - +import logging, time, traceback # <-- tambah traceback _logger = logging.getLogger(__name__) + class ApacheSolrQueue(models.Model): _name = 'apache.solr.queue' @@ -19,6 +19,7 @@ class ApacheSolrQueue(models.Model): ], 'Execute Status') execute_date = fields.Datetime('Execute Date') description = fields.Text('Description') + log = fields.Text('Log') def _compute_display_name(self): for rec in self: @@ -39,7 +40,7 @@ class ApacheSolrQueue(models.Model): if elapsed_time > max_exec_time: break rec.execute_queue() - + def open_target_record(self): return { 'name': '', @@ -70,14 +71,17 @@ class ApacheSolrQueue(models.Model): else: rec.execute_status = 'not_found' except Exception as e: - rec.description = e + # simpan error ringkas + traceback lengkap + rec.description = str(e) + rec.log = traceback.format_exc() rec.execute_status = 'failed' + rec.execute_date = datetime.utcnow() self.env.cr.commit() def create_unique(self, payload={}): count = self.search_count([ - ('res_model', '=', payload['res_model']), + ('res_model', '=', payload['res_model']), ('res_id', '=', payload['res_id']), ('function_name', '=', payload['function_name']), ('execute_status', '=', False) @@ -90,8 +94,6 @@ class ApacheSolrQueue(models.Model): ('execute_status', '=', 'success'), ('execute_date', '>=', (datetime.utcnow() - timedelta(days=days_after))), ], limit=limit) - + for rec in solr: rec.unlink() - - diff --git a/indoteknik_custom/views/apache_solr_queue.xml b/indoteknik_custom/views/apache_solr_queue.xml index 4c145b9f..d425ca72 100644 --- a/indoteknik_custom/views/apache_solr_queue.xml +++ b/indoteknik_custom/views/apache_solr_queue.xml @@ -18,6 +18,7 @@ decoration-success="execute_status == 'success'" decoration-primary="execute_status == 'not_found'" /> + -- cgit v1.2.3 From b91ff1da85f4d57770805a7f56ccb28a4d409c4d Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 25 Oct 2025 10:00:47 +0700 Subject: solr log --- indoteknik_custom/models/solr/apache_solr_queue.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index ab03d569..3d6bd733 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -68,6 +68,7 @@ class ApacheSolrQueue(models.Model): if model_instance: getattr(model_instance, function_name)() rec.execute_status = 'success' + rec.log = traceback.format_exc() else: rec.execute_status = 'not_found' except Exception as e: -- cgit v1.2.3 From cf47d5e66cb7a87e37b17ee13df9f321dfc90f06 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 25 Oct 2025 10:04:03 +0700 Subject: solr log --- indoteknik_custom/views/apache_solr_queue.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/apache_solr_queue.xml b/indoteknik_custom/views/apache_solr_queue.xml index d425ca72..a87d49f6 100644 --- a/indoteknik_custom/views/apache_solr_queue.xml +++ b/indoteknik_custom/views/apache_solr_queue.xml @@ -9,7 +9,7 @@ - + Date: Sat, 25 Oct 2025 12:01:36 +0700 Subject: solr image carousel and stock --- indoteknik_custom/models/solr/product_product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index d8bc3973..7260c3ca 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -69,9 +69,9 @@ class ProductProduct(models.Model): 'product_id_i': variant.id, 'template_id_i': variant.product_tmpl_id.id, 'image_s': ir_attachment.api_image('product.template', 'image_512', variant.product_tmpl_id.id), - 'image_carousel_s': [ir_attachment.api_image('image.carousel', 'image', carousel.id) for carousel in variant.product_tmpl_id.image_carousel_lines], + 'image_carousel_ss': [ir_attachment.api_image('image.carousel', 'image', carousel.id) for carousel in variant.product_tmpl_id.image_carousel_lines], 'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id), - 'stock_total_f': variant.qty_stock_vendor, + 'stock_total_f': variant.qty_free_bandengan, 'weight_f': variant.weight, 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0, 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '', -- cgit v1.2.3