From 31b195e9f678cc6ab40eb3a472c063d5cede1554 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 01:21:42 +0700 Subject: ngerapihin kode shipment group --- fixco_custom/models/shipment_group.py | 49 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index 4912ce3..154db7c 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -267,33 +267,19 @@ class PickingLine(models.Model): order_reference = fields.Char(string='Order Reference') status = fields.Char(string='Status') - @api.onchange('scan_receipt') - def _check_duplicate_scan(self): - for line in self: - if not line.scan_receipt: - continue - - # Cari duplikat selain dirinya - dup = self.search([ - ('scan_receipt', '=', line.scan_receipt), - # ('id', '!=', line.id) - ], limit=1) - - if not dup: - continue + @api.constrains('scan_receipt') + def _check_duplicate_picking_line(self): + if self.scan_receipt: + exist = self.search([ + '|', + ('scan_receipt', '=', self.scan_receipt), + ('invoice_marketplace', '=', self.scan_receipt), + ], limit=1) - # 1. Dup di shipment yang sama (lagi create / edit) - # if dup.shipment_id.id == line.shipment_id.id: - # raise ValidationError( - # "Receipt '%s' sudah ada di Shipment ini." % - # line.scan_receipt - # ) - - # 2. Dup di shipment lain (data lama) - raise ValidationError( - "Receipt '%s' sudah digunakan di Shipment %s." % - (line.scan_receipt, dup.shipment_id.number or '-') - ) + if exist: + raise UserError( + "Receipt '%s' sudah digunakan di shipment group %s." % (self.scan_receipt, exist.shipment_id.number) + ) @api.onchange('scan_receipt') @@ -318,6 +304,17 @@ class PickingLine(models.Model): "Receipt '%s' Tidak ditemukan / Status Picking tidak Done." % line.scan_receipt ) + exist = self.search([ + '|', + ('scan_receipt', '=', self.scan_receipt), + ('invoice_marketplace', '=', self.scan_receipt), + ], limit=1) + + if exist: + raise UserError( + "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) + ) + # isi field line.picking_id = picking line.carrier = picking.carrier -- cgit v1.2.3 From 64da7e6f4838ba3a5b731609598e6a521d92accd Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 09:13:02 +0700 Subject: balikin --- fixco_custom/models/shipment_group.py | 49 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index 154db7c..4912ce3 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -267,19 +267,33 @@ class PickingLine(models.Model): order_reference = fields.Char(string='Order Reference') status = fields.Char(string='Status') - @api.constrains('scan_receipt') - def _check_duplicate_picking_line(self): - if self.scan_receipt: - exist = self.search([ - '|', - ('scan_receipt', '=', self.scan_receipt), - ('invoice_marketplace', '=', self.scan_receipt), - ], limit=1) + @api.onchange('scan_receipt') + def _check_duplicate_scan(self): + for line in self: + if not line.scan_receipt: + continue - if exist: - raise UserError( - "Receipt '%s' sudah digunakan di shipment group %s." % (self.scan_receipt, exist.shipment_id.number) - ) + # Cari duplikat selain dirinya + dup = self.search([ + ('scan_receipt', '=', line.scan_receipt), + # ('id', '!=', line.id) + ], limit=1) + + if not dup: + continue + + # 1. Dup di shipment yang sama (lagi create / edit) + # if dup.shipment_id.id == line.shipment_id.id: + # raise ValidationError( + # "Receipt '%s' sudah ada di Shipment ini." % + # line.scan_receipt + # ) + + # 2. Dup di shipment lain (data lama) + raise ValidationError( + "Receipt '%s' sudah digunakan di Shipment %s." % + (line.scan_receipt, dup.shipment_id.number or '-') + ) @api.onchange('scan_receipt') @@ -304,17 +318,6 @@ class PickingLine(models.Model): "Receipt '%s' Tidak ditemukan / Status Picking tidak Done." % line.scan_receipt ) - exist = self.search([ - '|', - ('scan_receipt', '=', self.scan_receipt), - ('invoice_marketplace', '=', self.scan_receipt), - ], limit=1) - - if exist: - raise UserError( - "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) - ) - # isi field line.picking_id = picking line.carrier = picking.carrier -- cgit v1.2.3 From 6e9192ac6f2f4f3e833c1e0872db6e944b6f306a Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 10:19:06 +0700 Subject: Benerin error singleton sgr --- fixco_custom/models/shipment_group.py | 50 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index 4912ce3..ab908a2 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -267,33 +267,20 @@ class PickingLine(models.Model): order_reference = fields.Char(string='Order Reference') status = fields.Char(string='Status') - @api.onchange('scan_receipt') - def _check_duplicate_scan(self): + @api.constrains('scan_receipt') + def _check_duplicate_picking_line(self): for line in self: - if not line.scan_receipt: - continue - - # Cari duplikat selain dirinya - dup = self.search([ - ('scan_receipt', '=', line.scan_receipt), - # ('id', '!=', line.id) - ], limit=1) - - if not dup: - continue - - # 1. Dup di shipment yang sama (lagi create / edit) - # if dup.shipment_id.id == line.shipment_id.id: - # raise ValidationError( - # "Receipt '%s' sudah ada di Shipment ini." % - # line.scan_receipt - # ) - - # 2. Dup di shipment lain (data lama) - raise ValidationError( - "Receipt '%s' sudah digunakan di Shipment %s." % - (line.scan_receipt, dup.shipment_id.number or '-') - ) + if self.scan_receipt: + exist = self.search([ + '|', + ('scan_receipt', '=', line.scan_receipt), + ('invoice_marketplace', '=', line.scan_receipt), + ], limit=1) + + if exist: + raise UserError( + "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) + ) @api.onchange('scan_receipt') @@ -318,6 +305,17 @@ class PickingLine(models.Model): "Receipt '%s' Tidak ditemukan / Status Picking tidak Done." % line.scan_receipt ) + exist = self.search([ + '|', + ('scan_receipt', '=', line.scan_receipt), + ('invoice_marketplace', '=', line.scan_receipt), + ], limit=1) + + if exist: + raise UserError( + "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) + ) + # isi field line.picking_id = picking line.carrier = picking.carrier -- cgit v1.2.3 From 4cedbbdded01c7d8db115a93e5ab3337404f86a4 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 10:21:44 +0700 Subject: decrease barcode size print picking list --- fixco_custom/views/report_picking_list_new.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fixco_custom/views/report_picking_list_new.xml b/fixco_custom/views/report_picking_list_new.xml index a10e231..673e394 100644 --- a/fixco_custom/views/report_picking_list_new.xml +++ b/fixco_custom/views/report_picking_list_new.xml @@ -80,8 +80,8 @@
- QR Code + QR Code
-- cgit v1.2.3 From 0c21e4c4395ab54aa0f4fde0d19a5705dc12cd49 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 11:44:59 +0700 Subject: Fix check bundling --- fixco_custom/models/stock_picking.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index c2d5150..a3101d3 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -70,9 +70,14 @@ class StockPicking(models.Model): def check_qty_bundling_product(self): for line in self.move_ids_without_package: - if '(Bundle Component)' in line.sale_line_id.name: - if line.forecast_availability < 1 or line.quantity_done < 1: - raise UserError('Barang Bundling : %s Quantity Done tidak boleh 0' % line.product_id.display_name) + if line.sale_line_id and line.sale_line_id.name: + if '(Bundle Component)' in line.sale_line_id.name: + if line.forecast_availability < 1 or line.quantity_done < 1: + raise UserError( + 'Barang Bundling : %s Quantity Done tidak boleh 0' + % line.product_id.display_name + ) + def check_qty_done_stock(self): for line in self.move_line_ids_without_package: -- cgit v1.2.3 From 23c79946d624f081ef80c57117dba9038569e00a Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 13:36:06 +0700 Subject: push --- fixco_custom/models/shipment_group.py | 52 +++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index ab908a2..36a781b 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -267,20 +267,35 @@ class PickingLine(models.Model): order_reference = fields.Char(string='Order Reference') status = fields.Char(string='Status') - @api.constrains('scan_receipt') - def _check_duplicate_picking_line(self): + @api.onchange('scan_receipt') + def _check_duplicate_scan(self): for line in self: - if self.scan_receipt: - exist = self.search([ - '|', - ('scan_receipt', '=', line.scan_receipt), - ('invoice_marketplace', '=', line.scan_receipt), - ], limit=1) - - if exist: - raise UserError( - "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) - ) + if not line.scan_receipt: + continue + + # Cari duplikat selain dirinya + dup = self.search([ + '|', + ('scan_receipt', '=', line.scan_receipt), + ('scan_receipt', '=', line.invoice_marketplace), + # ('id', '!=', line.id) + ], limit=1) + + if not dup: + continue + + # 1. Dup di shipment yang sama (lagi create / edit) + # if dup.shipment_id.id == line.shipment_id.id: + # raise ValidationError( + # "Receipt '%s' sudah ada di Shipment ini." % + # line.scan_receipt + # ) + + # 2. Dup di shipment lain (data lama) + raise ValidationError( + "Receipt '%s' sudah digunakan di Shipment %s." % + (line.scan_receipt, dup.shipment_id.number or '-') + ) @api.onchange('scan_receipt') @@ -305,17 +320,6 @@ class PickingLine(models.Model): "Receipt '%s' Tidak ditemukan / Status Picking tidak Done." % line.scan_receipt ) - exist = self.search([ - '|', - ('scan_receipt', '=', line.scan_receipt), - ('invoice_marketplace', '=', line.scan_receipt), - ], limit=1) - - if exist: - raise UserError( - "Receipt '%s' sudah digunakan di shipment group %s." % (line.scan_receipt, exist.shipment_id.number) - ) - # isi field line.picking_id = picking line.carrier = picking.carrier -- cgit v1.2.3 From fc1aaa10ac1f34bb932a4e1ed8561a7de3884059 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 13:44:38 +0700 Subject: push --- fixco_custom/models/shipment_group.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index 36a781b..4912ce3 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -275,9 +275,7 @@ class PickingLine(models.Model): # Cari duplikat selain dirinya dup = self.search([ - '|', ('scan_receipt', '=', line.scan_receipt), - ('scan_receipt', '=', line.invoice_marketplace), # ('id', '!=', line.id) ], limit=1) -- cgit v1.2.3 From e1feb9507aed840000692cb8d2803e48f7393191 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Sat, 10 Jan 2026 21:08:19 +0700 Subject: limit sgr line --- fixco_custom/models/shipment_group.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py index 4912ce3..12d1fc6 100644 --- a/fixco_custom/models/shipment_group.py +++ b/fixco_custom/models/shipment_group.py @@ -37,6 +37,11 @@ class ShipmentGroup(models.Model): receipt = fields.Char(string='Receipt', related='picking_lines.scan_receipt') total_line = fields.Integer(string='Total Line', compute='_compute_total_line') + @api.onchange('picking_lines') + def _onchange_limit_lines(self): + if len(self.picking_lines) >= 100: + raise UserError("Maksimal 100 picking line per shipment.") + @api.depends('picking_lines') def _compute_total_line(self): for rec in self: -- cgit v1.2.3