summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-04-11 15:32:39 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-04-11 15:32:39 +0700
commit9ca20d51a0aad50ea3df9bd878735c2fb8aadcc3 (patch)
tree99a74ae7423b79b2f061ee3d153e393fcb5bdc9c /indoteknik_custom/models
parent52b493aaee7c1782c328d2f3af7bee6534342734 (diff)
push wms
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/stock_picking.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 932e394b..19b7517c 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -148,8 +148,16 @@ class StockPicking(models.Model):
# for record in self:
# record.show_state_approve_md = record.location_id.id == 47 or record.location_id.complete_name == "Virtual Locations/Gudang Selisih"
quantity_koli = fields.Float(string="Quantity Koli", copy=False)
+ total_mapping_koli = fields.Float(string="Total Mapping Koli", compute='_compute_total_mapping_koli')
-
+ @api.depends('konfirm_koli_lines', 'konfirm_koli_lines.pick_id', 'konfirm_koli_lines.pick_id.quantity_koli')
+ def _compute_total_mapping_koli(self):
+ for record in self:
+ total = 0.0
+ for line in record.konfirm_koli_lines:
+ if line.pick_id and line.pick_id.quantity_koli:
+ total += line.pick_id.quantity_koli
+ record.total_mapping_koli = total
@api.model
def _compute_dokumen_tanda_terima(self):
@@ -995,18 +1003,18 @@ class StockPicking(models.Model):
if self.location_id.id == 47 and self.env.user.id in users_in_group.mapped('id'):
self.state_approve_md = 'done'
- threshold_datetime = waktu(2025, 4, 11, 13, 26)
+ threshold_datetime = waktu(2025, 4, 11, 6, 26)
if (len(self.konfirm_koli_lines) == 0
and 'BU/OUT/' in self.name
and self.picking_type_code == 'outgoing'
- and (self.create_date or waktu.utcnow()) > threshold_datetime):
+ and self.create_date > threshold_datetime):
raise UserError(_("Tidak ada Mapping koli! Harap periksa kembali."))
if (len(self.scan_koli_lines) == 0
and 'BU/OUT/' in self.name
and self.picking_type_code == 'outgoing'
- and (self.create_date or waktu.utcnow()) > threshold_datetime):
+ and self.create_date > threshold_datetime):
raise UserError(_("Tidak ada scan koli! Harap periksa kembali."))
# if self.driver_departure_date == False and 'BU/OUT/' in self.name and self.picking_type_code == 'outgoing':
@@ -1015,9 +1023,12 @@ class StockPicking(models.Model):
if len(self.check_koli_lines) == 0 and 'BU/PICK/' in self.name:
raise UserError(_("Tidak ada koli! Harap periksa kembali."))
+ if len(self.check_product_lines) == 0 and 'BU/PICK/' in self.name:
+ raise UserError(_("Tidak ada Check Product! Harap periksa kembali."))
+
if self.total_koli > self.total_so_koli:
raise UserError(_("Total Koli (%s) dan Total SO Koli (%s) tidak sama! Harap periksa kembali.")
- % (self.total_koli, self.total_so_koli))
+ % (self.total_koli, self.t1otal_so_koli))
if not self.env.user.is_logistic_approver and self.env.context.get('active_model') == 'stock.picking':
if self.origin and 'Return of' in self.origin:
@@ -1847,7 +1858,7 @@ class KonfirmKoli(models.Model):
if exist:
raise UserError(f"⚠️ '{rec.pick_id.display_name}' sudah discan untuk picking ini!")
-
+
class WarningModalWizard(models.TransientModel):
_name = 'warning.modal.wizard'
_description = 'Peringatan Koli Belum Diperiksa'