From ee81bf8bd22dc3c2431554b7302071b725fe3e90 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Wed, 20 Aug 2025 10:53:20 +0700 Subject: (andri) add button bills DP & Pelunasan --- indoteknik_custom/models/purchase_order.py | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 103a9131..50913a80 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -103,6 +103,11 @@ class PurchaseOrder(models.Model): string="BU Related Count", compute='_compute_bu_related_count' ) + + bills_related_count = fields.Integer( + string="Bills DP & Pelunasan", + compute="_compute_bills_related_count" + ) manufacturing_id = fields.Many2one('mrp.production', string='Manufacturing Orders') complete_bu_in_count = fields.Integer( @@ -260,6 +265,33 @@ class PurchaseOrder(models.Model): 'target': 'current', } + def action_view_bills(self): + self.ensure_one() + + bill_ids = [] + if self.bills_dp_id: + bill_ids.append(self.bills_dp_id.id) + if self.bills_pelunasan_id: + bill_ids.append(self.bills_pelunasan_id.id) + + return { + 'name': 'Bills (DP & Pelunasan)', + 'type': 'ir.actions.act_window', + 'res_model': 'account.move', + 'view_mode': 'tree,form', + 'target': 'current', + 'domain': [('id', 'in', bill_ids)], + } + + def _compute_bills_related_count(self): + for order in self: + count = 0 + if order.bills_dp_id: + count += 1 + if order.bills_pelunasan_id: + count += 1 + order.bills_related_count = count + # cek payment term def _check_payment_term(self): _logger.info("Check Payment Term Terpanggil") -- cgit v1.2.3 From 44b64eac732a3638f36686174350f82fcfb3b3c4 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 20 Aug 2025 11:09:21 +0700 Subject: Dragable Image Carousel Product Variant --- indoteknik_custom/models/product_template.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index f59bea6b..13e99707 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -1365,4 +1365,5 @@ class ImageCarousel(models.Model): _order = 'product_id, id' product_id = fields.Many2one('product.template', string='Product', required=True, ondelete='cascade', index=True, copy=False) + sequence = fields.Integer("Sequence", default=10) image = fields.Binary(string='Image') -- cgit v1.2.3 From fcef24bcce3d9e1d916bef3ff74429c990edf3b7 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 20 Aug 2025 14:00:06 +0700 Subject: fix bug --- indoteknik_custom/models/stock_picking.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 3d04a416..423cbb0a 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1330,18 +1330,20 @@ class StockPicking(models.Model): current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time + # Validate Qty Demand Can't higher than Qty Product - for move_line in self.move_line_ids_without_package: - purchase_line = move_line.move_id.purchase_line_id - if purchase_line: - if purchase_line.product_uom_qty < move_line.product_uom_qty: - raise UserError( - _("Quantity demand (%s) tidak bisa lebih besar dari qty product (%s) untuk produk %s") % ( - move_line.product_uom_qty, - purchase_line.product_uom_qty, - move_line.product_id.display_name + if self.location_dest_id.id == 58 and 'BU/INPUT/' in self.name: + for move in self.move_ids_without_package: + purchase_line = move.purchase_line_id + if purchase_line: + if purchase_line.product_qty < move.quantity_done: + raise UserError( + _("Quantity demand (%s) tidak bisa lebih besar dari qty product (%s) untuk produk %s") % ( + move.quantity_done, + purchase_line.product_qty, + move.product_id.display_name + ) ) - ) self.validation_minus_onhand_quantity() self.responsible = self.env.user.id -- cgit v1.2.3 From af483feb734c1e135a779008ca3fa32a721d59ff Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 20 Aug 2025 15:24:58 +0700 Subject: fix bug percent pie --- indoteknik_custom/models/sale_order.py | 35 +++++++++++++++++------------ indoteknik_custom/models/sale_order_line.py | 23 +++++++++++-------- 2 files changed, 35 insertions(+), 23 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 53be999f..5787c6ea 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -431,21 +431,27 @@ class SaleOrder(models.Model): continue for move in line.move_ids: - if move.state != 'done': - # reserve qty (draft/assigned) - if move.picking_type_id.code == 'internal': + if move.picking_type_id.code == 'internal': + if move.state != 'done': + # PICK belum done → qty reserved reserved_qty += move.reserved_availability or 0.0 - continue - - # sudah done → cek alur lokasi - if move.location_dest_id.usage == 'customer': - # barang keluar → delivered - delivered_qty += move.quantity_done - elif move.location_id.usage == 'customer': - # barang balik (return) → kurangi delivered - delivered_qty -= move.quantity_done - - # clamp biar ga minus + else: + # PICK done → qty_done masih dianggap reserved (masuk BU/OUT) + reserved_qty += move.quantity_done or 0.0 + + elif move.state == 'done': + # OUT done (customer terima) → delivered + if move.location_dest_id.usage == 'customer': + delivered_qty += move.quantity_done + # sekaligus kurangi reserved (karena udah terkirim) + reserved_qty -= move.quantity_done + # Return dari customer + elif move.location_id.usage == 'customer': + delivered_qty -= move.quantity_done + reserved_qty += move.quantity_done # balik ke reserved + + # clamp jangan sampai minus + reserved_qty = max(reserved_qty, 0) delivered_qty = max(delivered_qty, 0) order.reserved_percent = (reserved_qty / total_qty) * 100 @@ -455,6 +461,7 @@ class SaleOrder(models.Model): order.reserved_percent = order.delivered_percent = order.unreserved_percent = 0 + def _has_ccm(self): if self.id: self.ccm_id = self.env['tukar.guling'].search([('origin', 'ilike', self.name)], limit=1) diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 2406995d..a20f93ef 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -66,21 +66,29 @@ class SaleOrderLine(models.Model): if order_qty > 0: for move in line.move_ids: + # --- CASE 1: Picking belum done --- if move.state != 'done': - # Reserve qty (hanya dari picking internal yang belum selesai) if move.picking_type_id.code == 'internal': reserved_qty += move.reserved_availability or 0.0 continue - # Kalau sudah done → cek lokasi - if move.location_dest_id.usage == 'customer': - # Barang keluar → tambah delivered + # --- CASE 2: Picking sudah done --- + if move.picking_type_id.code == 'internal': + # PICK done → qty_done tetap dianggap reserved (masih nunggu OUT) + reserved_qty += move.quantity_done or 0.0 + + elif move.location_dest_id.usage == 'customer': + # OUT done (barang nyampe customer) delivered_qty += move.quantity_done + reserved_qty -= move.quantity_done + elif move.location_id.usage == 'customer': - # Barang balik dari customer (retur) → kurangi delivered + # Retur dari customer delivered_qty -= move.quantity_done + reserved_qty += move.quantity_done - # Jangan sampai delivered minus + # clamp supaya gak minus + reserved_qty = max(reserved_qty, 0) delivered_qty = max(delivered_qty, 0) # Hitung persentase @@ -88,9 +96,6 @@ class SaleOrderLine(models.Model): line.delivered_percent = (delivered_qty / order_qty) * 100 if order_qty else 0 line.unreserved_percent = 100 - line.reserved_percent - line.delivered_percent - - - def _get_outgoing_incoming_moves(self): outgoing_moves = self.env['stock.move'] incoming_moves = self.env['stock.move'] -- cgit v1.2.3 From 3b4e4c77f0f0f83f3c739cd10c6e476c4dc39e7d Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 20 Aug 2025 15:26:43 +0700 Subject: Bug Invoice CCM --- indoteknik_custom/models/tukar_guling.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 4b03d4b0..23b9f085 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -109,9 +109,6 @@ class TukarGuling(models.Model): ('invoice_line_ids.product_id', 'in', product_ids), ] - if rec.partner_id: - domain.append(('partner_id', '=', rec.partner_id.id)) - extra = [] if rec.origin: extra.append(('invoice_origin', 'ilike', rec.origin)) -- cgit v1.2.3 From c837117a771bbefcf06706d024d4620b331192a9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 20 Aug 2025 16:20:28 +0700 Subject: push --- indoteknik_custom/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 5787c6ea..9a6f314d 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -391,9 +391,9 @@ class SaleOrder(models.Model): payment_state_custom = fields.Selection([ ('unpaid', 'Unpaid'), ('partial', 'Partially Paid'), - ('paid', 'Paid'), + ('paid', 'Full Paid'), ('no_invoice', 'No Invoice'), - ], string="Payment Status", compute="_compute_payment_state_custom", store=False) + ], string="Payment Status Invoice", compute="_compute_payment_state_custom", store=False) @api.depends('invoice_ids.payment_state', 'invoice_ids.amount_total', 'invoice_ids.amount_residual') def _compute_payment_state_custom(self): -- cgit v1.2.3 From 919af07c186c43f2e9f41c005d2ba16aa5e8596d Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 21 Aug 2025 08:49:46 +0700 Subject: Unblock --- indoteknik_custom/models/stock_picking.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 423cbb0a..7e970c5d 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -2072,8 +2072,6 @@ class CheckProduct(models.Model): _name = 'check.product' _description = 'Check Product' _order = 'picking_id, id' - _inherit = ['barcodes.barcode_events_mixin'] # ⬅️ aktifkan barcode handler - picking_id = fields.Many2one( 'stock.picking', @@ -2088,21 +2086,6 @@ class CheckProduct(models.Model): status = fields.Char(string='Status', compute='_compute_status') code_product = fields.Char(string='Code Product') - def write(self, vals): - if 'code_product' in vals and not self.env.context.get('from_barcode_scan'): - raise UserError("Field Code Product hanya bisa diisi melalui barcode scan.") - res = super().write(vals) - # konsolidasi dll milik Anda tetap jalan - if not self.env.context.get('skip_consolidate'): - self.with_context(skip_consolidate=True)._consolidate_duplicate_lines() - return res - - # Scanner handler - def on_barcode_scanned(self, barcode): - self.ensure_one() - self.with_context(from_barcode_scan=True).write({'code_product': barcode}) - self._onchange_code_product() - @api.onchange('code_product') def _onchange_code_product(self): if not self.code_product: -- cgit v1.2.3 From 3b19e1ad701ddd8ab5d7d226a1776d857451b078 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 21 Aug 2025 09:10:57 +0700 Subject: (andri) fix --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b0ffd8b9..bda9101d 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -278,8 +278,8 @@ class AccountMove(models.Model): 'reply_to': 'finance@indoteknik.co.id', } - _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}") template.send_mail(invs[0].id, force_send=True, email_values=values) + _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}") # flag invs.write({'reminder_sent_date': today}) # Post ke chatter -- cgit v1.2.3 From 80ed075e95d915f00c1abd0cde456516db439373 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 21 Aug 2025 13:06:43 +0700 Subject: (andri) fix --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index bda9101d..94774f0f 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -280,6 +280,7 @@ class AccountMove(models.Model): template.send_mail(invs[0].id, force_send=True, email_values=values) _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}") + _logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice (dtd = {dtd})") # flag invs.write({'reminder_sent_date': today}) # Post ke chatter @@ -293,7 +294,6 @@ class AccountMove(models.Model): author_id=system_id, ) - _logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice (dtd = {dtd})") @api.onchange('invoice_date') -- cgit v1.2.3