diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-30 14:08:26 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-30 14:08:26 +0700 |
| commit | 3b83868fbdb29e8f5208035e5166a13e5d24f382 (patch) | |
| tree | 437eae685994f9f85682fe53805a476b45164d6d /indoteknik_custom/models/stock_picking.py | |
| parent | e48193b793216a4ab82d88753ae144c08c3ddfaf (diff) | |
| parent | 5e1a6dc4d2bb04a36fcaef023fb9894336ebd4f6 (diff) | |
Merge branch 'unreserved_permission' into production
# Conflicts:
# indoteknik_custom/models/__init__.py
# indoteknik_custom/security/ir.model.access.csv
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 19 |
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: |
