From 39c95b7097f188350d71414c72f6abe7a711cf18 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 13 Nov 2025 15:12:09 +0700 Subject: (andri) fix sync janji bayar --- indoteknik_custom/models/account_move.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 684ef335..c460a332 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -161,7 +161,8 @@ class AccountMove(models.Model): def action_sync_promise_date(self): self.ensure_one() finance_user_ids = [688] - if self.env.user.id not in finance_user_ids: + is_it = self.env.user.has_group('indoteknik_custom.group_role_it') + if self.env.user.id not in finance_user_ids and not is_it: raise UserError('Hanya Finance (Widya) yang dapat menggunakan fitur ini.') if not self.customer_promise_date: raise UserError("Isi Janji Bayar terlebih dahulu sebelum melakukan sinkronisasi.") @@ -169,10 +170,11 @@ class AccountMove(models.Model): other_invoices = self.env['account.move'].search([ ('id', '!=', self.id), ('partner_id', '=', self.partner_id.id), - ('invoice_date_due', '=', self.invoice_date_due), + ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('move_type', '=', 'out_invoice'), ('state', '=', 'posted'), - ('date_terima_tukar_faktur', '!=', False) + ('date_terima_tukar_faktur', '!=', False), + ('invoice_payment_term_id.name', 'ilike', 'tempo') ]) lines = [] for inv in other_invoices: -- cgit v1.2.3