diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-11-13 15:12:09 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-11-13 15:12:09 +0700 |
| commit | 39c95b7097f188350d71414c72f6abe7a711cf18 (patch) | |
| tree | 2e0894c65141271c4f58a74877bf0b825cb0125f | |
| parent | fad550a10bbbca3058d598878ff8e9a5366335a6 (diff) | |
(andri) fix sync janji bayar
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 8 |
1 files 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: |
