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(+) 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