summaryrefslogtreecommitdiff
path: root/indoteknik_custom
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
parentf53312f3f2c78d50d838c249a8d0eb1ed1e5b7f2 (diff)
Add action web approve on sale order, approval_step on get so api, role aliases on login
Diffstat (limited to 'indoteknik_custom')
-rwxr-xr-xindoteknik_custom/models/sale_order.py15
-rwxr-xr-xindoteknik_custom/views/sale_order.xml6
2 files changed, 20 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'},
+ }
+ }
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 8e05c2e7..8e0c9bbe 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -16,10 +16,16 @@
type="object"
attrs="{'invisible': [('approval_status', 'in', ['pengajuan1', 'pengajuan2', 'approved'])]}"
/>
+ <button name="action_web_approve"
+ string="Web Approve"
+ type="object"
+ attrs="{'invisible': ['|', '|', ('create_uid', '!=', 25), ('web_approval', '!=', False), ('state', '!=', 'draft')]}"
+ />
<button name="indoteknik_custom.action_view_uangmuka_penjualan" string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
</button>
<field name="payment_term_id" position="after">
+ <field name="create_uid" invisible="1"/>
<field name="create_date" invisible="1"/>
<field name="shipping_cost_covered" attrs="{'required': ['|', ('create_date', '&gt;', '2023-06-15'), ('create_date', '=', False)]}"/>
<field name="shipping_paid_by" attrs="{'required': ['|', ('create_date', '&gt;', '2023-06-15'), ('create_date', '=', False)]}"/>