summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-03-06 10:40:10 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-03-06 10:40:10 +0700
commitd569804844ee77f9f08879dda8c3f1e292470813 (patch)
treebe8357933ccd751700cbecd00b92c30100b25e7f /indoteknik_custom/models
parentf53312f3f2c78d50d838c249a8d0eb1ed1e5b7f2 (diff)
Add action web approve on sale order, approval_step on get so api, role aliases on login
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/sale_order.py15
1 files changed, 14 insertions, 1 deletions
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'},
+ }
+ }