diff options
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 15 |
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'}, + } + } |
