Set the overpaying statement line related_to type to account.invoice
We can infer that the extra amount will be used to pay another invoice so we might as well help a little bit the user to select the right one Closes #14683
This commit is contained in:
@@ -288,7 +288,10 @@ class Statement(Workflow, ModelSQL, ModelView, ChatMixin):
|
||||
except AttributeError:
|
||||
pass
|
||||
new_line.amount = line.amount + amount_to_pay
|
||||
new_line.invoice = None
|
||||
# As the line is overpaying an invoice we can assume
|
||||
# that the additional line will be used to pay an
|
||||
# invoice
|
||||
new_line.related_to = ('account.invoice', -1)
|
||||
line_offset += 1
|
||||
lines.insert(index + line_offset, new_line)
|
||||
invoice_id2amount_to_pay[line.invoice.id] = Decimal(0)
|
||||
|
||||
Reference in New Issue
Block a user