summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/res_partner.py
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-08-29 10:52:19 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-08-29 10:52:19 +0700
commit101948d6029b06a69759b8f246f1744312f035c0 (patch)
treec3f181d9dee63064ce092a1bf2f0cb3fb406aa65 /indoteknik_custom/models/res_partner.py
parent0112ac064a7484685119cf9371ffbea32de6fd59 (diff)
(andri) add is locked CBD jika ada customer yang sudah jatuh tempo
Diffstat (limited to 'indoteknik_custom/models/res_partner.py')
-rw-r--r--indoteknik_custom/models/res_partner.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index 148a3fd0..017be730 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -1,6 +1,6 @@
from odoo import models, fields, api
from odoo.exceptions import UserError, ValidationError
-from datetime import datetime
+from datetime import datetime, timedelta
from odoo.http import request
import re
import requests
@@ -181,10 +181,15 @@ class ResPartner(models.Model):
payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3)
payment_history_url = fields.Text(string='Payment History URL')
- # no compute
- # payment_diff = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3)
-
- # tidak terpakai
+ is_cbd_locked = fields.Boolean("Locked to CBD?", default=False, tracking=True, help="Jika dicentang, maka partner ini terkunci pada payment term CBD karena memiliki invoice yang sudah jatuh tempo lebih dari 30 hari.")
+
+ # centang manual is_cbd_locked jika payment term diubah ke CBD
+ @api.onchange('is_cbd_locked')
+ def _onchange_is_cbd_locked(self):
+ if self.is_cbd_locked:
+ cbd_term = self.env['account.payment.term'].browse(26)
+ if cbd_term:
+ self.property_payment_term_id = cbd_term.id
@api.model
def _default_payment_term(self):