summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-07-09 08:58:47 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-07-09 08:58:47 +0700
commit3df2346732b38eb47accfb07d3dfb0feaab65854 (patch)
tree604ff5f1badc65cd5e5c6079b0f283760fb9ad67 /indoteknik_custom/models
parent1a3b0976b06543a9b107897a906dc50a8bf9c3d2 (diff)
cr approval payment terms
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/approval_payment_term.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py
index 4cd9ea36..291e8e37 100644
--- a/indoteknik_custom/models/approval_payment_term.py
+++ b/indoteknik_custom/models/approval_payment_term.py
@@ -33,6 +33,13 @@ class ApprovalPaymentTerm(models.Model):
approve_date = fields.Datetime('Approve Date')
state = fields.Selection([('waiting_approval', 'Waiting Approval'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='waiting_approval', tracking=True)
reason_reject = fields.Selection([('reason1', 'Reason 1'), ('reason2', 'Reason 2'), ('reason3', 'Reason 3')], string='Reason Reject', tracking=True)
+ sale_order_id = fields.Many2one('sale.order', string='Sale Order', copy=False, tracking=True)
+ total = fields.Float(string='Total', compute='_compute_total')
+
+ @api.depends('sale_order_id')
+ def _compute_total(self):
+ for rec in self:
+ rec.total = rec.sale_order_id.amount_total
@api.constrains('partner_id')
@@ -48,11 +55,11 @@ class ApprovalPaymentTerm(models.Model):
user = self.env.user
is_it = user.has_group('indoteknik_custom.group_role_it')
- if (not user.id ==7 and user.id == 19) or is_it:
+ if (not user.id ==7 and user.id == 19 and not self.approve_sales_manager) or is_it:
self.approve_sales_manager = True
return
- if (not user.id ==7 and user.id == 688) or is_it:
+ if (not user.id ==7 and user.id == 688 and not self.approve_finance) or is_it:
self.approve_finance = True
return