summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-30 15:24:37 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-30 15:24:37 +0700
commitcb81068b8b695eaf8de5c0ba6b0951bae436626e (patch)
treefd4ce5250bc2e56e91e4ce394365438854909b42 /indoteknik_custom/models/stock_picking.py
parent90a29846ae6008b3152d495f2e83a5d00cfdd438 (diff)
parent3b83868fbdb29e8f5208035e5166a13e5d24f382 (diff)
Merge branch 'production' into iman/switch-account
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 3dd960e2..66a326ff 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -125,12 +125,27 @@ class StockPicking(models.Model):
raise UserError('Hanya Logistic yang bisa mengubah shipping method')
def do_unreserve(self):
+ if not self._context.get('darimana') == 'sale.order':
+ self.sale_id.unreserve_id = self.id
+ return self._create_approval_notification('Logistic')
+
res = super(StockPicking, self).do_unreserve()
- if not self.env.user.is_purchasing_manager:
- raise UserError('Hanya Purchasing Manager yang bisa Unreserve')
current_time = datetime.datetime.utcnow()
self.date_unreserve = current_time
+
return res
+
+ def _create_approval_notification(self, approval_role):
+ title = 'Warning'
+ message = f'Butuh approval sales untuk unreserved'
+ return self._create_notification_action(title, message)
+
+ def _create_notification_action(self, title, message):
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': { 'title': title, 'message': message, 'next': {'type': 'ir.actions.act_window_close'} },
+ }
def _compute_shipping_status(self):
for rec in self: