diff --git a/sale_invoice_plan/models/sale.py b/sale_invoice_plan/models/sale.py
index 21e2aad54d96..29d61244201c 100644
--- a/sale_invoice_plan/models/sale.py
+++ b/sale_invoice_plan/models/sale.py
@@ -33,6 +33,45 @@ class SaleOrder(models.Model):
compute="_compute_invoice_plan_total",
string="Total Amount",
)
+ next_installment_date = fields.Date(
+ compute="_compute_next_installment_date",
+ store=True,
+ )
+ invoiced_installment_amount = fields.Monetary(
+ compute="_compute_invoiced_installment_amount",
+ store=True,
+ )
+ pending_installment_amount = fields.Monetary(
+ compute="_compute_pending_installment_amount",
+ store=True,
+ )
+
+ @api.depends("invoice_plan_ids")
+ def _compute_next_installment_date_amount(self):
+ for rec in self:
+ plans_to_invoice = rec.invoice_plan_ids.filtered(lambda x: x.to_invoice)
+ if plans_to_invoice:
+ rec.next_installment_date = plans_to_invoice[0].plan_date
+ else:
+ rec.next_installment_date = False
+
+ @api.depends("invoice_plan_ids")
+ def _compute_invoiced_installment_amount(self):
+ for rec in self:
+ invoiced_plans = rec.invoice_plan_ids.filtered(lambda x: x.invoiced)
+ if invoiced_plans:
+ rec.invoiced_installment_amount = invoiced_plans[-1].amount_invoiced
+ else:
+ rec.invoiced_installment_amount = 0
+
+ @api.depends("invoice_plan_ids")
+ def _compute_pending_installment_amount(self):
+ for rec in self:
+ plans_to_invoice = rec.invoice_plan_ids.filtered(lambda x: x.to_invoice)
+ if plans_to_invoice:
+ rec.pending_installment_amount = plans_to_invoice[0].amount
+ else:
+ rec.pending_installment_amount = 0
@api.depends("invoice_plan_ids")
def _compute_invoice_plan_total(self):
diff --git a/sale_invoice_plan/views/sale_view.xml b/sale_invoice_plan/views/sale_view.xml
index 869303e55244..e9d09eed0695 100644
--- a/sale_invoice_plan/views/sale_view.xml
+++ b/sale_invoice_plan/views/sale_view.xml
@@ -121,6 +121,57 @@
+
+ view.order.tree.invoice.plan
+ sale.order
+
+
+
+
+
+
+
+
+
+
+ view.order.search.invoice.plan
+ sale.order
+
+
+
+
+
+
+
+
+
+
+
view.sale.invoice.plan.filter
diff --git a/sale_invoice_plan/wizard/sale_make_planned_invoice_view.xml b/sale_invoice_plan/wizard/sale_make_planned_invoice_view.xml
index 652d5e084a2a..dde644c247f5 100644
--- a/sale_invoice_plan/wizard/sale_make_planned_invoice_view.xml
+++ b/sale_invoice_plan/wizard/sale_make_planned_invoice_view.xml
@@ -27,7 +27,7 @@
- Invoice Order
+ Invoice Installments
ir.actions.act_window
sale.make.planned.invoice
form