Browse Source

fixes

pull/365/head
Jordi Ballester 7 years ago
parent
commit
7b44969ad3
  1. 44
      bank_statement_reconciliation_summary/report/summary_report.py
  2. 1
      bank_statement_reconciliation_summary/report/summary_report.xml
  3. 2
      bank_statement_reconciliation_summary/wizard/bank_statement_reconciliation_summary_wizard.py
  4. 1
      bank_statement_reconciliation_summary/wizard/bank_statement_reconciliation_summary_wizard_view.xml

44
bank_statement_reconciliation_summary/report/summary_report.py

@ -10,46 +10,57 @@ class SummaryReport(models.AbstractModel):
_name = 'report.bank_statement_reconciliation_summary.summary_report'
@api.model
def _plus_outstanding_payments(self, journals, end_date):
def _plus_outstanding_payments(self, journals, start_date, end_date):
rec = {}
for journal in journals:
account_id = journal.default_debit_account_id.id
account_move_line_records = self.env['account.move.line'].search([
domain_search = [
('account_id', '=', account_id),
('reconciled', '=', False),
('account_id.reconcile', '=', False),
('credit', '>', 0.00),
('date', '<=', end_date),
], order='date')
]
if start_date:
domain_search += [('date', '>=', start_date)]
account_move_line_records = self.env['account.move.line'].search(
domain_search, order='date')
rec[journal.id] = account_move_line_records
return rec
@api.model
def _less_outstanding_receipts(self, journals, end_date):
def _less_outstanding_receipts(self, journals, start_date, end_date):
rec = {}
for journal in journals:
account_id = journal.default_debit_account_id.id
account_move_line_records = self.env['account.move.line'].search([
domain_search = [
('account_id', '=', account_id),
('reconciled', '=', False),
('account_id.reconcile', '=', False),
('debit', '>', 0.00),
('date', '<=', end_date),
], order='date')
]
if start_date:
domain_search += [('date', '>=', start_date)]
account_move_line_records = self.env['account.move.line'].search(
domain_search, order='date')
rec[journal.id] = account_move_line_records
return rec
@api.model
def _plus_unreconciled_statement_lines(self, journals, end_date):
def _plus_unreconciled_statement_lines(self, journals, start_date,
end_date):
rec = {}
for journal in journals:
domain_search = [
('date', '<=', end_date),
('journal_id', '=', journal.id),
('journal_entry_ids', '=', False)]
if start_date:
domain_search += [('date', '>=', start_date)]
statement_lines = self.env['account.bank.statement.line'].search(
[('date', '<=', end_date),
('journal_id', '=', journal.id)])
for line in statement_lines:
if not line.journal_entry_ids:
statement_lines += line
rec[journal.id] = statement_lines or False
domain_search)
rec[journal.id] = statement_lines
return rec
@api.model
@ -84,11 +95,14 @@ class SummaryReport(models.AbstractModel):
'docs': records,
'time': time,
'plus_outstanding_payments':
self._plus_outstanding_payments(records, data['end_date']),
self._plus_outstanding_payments(records, data['start_date'],
data['end_date']),
'less_outstanding_receipts':
self._less_outstanding_receipts(records, data['end_date']),
self._less_outstanding_receipts(records, data['start_date'],
data['end_date']),
'plus_unreconciled_statement_lines':
self._plus_unreconciled_statement_lines(records,
data['start_date'],
data['end_date']),
'bank_end_balance': self._get_bank_end_balance(
records, data['end_date']),

1
bank_statement_reconciliation_summary/report/summary_report.xml

@ -22,7 +22,6 @@
<div class='col-xs-3'><h4>Description</h4></div>
<div class='col-xs-3'><h4>Reference</h4></div>
<div class='col-xs-3 text-right'><h4>Amount</h4></div>
<div class='col-xs-3 text-right'><h4>Amount (foreign currency)</h4></div>
</div>
</div>
<div class='row mt16'>

2
bank_statement_reconciliation_summary/wizard/bank_statement_reconciliation_summary_wizard.py

@ -16,6 +16,7 @@ class BankReconciliationReportWizard(models.TransientModel):
('company_id', '=', self.env.user.company_id.id)], limit=1)
return journal
start_date = fields.Date()
end_date = fields.Date(
required=True,
default=fields.Date.context_today)
@ -35,6 +36,7 @@ class BankReconciliationReportWizard(models.TransientModel):
'docids': self.journal_id.ids,
'ids': self.journal_id.ids,
'end_date': self.end_date,
'start_date': self.start_date,
'balance_end_real': self.balance_end_real,
},
'context': self._context,

1
bank_statement_reconciliation_summary/wizard/bank_statement_reconciliation_summary_wizard_view.xml

@ -14,6 +14,7 @@
<field name="arch" type="xml">
<form string="Bank Reconciliation Report">
<group name="main">
<field name="start_date"/>
<field name="end_date"/>
<field name="journal_id"/>
<field name="balance_end_real"/>

Loading…
Cancel
Save