From f71f148d00b546bc46922eeeeaa512f79cecd573 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 8 Oct 2025 15:04:22 +0700 Subject: balikin sp --- indoteknik_custom/models/stock_picking.py | 8 -------- 1 file changed, 8 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 217e76cb..4772c433 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -178,14 +178,6 @@ class StockPicking(models.Model): area_name = fields.Char(string="Area", compute="_compute_area_name") is_bu_iu = fields.Boolean('Is BU/IU', compute='_compute_is_bu_iu', default=False, copy=False, readonl=True) - @api.constrains('driver_departure_date') - def _constrains_driver_departure_date(self): - allowed_user_ids = [17, 6277, 25] - for record in self: - if record.driver_departure_date and self.env.user.id not in allowed_user_ids: - raise UserError("Hanya Denise dan Faishal yang dapat mengubah Delivery Departure Date.") - - @api.depends('name') def _compute_is_bu_iu(self): for record in self: -- cgit v1.2.3 From c8b3d4f3c5da81eb3858af6b8a7fc54b83a286a5 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 8 Oct 2025 15:20:43 +0700 Subject: delivery departure date val --- indoteknik_custom/models/stock_picking.py | 5 +++++ 1 file changed, 5 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 4772c433..8e947267 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1654,6 +1654,11 @@ class StockPicking(models.Model): line.sale_line_id = sale_line.id def write(self, vals): + allowed_user_ids = [17, 6277] + if 'driver_departure_date' in vals: + if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): + raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") + if 'linked_manual_bu_out' in vals: for record in self: if (record.picking_type_code == 'internal' -- cgit v1.2.3 From 393958c36bf49b7b2dbd888b81c345b7734151a0 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 9 Oct 2025 11:35:17 +0700 Subject: balikin del dep date --- indoteknik_custom/models/stock_picking.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 8e947267..87182277 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1654,10 +1654,10 @@ class StockPicking(models.Model): line.sale_line_id = sale_line.id def write(self, vals): - allowed_user_ids = [17, 6277] - if 'driver_departure_date' in vals: - if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): - raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") + # allowed_user_ids = [17, 6277] + # if 'driver_departure_date' in vals: + # if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): + # raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") if 'linked_manual_bu_out' in vals: for record in self: -- cgit v1.2.3 From b25d39b4d5dd456ef2e40a25ce3608e5c9b6694d Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 9 Oct 2025 14:55:00 +0700 Subject: fix delivery departure date validation --- indoteknik_custom/models/stock_picking.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 87182277..8a5888fc 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -471,9 +471,9 @@ class StockPicking(models.Model): if len(picking.scan_koli_lines) > 0: if len(picking.scan_koli_lines) != picking.total_mapping_koli: raise UserError("Scan Koli Tidak Sesuai Dengan Total Mapping Koli") - - picking.driver_departure_date = now - + picking.with_context(allow_driver_departure_edit=True).write({ + 'driver_departure_date': now + }) @api.depends('total_so_koli') def _compute_total_so_koli(self): for picking in self: @@ -1654,10 +1654,10 @@ class StockPicking(models.Model): line.sale_line_id = sale_line.id def write(self, vals): - # allowed_user_ids = [17, 6277] - # if 'driver_departure_date' in vals: - # if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): - # raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") + allowed_user_ids = [17, 6277] + if 'driver_departure_date' in vals: + if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): + raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") if 'linked_manual_bu_out' in vals: for record in self: -- cgit v1.2.3 From e4b191155bf44bfcd58d6ae1b95d4a112bd43547 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Fri, 10 Oct 2025 11:17:41 +0700 Subject: balikin driver dep date --- indoteknik_custom/models/stock_picking.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 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 8a5888fc..4772c433 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -471,9 +471,9 @@ class StockPicking(models.Model): if len(picking.scan_koli_lines) > 0: if len(picking.scan_koli_lines) != picking.total_mapping_koli: raise UserError("Scan Koli Tidak Sesuai Dengan Total Mapping Koli") - picking.with_context(allow_driver_departure_edit=True).write({ - 'driver_departure_date': now - }) + + picking.driver_departure_date = now + @api.depends('total_so_koli') def _compute_total_so_koli(self): for picking in self: @@ -1654,11 +1654,6 @@ class StockPicking(models.Model): line.sale_line_id = sale_line.id def write(self, vals): - allowed_user_ids = [17, 6277] - if 'driver_departure_date' in vals: - if self.env.user.id not in allowed_user_ids and not self.env.context.get('allow_driver_departure_edit'): - raise UserError("Hanya Denise dan Faisal yang dapat mengubah Delivery Departure Date.") - if 'linked_manual_bu_out' in vals: for record in self: if (record.picking_type_code == 'internal' -- cgit v1.2.3