From 919a02f01c6ec1efaa4bd4e1ddf1f6e253d5378a Mon Sep 17 00:00:00 2001 From: cbeddies Date: Thu, 9 Jan 2025 15:50:47 -0500 Subject: [PATCH] [UPD] osi_quote_downpayment: add safety code to method --- osi_quote_downpayment/models/account_move.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osi_quote_downpayment/models/account_move.py b/osi_quote_downpayment/models/account_move.py index bd6a87543..a9e25e2ef 100644 --- a/osi_quote_downpayment/models/account_move.py +++ b/osi_quote_downpayment/models/account_move.py @@ -12,12 +12,14 @@ def action_post(self): downpayment_lines = {} for rec in self: downpayment_lines[rec.id] = {} - for line in rec.invoice_line_ids: - if "Down payment" in line.name: - downpayment_lines[rec.id][line.id] = line.price_unit + if rec.invoice_line_ids: + for line in rec.invoice_line_ids: + if "Down payment" in line.name: + downpayment_lines[rec.id][line.id] = line.price_unit res = super().action_post() for rec in self: - for line in rec.invoice_line_ids: - if "Down payment" in line.name: - downpayment_lines[rec.id][line.id] = line.price_unit + if rec.invoice_line_ids: + for line in rec.invoice_line_ids: + if "Down payment" in line.name: + downpayment_lines[rec.id][line.id] = line.price_unit return res