diff --git a/CHANGELOG b/CHANGELOG
index f2c2c13fff..b7bcd9259e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Show reconciliation lines as payment lines
* Fill in origin of move line
* Remove partial payment when cancel
* Set cancel state when credit with refund
diff --git a/invoice.py b/invoice.py
index ce27b313c1..d6e9a12c51 100644
--- a/invoice.py
+++ b/invoice.py
@@ -205,6 +205,12 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
'readonly': Eval('state') != 'posted',
},
depends=['state', 'account', 'party', 'id', 'type', 'total_amount'])
+ reconciliation_lines = fields.Function(fields.Many2Many(
+ 'account.move.line', None, None, "Payment Lines",
+ states={
+ 'invisible': Eval('state') != 'paid',
+ }),
+ 'get_reconciliation_lines')
amount_to_pay_today = fields.Function(fields.Numeric('Amount to Pay Today',
digits=(16, Eval('currency_digits', 2)),
depends=['currency_digits']), 'get_amount_to_pay')
@@ -646,6 +652,17 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
lines[invoice_id].append(line_id)
return lines
+ def get_reconciliation_lines(self, name):
+ if self.state != 'paid':
+ return
+ lines = set()
+ for line in self.move.lines:
+ if line.account == self.account and line.reconciliation:
+ for line in line.reconciliation.lines:
+ if line not in self.move.lines:
+ lines.add(line)
+ return [l.id for l in sorted(lines, key=lambda l: l.date)]
+
@classmethod
def get_amount_to_pay(cls, invoices, name):
pool = Pool()
diff --git a/tests/scenario_invoice.rst b/tests/scenario_invoice.rst
index 784d086738..e747239911 100644
--- a/tests/scenario_invoice.rst
+++ b/tests/scenario_invoice.rst
@@ -306,6 +306,8 @@ Pay invoice::
>>> invoice.state
'paid'
+ >>> sorted(l.credit for l in invoice.reconciliation_lines)
+ [Decimal('1.00'), Decimal('20.00'), Decimal('99.00'), Decimal('120.00')]
Create empty invoice::
diff --git a/view/invoice_form.xml b/view/invoice_form.xml
index c09220efc6..be3450f487 100644
--- a/view/invoice_form.xml
+++ b/view/invoice_form.xml
@@ -79,6 +79,7 @@ this repository contains the full copyright notices and license terms. -->
+