From eb91fb8b9cf3ebc68f6c609acbc85015ce902cab Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 5 Aug 2025 11:24:34 +0700 Subject: add payment date on invoices --- indoteknik_custom/models/account_move.py | 12 ++++++++++++ indoteknik_custom/views/account_move.xml | 1 + 2 files changed, 13 insertions(+) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 1a6fad1c..929af949 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -94,6 +94,18 @@ class AccountMove(models.Model): compute='_compute_has_refund_so', ) + payment_date = fields.Date(string="Payment Date", compute='_compute_payment_date') + + def _compute_payment_date(self): + for move in self: + accountPayment = self.env['account.payment'] + + payment = accountPayment.search([]).filtered( + lambda p: move.id in p.reconciled_invoice_ids.ids + ) + + move.payment_date = payment[0].date + # def name_get(self): # result = [] # for move in self: diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 9b1c791b..23f2d931 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -29,6 +29,7 @@ + -- cgit v1.2.3