From d569804844ee77f9f08879dda8c3f1e292470813 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 6 Mar 2024 10:40:10 +0700 Subject: Add action web approve on sale order, approval_step on get so api, role aliases on login --- indoteknik_custom/models/sale_order.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 988f13c8..6fe1db3b 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -636,7 +636,20 @@ class SaleOrder(models.Model): line.discount = line.initial_discount line.initial_discount = False - + def action_web_approve(self): + if self.env.uid != self.partner_id.user_id.id: + raise UserError('You are not authorized to approve this order. Only %s can approve this order.' % self.partner_id.user_id.name) + + self.web_approval = 'company' + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Berhasil approve web order', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } -- cgit v1.2.3