From 101948d6029b06a69759b8f246f1744312f035c0 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Fri, 29 Aug 2025 10:52:19 +0700 Subject: (andri) add is locked CBD jika ada customer yang sudah jatuh tempo --- indoteknik_custom/models/account_move.py | 28 +++++++++++++++++++++++ indoteknik_custom/models/approval_payment_term.py | 3 ++- indoteknik_custom/models/res_partner.py | 15 ++++++++---- indoteknik_custom/models/sale_order.py | 9 ++++++++ indoteknik_custom/views/res_partner.xml | 1 + indoteknik_custom/views/sale_order.xml | 9 ++++++++ 6 files changed, 59 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index c44cad78..55e640e4 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -105,6 +105,34 @@ class AccountMove(models.Model): tracking=True ) + def _check_and_lock_cbd(self): + cbd_term = self.env['account.payment.term'].browse(26) + today = date.today() + + # Cari semua invoice overdue + overdue_invoices = self.search([ + ('move_type', '=', 'out_invoice'), + ('state', '=', 'posted'), + ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), + ('invoice_date_due', '!=', False), + ('invoice_date_due', '<=', today - timedelta(days=30)), + ], limit=3) + + _logger.info(f"Found {len(overdue_invoices)} overdue invoices for CBD lock check.") + _logger.info(f"Overdue Invoices: {overdue_invoices.mapped('name')}") + + # Ambil partner unik dari invoice + partners_to_lock = overdue_invoices.mapped('partner_id').filtered(lambda p: not p.is_cbd_locked) + _logger.info(f"Partners to lock: {partners_to_lock.mapped('name')}") + + # Lock hanya partner yang belum locked + if partners_to_lock: + partners_to_lock.write({ + 'is_cbd_locked': True, + 'property_payment_term_id': cbd_term.id, + }) + + def compute_partial_payment(self): for move in self: if move.amount_total_signed > 0 and move.amount_residual_signed > 0 and move.payment_state == 'partial': diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py index 8618856a..08d91738 100644 --- a/indoteknik_custom/models/approval_payment_term.py +++ b/indoteknik_custom/models/approval_payment_term.py @@ -171,7 +171,8 @@ class ApprovalPaymentTerm(models.Model): 'blocking_stage': self.blocking_stage, 'warning_stage': self.warning_stage, 'active_limit': self.active_limit, - 'property_payment_term_id': self.property_payment_term_id.id + 'property_payment_term_id': self.property_payment_term_id.id, + 'is_locked_cbd': False, }) self.approve_date = datetime.utcnow() self.state = 'approved' 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): diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index ffb53dce..992c1a5d 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -394,6 +394,15 @@ class SaleOrder(models.Model): ('paid', 'Full Paid'), ('no_invoice', 'No Invoice'), ], string="Payment Status Invoice", compute="_compute_payment_state_custom", store=False) + partner_is_cbd_locked = fields.Boolean( + string="Partner Locked CBD", + compute="_compute_partner_is_cbd_locked" + ) + + @api.depends('partner_id.is_cbd_locked') + def _compute_partner_is_cbd_locked(self): + for order in self: + order.partner_is_cbd_locked = order.partner_id.is_cbd_locked @api.depends('invoice_ids.payment_state', 'invoice_ids.amount_total', 'invoice_ids.amount_residual') def _compute_payment_state_custom(self): diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index ca1a36de..7541df35 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -21,6 +21,7 @@ + diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index a1a5e0cd..29d1a980 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -42,6 +42,15 @@ class="btn-primary" attrs="{'invisible': ['|', ('state', 'not in', ['sale', 'done']), ('has_refund', '=', True)]}" /> --> + + + +
-- cgit v1.2.3 From 4cdb3a7b89d5e93449fadafec015e80dad1cf47f Mon Sep 17 00:00:00 2001 From: AndriFP Date: Sat, 6 Sep 2025 14:04:27 +0700 Subject: (andri) add validasi di SO dan respartner --- indoteknik_custom/models/res_partner.py | 16 +++++++++------- indoteknik_custom/models/sale_order.py | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 80fe643b..b5ce9266 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -183,13 +183,6 @@ class ResPartner(models.Model): 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): @@ -201,6 +194,15 @@ class ResPartner(models.Model): default=_default_payment_term, tracking=3 ) + @api.constrains('property_payment_term_id', 'is_cbd_locked') + def _check_cbd_lock_partner(self): + cbd_term = self.env['account.payment.term'].browse(26) + for rec in self: + if rec.is_cbd_locked and rec.property_payment_term_id and rec.property_payment_term_id != cbd_term: + raise ValidationError( + "Partner ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." + ) + @api.depends("street", "street2", "city", "state_id", "country_id", "blok", "nomor", "rt", "rw", "kelurahan_id", "kecamatan_id") def _alamat_lengkap_text(self): diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 992c1a5d..8a595d8e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -404,6 +404,23 @@ class SaleOrder(models.Model): for order in self: order.partner_is_cbd_locked = order.partner_id.is_cbd_locked + @api.onchange('payment_term_id') + def _onchange_partner_payment_term(self): + cbd_term = self.env['account.payment.term'].browse(26) + for rec in self: + if rec.partner_id and rec.partner_id.is_cbd_locked and cbd_term: + rec.payment_term_id = cbd_term + + @api.constrains('payment_term_id', 'partner_id', 'state') + def _check_cbd_lock_sale_order(self): + cbd_term = self.env['account.payment.term'].browse(26) + for rec in self: + if rec.state == 'draft' and rec.partner_id.is_cbd_locked: + if rec.payment_term_id and rec.payment_term_id != cbd_term: + raise ValidationError( + "Customer ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." + ) + @api.depends('invoice_ids.payment_state', 'invoice_ids.amount_total', 'invoice_ids.amount_residual') def _compute_payment_state_custom(self): for order in self: -- cgit v1.2.3 From 1767a569e88e8254fdbefdfaf6be6045f1f5235f Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 11:45:39 +0700 Subject: apt request done --- indoteknik_custom/models/approval_payment_term.py | 4 ++-- indoteknik_custom/views/approval_payment_term.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py index 8618856a..85fd1613 100644 --- a/indoteknik_custom/models/approval_payment_term.py +++ b/indoteknik_custom/models/approval_payment_term.py @@ -69,8 +69,8 @@ class ApprovalPaymentTerm(models.Model): return res def _track_changes_for_user_688(self, vals, old_values_dict): - if self.env.user.id != 688: - return + # if self.env.user.id != 688: + # return tracked_fields = {"blocking_stage", "warning_stage", "property_payment_term_id"} diff --git a/indoteknik_custom/views/approval_payment_term.xml b/indoteknik_custom/views/approval_payment_term.xml index 5c130f3f..b0b99689 100644 --- a/indoteknik_custom/views/approval_payment_term.xml +++ b/indoteknik_custom/views/approval_payment_term.xml @@ -7,7 +7,7 @@ - + -- cgit v1.2.3 From e3c9d12ca2356493bb75c7362d0da54280889828 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 12:22:07 +0700 Subject: dunning done --- indoteknik_custom/models/dunning_run.py | 2 ++ indoteknik_custom/views/dunning_run.xml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 5a6aebac..eb6f06dc 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -31,6 +31,7 @@ class DunningRun(models.Model): description = fields.Char(string='Description') comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") + is_paid = fields.Boolean(string='Sudah Bayar?') def _compute_grand_total(self): for record in self: @@ -149,4 +150,5 @@ class DunningRunLine(models.Model): total_amt = fields.Float(string='Total Amount') open_amt = fields.Float(string='Open Amount') due_date = fields.Date(string='Due Date') + payment_term = fields.Many2one('account.payment.term', related='invoice_id.invoice_payment_term_id', string='Payment Term') diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index f624c42e..7623666b 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -25,6 +25,7 @@ + @@ -74,6 +75,7 @@ + -- cgit v1.2.3 From 32d0ca72aa38701747794dab06e7fb98b6f31489 Mon Sep 17 00:00:00 2001 From: AndriFP <113114423+andrifp@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:42:34 +0700 Subject: (andri) rev validasi --- indoteknik_custom/models/res_partner.py | 4 ++-- indoteknik_custom/models/sale_order.py | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index b5ce9266..0c932dbe 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -196,9 +196,9 @@ class ResPartner(models.Model): @api.constrains('property_payment_term_id', 'is_cbd_locked') def _check_cbd_lock_partner(self): - cbd_term = self.env['account.payment.term'].browse(26) + # cbd_term = self.env['account.payment.term'].browse(26) for rec in self: - if rec.is_cbd_locked and rec.property_payment_term_id and rec.property_payment_term_id != cbd_term: + if rec.is_cbd_locked: raise ValidationError( "Partner ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." ) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 8a595d8e..89bf0d25 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -404,22 +404,22 @@ class SaleOrder(models.Model): for order in self: order.partner_is_cbd_locked = order.partner_id.is_cbd_locked - @api.onchange('payment_term_id') - def _onchange_partner_payment_term(self): - cbd_term = self.env['account.payment.term'].browse(26) - for rec in self: - if rec.partner_id and rec.partner_id.is_cbd_locked and cbd_term: - rec.payment_term_id = cbd_term + # @api.onchange('payment_term_id') + # def _onchange_partner_payment_term(self): + # cbd_term = self.env['account.payment.term'].browse(26) + # for rec in self: + # if rec.partner_id and rec.partner_id.is_cbd_locked and cbd_term: + # rec.payment_term_id = cbd_term @api.constrains('payment_term_id', 'partner_id', 'state') def _check_cbd_lock_sale_order(self): - cbd_term = self.env['account.payment.term'].browse(26) + # cbd_term = self.env['account.payment.term'].browse(26) for rec in self: if rec.state == 'draft' and rec.partner_id.is_cbd_locked: - if rec.payment_term_id and rec.payment_term_id != cbd_term: - raise ValidationError( - "Customer ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." - ) + # if rec.payment_term_id and rec.payment_term_id != cbd_term: + raise ValidationError( + "Customer ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." + ) @api.depends('invoice_ids.payment_state', 'invoice_ids.amount_total', 'invoice_ids.amount_residual') def _compute_payment_state_custom(self): -- cgit v1.2.3 From 4ce4b37fa551e1059cdb5f64f98c53d4289d3268 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 16:04:39 +0700 Subject: dunning done --- indoteknik_custom/models/approval_payment_term.py | 3 ++- indoteknik_custom/models/dunning_run.py | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py index 85fd1613..61339b99 100644 --- a/indoteknik_custom/models/approval_payment_term.py +++ b/indoteknik_custom/models/approval_payment_term.py @@ -106,7 +106,8 @@ class ApprovalPaymentTerm(models.Model): if changes: timestamp = fields.Datetime.now().strftime('%Y-%m-%d %H:%M:%S') - rec.change_log_688 = f"{timestamp} - Perubahan oleh Widya:\n" + "\n".join(changes) + user = self.env.user + rec.change_log_688 = f"{timestamp} - Perubahan oleh {user.name}:\n" + "\n".join(changes) @staticmethod diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index eb6f06dc..40e5f71e 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -1,6 +1,6 @@ from odoo import models, api, fields from odoo.exceptions import AccessError, UserError, ValidationError -from datetime import timedelta +from datetime import timedelta, date import logging @@ -32,7 +32,17 @@ class DunningRun(models.Model): comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") is_paid = fields.Boolean(string='Sudah Bayar?') - + tanggal_pembayaran = fields.Date( + string='Tanggal Pembayaran', + compute="_compute_tanggal_pembayaran", + readonly=True, + ) + + @api.depends('is_paid') + def _compute_tanggal_pembayaran(self): + today = fields.Date.context_today(self) + for rec in self: + rec.tanggal_pembayaran = today if rec.is_paid else False def _compute_grand_total(self): for record in self: grand_total = 0 -- cgit v1.2.3 From 7887ebd226edebbb3261c802c38f0d0925a17f91 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 16:04:47 +0700 Subject: dunning done --- indoteknik_custom/views/dunning_run.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index 7623666b..7c5f4af6 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -76,6 +76,7 @@ + -- cgit v1.2.3 From 8aceb84b2cf029308903b39bfe139a05ea8f73f6 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 16:08:34 +0700 Subject: dunning done --- indoteknik_custom/models/dunning_run.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 40e5f71e..557eacef 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -43,6 +43,7 @@ class DunningRun(models.Model): today = fields.Date.context_today(self) for rec in self: rec.tanggal_pembayaran = today if rec.is_paid else False + def _compute_grand_total(self): for record in self: grand_total = 0 -- cgit v1.2.3 From e276a3bbf0a2726cbfa6bb5606d2dfbfe1e03143 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 18:34:49 +0700 Subject: Remove tanggal bayar and is paid --- indoteknik_custom/models/dunning_run.py | 12 ------------ indoteknik_custom/views/dunning_run.xml | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 557eacef..9feea1d1 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -31,18 +31,6 @@ class DunningRun(models.Model): description = fields.Char(string='Description') comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") - is_paid = fields.Boolean(string='Sudah Bayar?') - tanggal_pembayaran = fields.Date( - string='Tanggal Pembayaran', - compute="_compute_tanggal_pembayaran", - readonly=True, - ) - - @api.depends('is_paid') - def _compute_tanggal_pembayaran(self): - today = fields.Date.context_today(self) - for rec in self: - rec.tanggal_pembayaran = today if rec.is_paid else False def _compute_grand_total(self): for record in self: diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index 7c5f4af6..fbd9dc72 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -75,8 +75,7 @@ - - + -- cgit v1.2.3 From 6a56c1d6bfa09bf5f4d190e3f8fee5265aa01c3f Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 11 Sep 2025 08:12:13 +0700 Subject: remove is paid and tanggal bayar --- indoteknik_custom/models/dunning_run.py | 6 ------ indoteknik_custom/views/dunning_run.xml | 2 -- 2 files changed, 8 deletions(-) diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 557eacef..5dba3f7d 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -31,12 +31,6 @@ class DunningRun(models.Model): description = fields.Char(string='Description') comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") - is_paid = fields.Boolean(string='Sudah Bayar?') - tanggal_pembayaran = fields.Date( - string='Tanggal Pembayaran', - compute="_compute_tanggal_pembayaran", - readonly=True, - ) @api.depends('is_paid') def _compute_tanggal_pembayaran(self): diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index 7c5f4af6..1cac744a 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -75,8 +75,6 @@ - - -- cgit v1.2.3 From 6c9c60324674ce1a0b46a863a6ae0ca0e8042d2f Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 11 Sep 2025 09:17:17 +0700 Subject: remove tanggal bayar --- indoteknik_custom/models/dunning_run.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 5dba3f7d..9feea1d1 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -32,12 +32,6 @@ class DunningRun(models.Model): comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") - @api.depends('is_paid') - def _compute_tanggal_pembayaran(self): - today = fields.Date.context_today(self) - for rec in self: - rec.tanggal_pembayaran = today if rec.is_paid else False - def _compute_grand_total(self): for record in self: grand_total = 0 -- cgit v1.2.3 From 777f284f1811a3127d98cf5bb49934dc04e75002 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 11 Sep 2025 10:32:54 +0700 Subject: hide efaktur --- indoteknik_custom/views/dunning_run.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index 1cac744a..9c28591c 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -28,7 +28,7 @@ - + -- cgit v1.2.3 From d27561901fa2f0ab7534f255351e82459c6a531e Mon Sep 17 00:00:00 2001 From: AndriFP <113114423+andrifp@users.noreply.github.com> Date: Thu, 11 Sep 2025 10:45:58 +0700 Subject: (andri) fix --- indoteknik_custom/models/res_partner.py | 8 -------- indoteknik_custom/views/res_partner.xml | 2 +- indoteknik_custom/views/sale_order.xml | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 0c932dbe..36570e8f 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -194,14 +194,6 @@ class ResPartner(models.Model): default=_default_payment_term, tracking=3 ) - @api.constrains('property_payment_term_id', 'is_cbd_locked') - def _check_cbd_lock_partner(self): - # cbd_term = self.env['account.payment.term'].browse(26) - for rec in self: - if rec.is_cbd_locked: - raise ValidationError( - "Partner ini terkunci ke CBD, hanya boleh pakai Payment Term CBD." - ) @api.depends("street", "street2", "city", "state_id", "country_id", "blok", "nomor", "rt", "rw", "kelurahan_id", "kecamatan_id") diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 7541df35..7d5be3b7 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -108,7 +108,7 @@ - 0 + 1 1 diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 236a8b14..5f1a6117 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -47,7 +47,7 @@ -- cgit v1.2.3 From c5e14063c50ae06b829eca0415b9b14b03ccb0b6 Mon Sep 17 00:00:00 2001 From: AndriFP <113114423+andrifp@users.noreply.github.com> Date: Thu, 11 Sep 2025 11:07:29 +0700 Subject: (andri) fix --- indoteknik_custom/models/sale_order.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d0fd7f48..dbe6d789 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -403,12 +403,6 @@ class SaleOrder(models.Model): for order in self: order.partner_is_cbd_locked = order.partner_id.is_cbd_locked - # @api.onchange('payment_term_id') - # def _onchange_partner_payment_term(self): - # cbd_term = self.env['account.payment.term'].browse(26) - # for rec in self: - # if rec.partner_id and rec.partner_id.is_cbd_locked and cbd_term: - # rec.payment_term_id = cbd_term @api.constrains('payment_term_id', 'partner_id', 'state') def _check_cbd_lock_sale_order(self): -- cgit v1.2.3 From ee6c5f572f06e5fde497fc3aed5d78c3f0d7d389 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 11 Sep 2025 17:13:59 +0700 Subject: Gudang pameran --- indoteknik_custom/models/sale_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9952af9a..67e712d1 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -2115,8 +2115,8 @@ class SaleOrder(models.Model): if self.payment_term_id.id == 31 and self.total_percent_margin < 25: raise UserError("Jika ingin menggunakan Tempo 90 Hari maka margin harus di atas 25%") - if self.warehouse_id.id != 8 and self.warehouse_id.id != 10: # GD Bandengan - raise UserError('Gudang harus Bandengan') + if self.warehouse_id.id != 8 and self.warehouse_id.id != 10 and self.warehouse_id.id != 12: # GD Bandengan / Pameran + raise UserError('Gudang harus Bandengan atau Pameran') if self.state not in ['draft', 'sent']: raise UserError("Status harus draft atau sent") -- cgit v1.2.3 From 51e77c4968cbc0e577e161a38407bb9f291a6f62 Mon Sep 17 00:00:00 2001 From: AndriFP <113114423+andrifp@users.noreply.github.com> Date: Thu, 11 Sep 2025 18:43:25 +0700 Subject: (andri) fix --- indoteknik_custom/models/sale_order.py | 16 ++++++++-------- indoteknik_custom/views/sale_order.xml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 76d4d7e7..42f58d2b 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -393,15 +393,15 @@ class SaleOrder(models.Model): ('paid', 'Full Paid'), ('no_invoice', 'No Invoice'), ], string="Payment Status Invoice", compute="_compute_payment_state_custom", store=False) - partner_is_cbd_locked = fields.Boolean( - string="Partner Locked CBD", - compute="_compute_partner_is_cbd_locked" - ) + # partner_is_cbd_locked = fields.Boolean( + # string="Partner Locked CBD", + # compute="_compute_partner_is_cbd_locked" + # ) - @api.depends('partner_id.is_cbd_locked') - def _compute_partner_is_cbd_locked(self): - for order in self: - order.partner_is_cbd_locked = order.partner_id.is_cbd_locked + # @api.depends('partner_id.is_cbd_locked') + # def _compute_partner_is_cbd_locked(self): + # for order in self: + # order.partner_is_cbd_locked = order.partner_id.is_cbd_locked @api.constrains('payment_term_id', 'partner_id', 'state') diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 326fd560..542ffa0c 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -41,7 +41,7 @@ string="Refund" class="btn-primary" /> - +