Change reconciled from Boolean to Date
It gives more information to show the date the invoice was paid. issue7014 review43831002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Show reconciled date on invoice
|
||||
* Make description on invoice line optional
|
||||
|
||||
Version 4.6.0 - 2017-10-30
|
||||
|
||||
+11
-7
@@ -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):
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,7 +34,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<group col="4" colspan="1" id="amount_state_buttons" yfill="1">
|
||||
<group col="2" colspan="2" id="reconciled_state" yfill="1">
|
||||
<label name="reconciled"/>
|
||||
<field name="reconciled" xexpand="0"/>
|
||||
<field name="reconciled"/>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user