diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py
index 21aa455b9c2..5a1b8ac868b 100644
--- a/addons/account/report/account_aged_partner_balance.py
+++ b/addons/account/report/account_aged_partner_balance.py
@@ -43,6 +43,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
'get_partners':self._get_partners,
'get_account': self._get_account,
'get_fiscalyear': self._get_fiscalyear,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
diff --git a/addons/account/report/account_aged_partner_balance.rml b/addons/account/report/account_aged_partner_balance.rml
index 143fbe0133e..8b8336d1c06 100644
--- a/addons/account/report/account_aged_partner_balance.rml
+++ b/addons/account/report/account_aged_partner_balance.rml
@@ -132,7 +132,7 @@
Analysis Direction
- Printing Date
+ Target Moves
|
@@ -155,7 +155,7 @@
[[ data['form']['direction_selection'] ]]
|
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True)]]
+ [[ get_target_move(data) ]]
|
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 5ada9adc4d8..236433819c5 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -47,6 +47,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
'get_journal': self._get_journal,
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
+ 'get_target_move': self._get_target_move,
})
self.context = context
diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml
index 45385827d96..277d568330c 100644
--- a/addons/account/report/account_balance.rml
+++ b/addons/account/report/account_balance.rml
@@ -223,7 +223,7 @@
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
- Printing Date
+ Target Moves
|
@@ -273,7 +273,7 @@
|
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True)]]
+ [[ get_target_move(data) ]]
|
diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py
index 9f6b924f4e0..5b612a4af53 100644
--- a/addons/account/report/account_balance_sheet.py
+++ b/addons/account/report/account_balance_sheet.py
@@ -56,7 +56,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
'get_company':self._get_company,
-
+ 'get_target_move': self._get_target_move,
})
self.context = context
diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml
index 8887fa49808..076de7bdcd4 100644
--- a/addons/account/report/account_balance_sheet.rml
+++ b/addons/account/report/account_balance_sheet.rml
@@ -159,7 +159,7 @@
Fiscal Year |
Filter By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]] |
Display Account |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -187,7 +187,7 @@
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml
index a1f7b25d379..08b9030a968 100644
--- a/addons/account/report/account_balance_sheet_horizontal.rml
+++ b/addons/account/report/account_balance_sheet_horizontal.rml
@@ -158,7 +158,7 @@
Fiscal Year |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Display Account |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -186,7 +186,7 @@
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py
index 36af31da363..bf5164253cc 100644
--- a/addons/account/report/account_central_journal.py
+++ b/addons/account/report/account_central_journal.py
@@ -48,12 +48,14 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
obj_move = self.pool.get('account.move.line')
new_ids = ids
self.query_get_clause = ''
+ self.target_move = data['form'].get('target_move', 'all')
if (data['model'] == 'ir.ui.menu'):
new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
self.query_get_clause = 'AND '
@@ -66,7 +68,14 @@ class journal_print(report_sxw.rml_parse, common_report_header):
return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
def lines(self, period_id, journal_id):
- self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit from account_move_line l LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id)WHERE l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code , a.currency_id,l.currency_id', (period_id, journal_id))
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit \
+ from account_move_line l \
+ LEFT JOIN account_move am ON (l.move_id=am.id) \
+ LEFT JOIN account_account a ON (l.account_id=a.id) \
+ LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code , a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id))
return self.cr.dictfetchall()
def _set_get_account_currency_code(self, account_id):
diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml
index 4bf23b3d4b6..1045470b2f2 100644
--- a/addons/account/report/account_central_journal.rml
+++ b/addons/account/report/account_central_journal.rml
@@ -240,7 +240,7 @@
Fiscal Year |
Journal |
Filter By [[get_filter(data)!='No Filter' and get_filter(data) ]] |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -268,7 +268,7 @@
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py
index e38f32ac217..e81bd994c0a 100644
--- a/addons/account/report/account_general_journal.py
+++ b/addons/account/report/account_general_journal.py
@@ -49,13 +49,15 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'get_journal': self._get_journal,
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
- 'display_currency':self._display_currency
+ 'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
obj_move = self.pool.get('account.move.line')
new_ids = ids
self.query_get_clause = ''
+ self.target_move = data['form'].get('target_move', 'all')
if (data['model'] == 'ir.ui.menu'):
new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
self.query_get_clause = 'AND '
@@ -82,14 +84,18 @@ class journal_print(report_sxw.rml_parse, common_report_header):
def lines(self, period_id):
if not self.journal_ids:
return []
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
self.cr.execute('SELECT j.code, j.name, l.amount_currency,c.code AS currency_code,l.currency_id , '
'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
'FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
'LEFT JOIN res_currency c on (l.currency_id=c.id)'
- 'WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' '
- 'GROUP BY j.id, j.code, j.name, l.amount_currency,c.code, l.currency_id ',
- (period_id, tuple(self.journal_ids)))
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' '
+ 'GROUP BY j.id, j.code, j.name, l.amount_currency, c.code, l.currency_id ',
+ (tuple(move_state), period_id, tuple(self.journal_ids)))
return self.cr.dictfetchall()
def _set_get_account_currency_code(self, account_id):
@@ -124,10 +130,14 @@ class journal_print(report_sxw.rml_parse, common_report_header):
journals = self.journal_ids
if not journals:
return 0.0
- self.cr.execute('SELECT SUM(debit) FROM account_move_line l '
- 'WHERE period_id=%s AND journal_id IN %s ' + self.query_get_clause + ' ' \
- 'AND state<>\'draft\'',
- (period_id, tuple(journals)))
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ self.cr.execute('SELECT SUM(l.debit) FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ' \
+ 'AND l.state<>\'draft\'',
+ (tuple(move_state), period_id, tuple(journals)))
return self.cr.fetchone()[0] or 0.0
def _sum_credit_period(self, period_id, journal_id=None):
@@ -135,12 +145,16 @@ class journal_print(report_sxw.rml_parse, common_report_header):
journals = [journal_id]
else:
journals = self.journal_ids
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
if not journals:
return 0.0
- self.cr.execute('SELECT SUM(credit) FROM account_move_line l '
- 'WHERE period_id=%s AND journal_id IN %s '+ self.query_get_clause + ' ' \
- 'AND state<>\'draft\'',
- (period_id, tuple(journals)))
+ self.cr.execute('SELECT SUM(l.credit) FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s '+ self.query_get_clause + ' ' \
+ 'AND l.state<>\'draft\'',
+ (tuple(move_state), period_id, tuple(journals)))
return self.cr.fetchone()[0] or 0.0
report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header='internal')
diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml
index 84a9ee6a780..489416adf76 100644
--- a/addons/account/report/account_general_journal.rml
+++ b/addons/account/report/account_general_journal.rml
@@ -226,7 +226,7 @@
Fiscal Year |
Journals |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -254,7 +254,7 @@
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index 80a7ff44f0e..f3ec97a592e 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -87,6 +87,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
'get_sortby': self._get_sortby,
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
+ 'get_target_move': self._get_target_move,
})
self.context = context
diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml
index 7ded26849bd..6ac6cd51286 100644
--- a/addons/account/report/account_general_ledger.rml
+++ b/addons/account/report/account_general_ledger.rml
@@ -196,7 +196,7 @@
Display Account |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Entries Sorted By |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -226,7 +226,7 @@
[[ get_sortby(data) ]] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml
index 1321bdea750..ee3d5a349a9 100644
--- a/addons/account/report/account_general_ledger_landscape.rml
+++ b/addons/account/report/account_general_ledger_landscape.rml
@@ -199,7 +199,7 @@
Display Account |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Entries Sorted By |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -230,7 +230,7 @@
[[ get_sortby(data) ]] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index ac41bf0b3fd..4f6ad99792d 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -49,6 +49,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'get_end_date':self._get_end_date,
'display_currency':self._display_currency,
'get_sortby': self._get_sortby,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml
index 5b7ebf78766..ba343f389b9 100644
--- a/addons/account/report/account_journal.rml
+++ b/addons/account/report/account_journal.rml
@@ -208,7 +208,7 @@
Journal |
Filters By |
Entries Sorted By |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or '' ]] |
@@ -237,7 +237,7 @@
[[ get_sortby(data) ]] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
index 7668a1ae2a6..06baa4639eb 100644
--- a/addons/account/report/account_partner_balance.py
+++ b/addons/account/report/account_partner_balance.py
@@ -49,6 +49,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
'get_start_period': self.get_start_period,
'get_end_period': self.get_end_period,
'get_partners':self._get_partners,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
diff --git a/addons/account/report/account_partner_balance.rml b/addons/account/report/account_partner_balance.rml
index eee31e87d6c..19eef489507 100644
--- a/addons/account/report/account_partner_balance.rml
+++ b/addons/account/report/account_partner_balance.rml
@@ -189,7 +189,7 @@
Journals |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Partner's |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -219,7 +219,7 @@
[[ get_partners() ]] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py
index 6ce8813fabb..3317c26de57 100644
--- a/addons/account/report/account_partner_ledger.py
+++ b/addons/account/report/account_partner_ledger.py
@@ -53,6 +53,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
'get_intial_balance':self._get_intial_balance,
'display_initial_balance':self._display_initial_balance,
'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
})
def set_context(self, objects, data, ids, report_type=None):
diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml
index 7de67780056..06c589d5569 100644
--- a/addons/account/report/account_partner_ledger.rml
+++ b/addons/account/report/account_partner_ledger.rml
@@ -230,7 +230,7 @@
Journal |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Partner's |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or '' ]] |
@@ -259,7 +259,7 @@
[[ get_partners() ]] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml
index 53cb0d46d83..f91f2ff41f5 100644
--- a/addons/account/report/account_partner_ledger_other.rml
+++ b/addons/account/report/account_partner_ledger_other.rml
@@ -368,7 +368,7 @@
Partner's
- Printing Date
+ Target Moves
|
@@ -421,7 +421,7 @@
[[ get_partners() ]]
|
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]]
+ [[ get_target_move(data) ]]
|
diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml
index d55b2e93a43..8c66f223df9 100644
--- a/addons/account/report/account_profit_horizontal.rml
+++ b/addons/account/report/account_profit_horizontal.rml
@@ -156,7 +156,7 @@
Fiscal Year |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Display Account |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -184,7 +184,7 @@
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py
index 6a6e0f3c2cc..84a7a4f8dbf 100644
--- a/addons/account/report/account_profit_loss.py
+++ b/addons/account/report/account_profit_loss.py
@@ -53,6 +53,7 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
'get_start_date':self._get_start_date,
'get_end_date':self._get_end_date,
'get_company':self._get_company,
+ 'get_target_move': self._get_target_move,
})
self.context = context
diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml
index 272945e658e..2d85dc590e6 100644
--- a/addons/account/report/account_profit_loss.rml
+++ b/addons/account/report/account_profit_loss.rml
@@ -157,7 +157,7 @@
Fiscal Year |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
Display Account |
- Printing Date |
+ Target Moves |
| [[ get_account(data) or removeParentNode('para') ]] |
@@ -185,7 +185,7 @@
[[ (data['form']['display_account']=='bal_all' and 'All') or (data['form']['display_account']=='bal_movement' and 'With movements') or 'With balance is not equal to 0']] |
- [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True) ]] |
+ [[ get_target_move(data) ]] |
diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py
index 3bce3c10ed0..35d0c1356ef 100644
--- a/addons/account/report/common_report_header.py
+++ b/addons/account/report/common_report_header.py
@@ -60,6 +60,13 @@ class common_report_header(object):
return data['form']['date_from']
return ''
+ def _get_target_move(self, data):
+ if data.get('form', False) and data['form'].get('target_move', False):
+ if data['form']['target_move'] == 'all':
+ return 'All Entries'
+ return 'All Posted Entries'
+ return ''
+
def _get_end_date(self, data):
if data.get('form', False) and data['form'].get('date_to', False):
return data['form']['date_to']