diff --git a/CHANGELOG b/CHANGELOG index 03993204df..f49246d2bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Show reconciled date on invoice * Make description on invoice line optional Version 4.6.0 - 2017-10-30 diff --git a/invoice.py b/invoice.py index 29977129fc..0ad1a488ef 100644 --- a/invoice.py +++ b/invoice.py @@ -179,7 +179,10 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): total_amount = fields.Function(fields.Numeric('Total', digits=(16, Eval('currency_digits', 2)), depends=['currency_digits']), 'get_amount', searcher='search_total_amount') - reconciled = fields.Function(fields.Boolean('Reconciled'), + reconciled = fields.Function(fields.Date('Reconciled', + states={ + 'invisible': ~Eval('reconciled'), + }), 'get_reconciled') lines_to_pay = fields.Function(fields.One2Many('account.move.line', None, 'Lines to Pay'), 'get_lines_to_pay') @@ -664,12 +667,13 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin): return result def get_reconciled(self, name): - if not self.lines_to_pay: - return False - for line in self.lines_to_pay: - if not line.reconciliation: - return False - return True + reconciliations = [l.reconciliation for l in self.lines_to_pay] + if not reconciliations: + return None + elif not all(reconciliations): + return None + else: + return max(r.date for r in reconciliations) @classmethod def get_lines_to_pay(cls, invoices, name): diff --git a/tests/scenario_invoice.rst b/tests/scenario_invoice.rst index 3b7479d5ee..e04bf5c2fa 100644 --- a/tests/scenario_invoice.rst +++ b/tests/scenario_invoice.rst @@ -189,6 +189,8 @@ Credit invoice with refund:: >>> invoice.reload() >>> invoice.state u'paid' + >>> invoice.reconciled == today + True >>> receivable.reload() >>> receivable.debit Decimal('240.00') diff --git a/tests/scenario_invoice_supplier.rst b/tests/scenario_invoice_supplier.rst index 9c0c213e0b..08b3a56d0c 100644 --- a/tests/scenario_invoice_supplier.rst +++ b/tests/scenario_invoice_supplier.rst @@ -195,7 +195,6 @@ Cancel draft invoice:: u'cancel' >>> invoice_draft.move >>> invoice_draft.reconciled - False Cancel posted invoice:: @@ -204,5 +203,5 @@ Cancel posted invoice:: u'cancel' >>> invoice.cancel_move is not None True - >>> invoice.reconciled + >>> invoice.reconciled == today True diff --git a/view/invoice_form.xml b/view/invoice_form.xml index 817b7ae3c0..17f7ee7bae 100644 --- a/view/invoice_form.xml +++ b/view/invoice_form.xml @@ -34,7 +34,7 @@ this repository contains the full copyright notices and license terms. -->