From 5005eebb8fdd82db1e65a1d3de715d8bb5a63b32 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 10 Jan 2024 11:10:50 +0700 Subject: IU minus inventory validation --- indoteknik_custom/models/stock_picking.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index a5e533b1..0c810ef7 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -281,6 +281,17 @@ class StockPicking(models.Model): self.is_internal_use = self.picking_type_id.is_internal_use return + def validation_minus_onhand_quantity(self): + bu_location_id = 57 + for line in self.move_line_ids_without_package: + quant = self.env['stock.quant'].search([ + ('product_id', '=', line.product_id.id), + ('location_id', '=', bu_location_id) + ]) + + if quant and quant.inventory_quantity < line.product_uom_qty: + raise UserError('Quantity reserved lebih besar dari quantity onhand di product') + def button_validate(self): if self._name != 'stock.picking': return super(StockPicking, self).button_validate() @@ -314,6 +325,8 @@ class StockPicking(models.Model): if not self.date_reserved: current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time + + self.validation_minus_onhand_quantity() res = super(StockPicking, self).button_validate() self.calculate_line_no() -- cgit v1.2.3 From 283baf2945adfbadaddd9fb0ca732df894189062 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 12 Jan 2024 15:42:16 +0700 Subject: fix validation iu minus on inventory --- indoteknik_custom/models/stock_picking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 0c810ef7..f6a21698 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -286,10 +286,10 @@ class StockPicking(models.Model): for line in self.move_line_ids_without_package: quant = self.env['stock.quant'].search([ ('product_id', '=', line.product_id.id), - ('location_id', '=', bu_location_id) + ('location_id', '=', bu_location_id), ]) - if quant and quant.inventory_quantity < line.product_uom_qty: + if self.sale_id and quant and quant.inventory_quantity < line.product_uom_qty: raise UserError('Quantity reserved lebih besar dari quantity onhand di product') def button_validate(self): -- cgit v1.2.3 From 7c348d0bd0f6e31c00351629f0c8cb6f36735f60 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 12 Jan 2024 16:34:34 +0700 Subject: nonaktif kode validation iu --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index f6a21698..cebd5fc1 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -326,7 +326,7 @@ class StockPicking(models.Model): current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time - self.validation_minus_onhand_quantity() + # self.validation_minus_onhand_quantity() res = super(StockPicking, self).button_validate() self.calculate_line_no() -- cgit v1.2.3 From a7a50ce0f4b80bf37c5abf8ba0f22ef1e2eeaf18 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 15 Jan 2024 13:25:50 +0700 Subject: fix iu minus inventory validation --- indoteknik_custom/models/stock_picking.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index cebd5fc1..c98b5f99 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -282,16 +282,22 @@ class StockPicking(models.Model): return def validation_minus_onhand_quantity(self): - bu_location_id = 57 + bu_location_id = 49 for line in self.move_line_ids_without_package: quant = self.env['stock.quant'].search([ ('product_id', '=', line.product_id.id), ('location_id', '=', bu_location_id), ]) - if self.sale_id and quant and quant.inventory_quantity < line.product_uom_qty: + if ( + self.picking_type_id.id == 29 + and quant + and line.location_id.id == bu_location_id + and quant.inventory_quantity < line.product_uom_qty + ): raise UserError('Quantity reserved lebih besar dari quantity onhand di product') + def button_validate(self): if self._name != 'stock.picking': return super(StockPicking, self).button_validate() -- cgit v1.2.3 From 29597914fc972bb875ddd10977f2fa34f7a60a22 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 15 Jan 2024 17:06:22 +0700 Subject: activate function iu minus inventory validation --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index c98b5f99..2819d6e7 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -332,7 +332,7 @@ class StockPicking(models.Model): current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') self.date_reserved = current_time - # self.validation_minus_onhand_quantity() + self.validation_minus_onhand_quantity() res = super(StockPicking, self).button_validate() self.calculate_line_no() -- cgit v1.2.3 From 965b9ef647f582664c8fe4d85831faca33642468 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 24 Jan 2024 12:00:12 +0700 Subject: status printed di sj --- indoteknik_custom/models/stock_picking.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 2819d6e7..40c8c1f9 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -76,6 +76,10 @@ class StockPicking(models.Model): carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method') shipping_status = fields.Char(string='Shipping Status', compute="_compute_shipping_status") date_reserved = fields.Datetime(string="Date Reserved", help='Tanggal ter-reserved semua barang nya') + status_printed = fields.Selection([ + ('not_printed', 'Belum Print'), + ('printed', 'Printed') + ], string='Printed SJ?', copy=False) def _compute_shipping_status(self): for rec in self: -- cgit v1.2.3 From ab11e1060a839b5cbd13b56e98fa291cc6a74e38 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 25 Jan 2024 13:18:47 +0700 Subject: add tracking to unreserved and check_availability button --- indoteknik_custom/models/stock_picking.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 40c8c1f9..6754ebab 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -80,6 +80,14 @@ class StockPicking(models.Model): ('not_printed', 'Belum Print'), ('printed', 'Printed') ], string='Printed SJ?', copy=False) + date_unreserve = fields.Datetime(string="Date Unreserved", copy=False, tracking=True) + date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) + + def do_unreserve(self): + res = super(StockPicking, self).do_unreserve() + current_time = datetime.datetime.utcnow() + self.date_unreserve = current_time + return res def _compute_shipping_status(self): for rec in self: @@ -204,7 +212,9 @@ class StockPicking(models.Model): def action_assign(self): res = super(StockPicking, self).action_assign() + current_time = datetime.datetime.utcnow() self.real_shipping_id = self.sale_id.real_shipping_id + self.date_availability = current_time return res def ask_approval(self): -- cgit v1.2.3 From bbbb683a01e316633cdbe8ef82303d05562ae0bb Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 29 Jan 2024 09:57:32 +0700 Subject: change name field on stock picking --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 6754ebab..1c58d954 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -79,7 +79,7 @@ class StockPicking(models.Model): status_printed = fields.Selection([ ('not_printed', 'Belum Print'), ('printed', 'Printed') - ], string='Printed SJ?', copy=False) + ], string='Printed?', copy=False) date_unreserve = fields.Datetime(string="Date Unreserved", copy=False, tracking=True) date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) -- cgit v1.2.3 From 4a35b0d5432ed38395fa8f8cb6ebcfb5e0887f28 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 29 Jan 2024 14:26:20 +0700 Subject: add status note logistc --- indoteknik_custom/models/stock_picking.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/stock_picking.py') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 6754ebab..8ff782ba 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -69,7 +69,9 @@ class StockPicking(models.Model): note_logistic = fields.Selection([ ('hold', 'Hold by Sales'), ('not_paid', 'Customer belum bayar'), - ('partial', 'Kirim Parsial') + ('partial', 'Kirim Parsial'), + ('not_complete', 'Belum Lengkap'), + ('indent', 'Indent') ], string='Note Logistic', help='jika field ini diisi maka tidak akan dihitung ke lead time') waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill') purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', string="Purchase Representative", readonly=True) -- cgit v1.2.3