diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-02 09:44:39 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-10-02 09:44:39 +0700 |
| commit | 2739d3040a69228192096ee16373610149a2fb47 (patch) | |
| tree | 545aa797d7407e8f22250dff15648495b891928f /indoteknik_custom/models/stock_picking.py | |
| parent | 4d3d219b5f1002822a16067a28261fd59b170ff8 (diff) | |
| parent | 7d3780ede67579b5891218efc370dc82eef510a1 (diff) | |
Merge branch 'production' of https://bitbucket.org/altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index d16d508e..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: @@ -373,6 +388,9 @@ class StockPicking(models.Model): if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver: raise UserError("Harus di Approve oleh Logistik") + + if self.location_dest_id.id == 47 and not self.env.user.is_purchasing_manager: + raise UserError("Transfer ke gudang selisih harus di approve Rafly Hanggara") if self.group_id.sale_id: if self.group_id.sale_id.payment_link_midtrans: |
