From f9874dc8419c35737fb96b8aa8480f0d60e47e1d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 12 Jul 2023 09:03:33 +0700 Subject: revisi due extension --- indoteknik_custom/models/account_move.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index c2e93632..0f021e6b 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -13,6 +13,8 @@ class AccountMove(models.Model): resi_tukar_faktur = fields.Char(string='Resi Faktur') date_terima_tukar_faktur = fields.Date(string='Terima Faktur') shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') + due_extension = fields.Integer(string='Due Extension', default=0) + new_due_date = fields.Date(string='New Due') def unlink(self): res = super(AccountMove, self).unlink() @@ -69,7 +71,10 @@ class AccountMove(models.Model): for invoice in self: invoice_day_to_due = 0 if invoice.payment_state not in ['paid', 'in_payment', 'reversed'] and invoice.invoice_date_due: - invoice_day_to_due = invoice.invoice_date_due - date.today() + if invoice.new_due_date: + invoice_day_to_due = invoice.new_due_date - date.today() + elif not invoice.new_due_date: + invoice_day_to_due = invoice.invoice_date_due - date.today() invoice_day_to_due = invoice_day_to_due.days invoice.invoice_day_to_due = invoice_day_to_due -- cgit v1.2.3 From 1cb23337a20a27977da5e9a72e6face949d5642c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 12 Jul 2023 14:53:05 +0700 Subject: Refactor due extension --- indoteknik_custom/models/account_move.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 0f021e6b..99439915 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -71,10 +71,9 @@ class AccountMove(models.Model): for invoice in self: invoice_day_to_due = 0 if invoice.payment_state not in ['paid', 'in_payment', 'reversed'] and invoice.invoice_date_due: + invoice_day_to_due = invoice.invoice_date_due - date.today() if invoice.new_due_date: invoice_day_to_due = invoice.new_due_date - date.today() - elif not invoice.new_due_date: - invoice_day_to_due = invoice.invoice_date_due - date.today() invoice_day_to_due = invoice_day_to_due.days invoice.invoice_day_to_due = invoice_day_to_due -- cgit v1.2.3