diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-26 10:45:28 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-26 10:45:28 +0700 |
| commit | 28c6731e8ee1394f61ff88f2750f81d14eb5fb4e (patch) | |
| tree | 0904d4ffbfd0c0797e97a8ab18ed2f342ca3051c | |
| parent | 9c167425c8f5db32b1361b47570fc1fa5475e4e4 (diff) | |
change due date if tukar faktur
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 126ff4c3..fd9ed758 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -21,3 +21,14 @@ class AccountMove(models.Model): add_days += line.days due_date = tukar_date + timedelta(days=add_days) invoice.invoice_date_due = due_date + + @api.onchange('date_terima_tukar_faktur') + def change_date_terima_tukar_faktur(self): + for invoice in self: + tukar_date = invoice.date_terima_tukar_faktur + term = invoice.invoice_payment_term_id + add_days = 0 + for line in term.line_ids: + add_days += line.days + due_date = tukar_date + timedelta(days=add_days) + invoice.invoice_date_due = due_date |
