|
|
@ -24,38 +24,6 @@ from tools.translate import _ |
|
|
|
|
|
|
|
class common_report_header(object): |
|
|
|
|
|
|
|
def _sum_debit(self, period_id=False, journal_id=False): |
|
|
|
if journal_id and isinstance(journal_id, int): |
|
|
|
journal_id = [journal_id] |
|
|
|
if period_id and isinstance(period_id, int): |
|
|
|
period_id = [period_id] |
|
|
|
if not journal_id: |
|
|
|
journal_id = self.journal_ids |
|
|
|
if not period_id: |
|
|
|
period_id = self.period_ids |
|
|
|
if not (period_id and journal_id): |
|
|
|
return 0.0 |
|
|
|
self.cr.execute('SELECT SUM(debit) FROM account_move_line l ' |
|
|
|
'WHERE period_id IN %s AND journal_id IN %s ' + self.query_get_clause + ' ', |
|
|
|
(tuple(period_id), tuple(journal_id))) |
|
|
|
return self.cr.fetchone()[0] or 0.0 |
|
|
|
|
|
|
|
def _sum_credit(self, period_id=False, journal_id=False): |
|
|
|
if journal_id and isinstance(journal_id, int): |
|
|
|
journal_id = [journal_id] |
|
|
|
if period_id and isinstance(period_id, int): |
|
|
|
period_id = [period_id] |
|
|
|
if not journal_id: |
|
|
|
journal_id = self.journal_ids |
|
|
|
if not period_id: |
|
|
|
period_id = self.period_ids |
|
|
|
if not (period_id and journal_id): |
|
|
|
return 0.0 |
|
|
|
self.cr.execute('SELECT SUM(credit) FROM account_move_line l ' |
|
|
|
'WHERE period_id IN %s AND journal_id IN %s '+ self.query_get_clause+'', |
|
|
|
(tuple(period_id), tuple(journal_id))) |
|
|
|
return self.cr.fetchone()[0] or 0.0 |
|
|
|
|
|
|
|
def _get_start_date(self, data): |
|
|
|
if data.get('form', False) and data['form'].get('date_from', False): |
|
|
|
return data['form']['date_from'] |
|
|
|