From 562f34bf5eb4b216ddf845813e405704f3842789 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 15 May 2025 11:39:09 +0700 Subject: disable reserve --- indoteknik_custom/models/stock_picking.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index ac812a32..1c4a6cbc 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1012,6 +1012,8 @@ class StockPicking(models.Model): self.sale_id.date_doc_kirim = self.date_doc_kirim def action_assign(self): + if self.sale_id.hold_outgoing == True and self.location_id == 57 and self.location_dest_id == 60: + raise UserError("SO on hold") res = super(StockPicking, self).action_assign() current_time = datetime.datetime.utcnow() self.real_shipping_id = self.sale_id.real_shipping_id -- cgit v1.2.3 From aac9e231854f3f7ad112fc57ef53d2edac662c7a Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 15 May 2025 11:43:42 +0700 Subject: disable reserve --- indoteknik_custom/models/sale_order.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 6550b859..1242108e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -372,6 +372,9 @@ class SaleOrder(models.Model): if self.hold_outgoing == True: self.hold_outgoing = False else: + pick = self.env['stock.picking'].search([('sale_id', '=', self.id), ('state', 'not in', ['cancel','done']),('BU/PICK/', 'in', self.name)]) + for picking in pick: + picking.do_unreserve() self.hold_outgoing = True def _validate_uniform_taxes(self): -- cgit v1.2.3 From e5504fd30bcb1490a9de2b4af0e03fb7e22daef1 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 15 May 2025 13:32:27 +0700 Subject: fix bug --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 1c4a6cbc..9b8f6775 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1012,7 +1012,7 @@ class StockPicking(models.Model): self.sale_id.date_doc_kirim = self.date_doc_kirim def action_assign(self): - if self.sale_id.hold_outgoing == True and self.location_id == 57 and self.location_dest_id == 60: + if self.sale_id.hold_outgoing == True and self.location_id.id == 57 and self.location_dest_id.id == 60: raise UserError("SO on hold") res = super(StockPicking, self).action_assign() current_time = datetime.datetime.utcnow() -- cgit v1.2.3 From 07efd05ec1574396ffee0c347e3f92499d174b3e Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 15 May 2025 13:40:51 +0700 Subject: push disable reserved --- indoteknik_custom/models/sale_order.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 1242108e..b5f69fa2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -372,7 +372,11 @@ class SaleOrder(models.Model): if self.hold_outgoing == True: self.hold_outgoing = False else: - pick = self.env['stock.picking'].search([('sale_id', '=', self.id), ('state', 'not in', ['cancel','done']),('BU/PICK/', 'in', self.name)]) + pick = self.env['stock.picking'].search([ + ('sale_id', '=', self.id), + ('state', 'not in', ['cancel', 'done']), + ('name', 'ilike', 'BU/PICK/%') + ]) for picking in pick: picking.do_unreserve() self.hold_outgoing = True -- cgit v1.2.3