|
@@ -281,6 +281,21 @@ class EiruAccountInterest(models.Model):
|
|
|
'amount_dicount': round(line['discount'],decimal_precision)
|
|
|
})
|
|
|
|
|
|
+ ''' Verify State interest '''
|
|
|
+ state = []
|
|
|
+ linesState = map(lambda x: x.state, accountInterest.lines_ids)
|
|
|
+
|
|
|
+ if (('discount'in linesState) or ('paid' in linesState)):
|
|
|
+ state ={ 'state': 'lines_paid'}
|
|
|
+
|
|
|
+ if (accountInterest.invoice_id.state == 'paid'):
|
|
|
+ state ={ 'state': 'paid'}
|
|
|
+
|
|
|
+ if (('invoiced' in linesState) or ('invoice_cancel' in linesState) or ('invoice_draft' in linesState) or ('open' in linesState)):
|
|
|
+ state ={'state': 'lines_open'}
|
|
|
+
|
|
|
+ if (state):
|
|
|
+ accountInterest.write(state)
|
|
|
|
|
|
return {
|
|
|
'state': True,
|