summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/account_move.py8
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: