diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2025-03-05 13:24:35 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2025-03-05 13:24:35 +0700 |
| commit | f53c699804806a83252901f5aa076c2f9ddcb8b4 (patch) | |
| tree | 10b3d84f20f9e1453349cb6b6cca5431d1ea348a | |
| parent | 887a0a83cd1ba53689d8c4b453761b94fa7e109b (diff) | |
biteship
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 85cdc7eb..95c94fad 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -179,41 +179,10 @@ class StockPicking(models.Model): biteship_id = fields.Char(string="Biteship Respon ID") biteship_tracking_id = fields.Char(string="Biteship Trackcking ID") biteship_waybill_id = fields.Char(string="Biteship Waybill ID") - estimated_ready_ship_date = fields.Datetime(string='ET Ready to Ship', copy=False, related='sale_id.estimated_ready_ship_date') + estimated_ready_ship_date = fields.Datetime(string='ET Ready to Ship', copy=False, related='sale_id.sale') countdown_hours = fields.Float(string='Countdown in Hours', compute='_callculate_sequance', default=False, store=False, compute_sudo=False) countdown_ready_to_ship = fields.Char(string='Countdown Ready to Ship', compute='_callculate_sequance', store=False, compute_sudo=False) - final_seq_tmp = fields.Float(string='Sequance Order in hours', store=True, compute_sudo=True) - final_seq = fields.Float(string='Sequance Order', related='final_seq_tmp', index=True) - - execution_date = fields.Float( - string='Time Remainder by date Reserved', - store=True, # Menyimpan hasil ke database - ) - def _compute_execution_date_by_date_reserved(self, date_reserved): - for record in self: - try: - if record.date_reserved and record.state not in ('cancel', 'done'): - date_reserved = record.date_reserved + timedelta(days=1) - time_diff = (date_reserved - waktu.now()).total_seconds() / 3600 - record.execution_date = time_diff - else: - record.execution_date = 99999999999 # Kosongkan jika tidak memenuhi kondisi - - except Exception as e: - error = f"Error calculating sequance {str(e)}" - _logger.error(f"Error calculating sequance {self.id}: {str(e)}") - return { 'error': str(e) } - - - # @api.depends('date_reserved') - # def _callculate_final_sequance(self): - # filtered_records = self.filtered(lambda r: r.estimated_ready_ship_date and r.date_reserved and r.state not in ('cancel', 'done')) - # for record in filtered_records: - # estimated_by_erts = (record.estimated_ready_ship_date - waktu.now()).total_seconds() / 3600 - # estimated_by_date = (record.date_reserved - waktu.now()).total_seconds() / 3600 - # record.final_seq_tmp = min(estimated_by_erts, estimated_by_date) - - # (self - filtered_records).write({'final_seq_tmp': 99999999999}) + final_seq = fields.Float(string='Sequance Order', index=True) @api.depends('estimated_ready_ship_date', 'state') @@ -229,15 +198,11 @@ class StockPicking(models.Model): record.countdown_ready_to_ship = f"{rts_days} days, {rts_hours} hours" record.countdown_hours = estimated_by_erts - record.final_seq = estimated_by_erts else: - record.countdown_hours = 999999999999 record.countdown_ready_to_ship = False except Exception as e : - error = str(e) _logger.error(f"Error calculating sequance {self.id}: {str(e)}") - print(str(e)) return { 'error': str(e) } |
