diff --git a/addons/account/project/wizard/account_analytic_balance_report.py b/addons/account/project/wizard/account_analytic_balance_report.py
index 25861c055b4..81d325ee8f5 100644
--- a/addons/account/project/wizard/account_analytic_balance_report.py
+++ b/addons/account/project/wizard/account_analytic_balance_report.py
@@ -38,7 +38,6 @@ class account_analytic_balance(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
- datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
index 436e46e949e..93208532e45 100644
--- a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
+++ b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
@@ -38,7 +38,6 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
- datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_report.py
index bbfc5d6e917..246f02c20dc 100644
--- a/addons/account/project/wizard/account_analytic_cost_ledger_report.py
+++ b/addons/account/project/wizard/account_analytic_cost_ledger_report.py
@@ -37,7 +37,6 @@ class account_analytic_cost_ledger(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
- datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.py b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
index 32f935a024b..2c9690fee50 100644
--- a/addons/account/project/wizard/account_analytic_inverted_balance_report.py
+++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
@@ -37,7 +37,6 @@ class account_analytic_inverted_balance(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
- datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
diff --git a/addons/account/project/wizard/account_analytic_journal_report.py b/addons/account/project/wizard/account_analytic_journal_report.py
index 59dd0361805..9a2eee020b1 100644
--- a/addons/account/project/wizard/account_analytic_journal_report.py
+++ b/addons/account/project/wizard/account_analytic_journal_report.py
@@ -37,7 +37,6 @@ class account_analytic_journal_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
- datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
diff --git a/addons/account/project/wizard/project_account_analytic_line.py b/addons/account/project/wizard/project_account_analytic_line.py
index e6be3bcffd3..e49fbe911cb 100644
--- a/addons/account/project/wizard/project_account_analytic_line.py
+++ b/addons/account/project/wizard/project_account_analytic_line.py
@@ -22,36 +22,36 @@ from osv import fields, osv
from tools.translate import _
class project_account_analytic_line(osv.osv_memory):
- _name = "project.account.analytic.line"
- _description = "Analytic Entries by line"
- _columns = {
- 'from_date': fields.date('From'),
+ _name = "project.account.analytic.line"
+ _description = "Analytic Entries by line"
+ _columns = {
+ 'from_date': fields.date('From'),
'to_date': fields.date('To'),
- }
+ }
- def action_open_window(self, cr, uid, ids, context=None):
- mod_obj =self.pool.get('ir.model.data')
- domain = []
- data = self.read(cr, uid, ids, [])[0]
- from_date = data['from_date']
- to_date = data['to_date']
- if from_date and to_date:
- domain = [('date','>=',from_date), ('date','<=',to_date)]
- elif from_date:
- domain = [('date','>=',from_date)]
- elif to_date:
- domain = [('date','<=',to_date)]
- result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
- id = result and result[1] or False
- return {
- 'name': _('Analytic Entries by line'),
- 'view_type': 'form',
- "view_mode": 'tree,form',
- 'res_model': 'account.analytic.line',
- 'type': 'ir.actions.act_window',
- 'domain': domain,
- 'search_view_id': id['res_id'],
- }
+ def action_open_window(self, cr, uid, ids, context=None):
+ mod_obj =self.pool.get('ir.model.data')
+ domain = []
+ data = self.read(cr, uid, ids, [])[0]
+ from_date = data['from_date']
+ to_date = data['to_date']
+ if from_date and to_date:
+ domain = [('date','>=',from_date), ('date','<=',to_date)]
+ elif from_date:
+ domain = [('date','>=',from_date)]
+ elif to_date:
+ domain = [('date','<=',to_date)]
+ result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
+ id = result and result[1] or False
+ return {
+ 'name': _('Analytic Entries by line'),
+ 'view_type': 'form',
+ "view_mode": 'tree,form',
+ 'res_model': 'account.analytic.line',
+ 'type': 'ir.actions.act_window',
+ 'domain': domain,
+ 'search_view_id': id['res_id'],
+ }
project_account_analytic_line()
diff --git a/addons/account/report/__init__.py b/addons/account/report/__init__.py
index d525d3a331b..7c09027f3ca 100644
--- a/addons/account/report/__init__.py
+++ b/addons/account/report/__init__.py
@@ -41,6 +41,7 @@ import account_entries_report
import account_analytic_entries_report
import account_balance_sheet
import account_profit_loss
+import account_treasury_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 80508ede44b..c3117e60379 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -88,10 +88,10 @@ class account_balance(report_sxw.rml_parse, common_report_header):
}
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
- if disp_acc == 'bal_movement':
+ if disp_acc == 'movement':
if not currency_obj.is_zero(self.cr, self.uid, currency, res['credit']) or not currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) or not currency_obj.is_zero(self.cr, self.uid, currency, res['balance']):
self.result_acc.append(res)
- elif disp_acc == 'bal_solde':
+ elif disp_acc == 'not_zero':
if not currency_obj.is_zero(self.cr, self.uid, currency, res['balance']):
self.result_acc.append(res)
else:
diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml
index 7c9aa13da2e..3d971862bdc 100644
--- a/addons/account/report/account_balance.rml
+++ b/addons/account/report/account_balance.rml
@@ -233,7 +233,7 @@
[[ get_fiscalyear(data) or '' ]]
|
- [[ (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']] |
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] |
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
diff --git a/addons/account/report/account_balance_landscape.py b/addons/account/report/account_balance_landscape.py
index a11d3bc285d..4e62a9777c9 100644
--- a/addons/account/report/account_balance_landscape.py
+++ b/addons/account/report/account_balance_landscape.py
@@ -98,7 +98,6 @@ class account_balance_landscape(report_sxw.rml_parse):
ref_bal='nothing'
- total_for_perc=[]
self.done_total=1
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
self.done_total=0
@@ -116,9 +115,7 @@ class account_balance_landscape(report_sxw.rml_parse):
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
- if self.done_total==1:
- self.done_total==1
- else:
+ if not self.done_total==1:
return [self.result_total]
accounts=[]
if not ids:
@@ -127,7 +124,6 @@ class account_balance_landscape(report_sxw.rml_parse):
return []
ctx = self.context.copy()
- result_total_parent=[]
for id in form['fiscalyear']:
tmp=[]
@@ -142,7 +138,7 @@ class account_balance_landscape(report_sxw.rml_parse):
accounts.append(tmp)
merged_accounts=zip(*accounts)
- # used to check for the frst record so all sum_credit and sum_debit r set to 0.00
+ # used to check for the frst record so all sum_credit and sum_debit r set to 0.00
if level==1:
doneAccount={}
for entry in merged_accounts:
@@ -345,7 +341,6 @@ class account_balance_landscape(report_sxw.rml_parse):
def get_lines(self, year_dict, form):
final_result = []
- line_l =[]
res = {}
line_l = self.lines(form)
self.cal_total(year_dict)
@@ -357,21 +352,21 @@ class account_balance_landscape(report_sxw.rml_parse):
res['level'] = l['level']
for k,v in l.items():
if k.startswith('debit'+str(year_dict['last_str'])):
- res['debit'] = v
+ res['debit'] = v
if k.startswith('credit'+str(year_dict['last_str'])):
- res['credit'] = v
+ res['credit'] = v
if k.startswith('balance'+str(year_dict['last_str'])) and not k.startswith('balance_perc'+str(year_dict['last_str'])):
- res['balance'] =v
+ res['balance'] =v
if k.startswith('balance_perc'+str(year_dict['last_str'])) and not k.startswith('balance'+str(year_dict['last_str'])):
- res['balance_perc'] = v
+ res['balance_perc'] = v
if form['compare_pattern'] == 'bal_perc':
if k.startswith('bal_perc'+str(year_dict['last_str'])):
- res['pattern'] = v
+ res['pattern'] = v
elif form['compare_pattern'] == 'bal_cash':
if k.startswith('bal_cash'+str(year_dict['last_str'])):
- res['pattern'] = v
+ res['pattern'] = v
else:
- res['pattern'] = ''
+ res['pattern'] = ''
final_result.append(res)
return final_result
diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py
index fa80ad96f3c..b1e51e6fc46 100644
--- a/addons/account/report/account_balance_sheet.py
+++ b/addons/account/report/account_balance_sheet.py
@@ -137,16 +137,17 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
'name': account.name,
'level': account.level,
'balance':account.balance,
+ 'type': account.type,
}
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += account.balance
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.balance
- if data['form']['display_account'] == 'bal_movement':
+ if data['form']['display_account'] == 'movement':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account_dict)
- elif data['form']['display_account'] == 'bal_solde':
+ elif data['form']['display_account'] == 'not_zero':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account_dict)
else:
@@ -163,10 +164,12 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
if i < len(cal_list['liability']) and i < len(cal_list['asset']):
temp={
+ 'type': cal_list['liability'][i]['type'],
'code': cal_list['liability'][i]['code'],
'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
+ 'type1': cal_list['asset'][i]['type'],
'code1': cal_list['asset'][i]['code'],
'name1': cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'],
@@ -176,10 +179,12 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
else:
if i < len(cal_list['asset']):
temp={
+ 'type': '',
'code': '',
'name': '',
'level': False,
'balance':False,
+ 'type1': cal_list['asset'][i]['type'],
'code1': cal_list['asset'][i]['code'],
'name1': cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'],
@@ -188,10 +193,12 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
self.result_temp.append(temp)
if i < len(cal_list['liability']):
temp={
+ 'type': cal_list['liability'][i]['type'],
'code': cal_list['liability'][i]['code'],
'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'],
+ 'type1': '',
'code1': '',
'name1': '',
'level1': False,
@@ -214,4 +221,4 @@ report_sxw.report_sxw('report.account.balancesheet', 'account.account',
'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal,
header='internal')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml
index 680c7d4bb43..205bfff497b 100644
--- a/addons/account/report/account_balance_sheet.rml
+++ b/addons/account/report/account_balance_sheet.rml
@@ -26,7 +26,6 @@
-
@@ -115,7 +114,7 @@
-
+
@@ -124,6 +123,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -174,7 +203,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']] |
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] |
[[ get_target_move(data) ]] |
@@ -187,35 +216,32 @@
- Assets
+ Assets
|
-
+
Code
|
- Assets
+ Account
|
Balance
|
-
-
- [[ repeatIn(get_lines_another('asset'), 'a') ]][[ a['code'] ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]
- |
-
- [[ '. '*(a['level']-1) ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]]
- |
-
- [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance'])) ]] [[ company.currency_id.symbol ]]
- |
+
+ [[ repeatIn(get_lines_another('asset'),'a' ) ]]
+ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
+ [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] |
+ [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] |
+ [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] |
+ [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] |
@@ -224,7 +250,7 @@
Balance:
- [[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]]
|
@@ -235,7 +261,7 @@
- Liabilities
+ Liabilities
|
@@ -245,22 +271,19 @@
Code
- Liabilities
+ Account
|
Balance
|
-
-
- [[ repeatIn(get_lines_another('liability'), 'a') ]][[ a['code'] ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]] [[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Bold_9'}) or removeParentNode('font') ]]
- |
-
- [[ '. '*(a['level']-1) ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]][[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Bold_9'}) or removeParentNode('font') ]]
- |
-
- [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance'])) ]] [[ company.currency_id.symbol ]][[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Right_9_Bold'}) or removeParentNode('font') ]]
- |
+
+ [[ repeatIn(get_lines_another('liability'),'a' ) ]]
+ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]]
+ [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] |
+ [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] |
+ [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] |
+ [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance']) ]] [[company.currency_id.symbol ]] |
@@ -269,7 +292,7 @@
Balance:
- [[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]]
|
diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml
index f9942c41b95..7e4f9f844a5 100644
--- a/addons/account/report/account_balance_sheet_horizontal.rml
+++ b/addons/account/report/account_balance_sheet_horizontal.rml
@@ -163,7 +163,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']] |
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] |
[[ get_target_move(data) ]] |
@@ -202,7 +202,7 @@
[[ '. '*(a['level1']-1) ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name1'] ]]
- [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance1'])) ]] [[ company.currency_id.symbol ]]
+ [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance1']) ]] [[ company.currency_id.symbol ]]
|
[[ repeatIn(get_lines(), 'a') ]] [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['code'] ]][[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Bold_9'}) or removeParentNode('font') ]]
@@ -213,7 +213,7 @@
|
[[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]]
[[ a['name']=='Net Profit' and setTag('para','para',{'style':'terp_default_Right_9_Bold'}) or removeParentNode('font') ]]
- [[(a['code'] and a['name']) and formatLang(abs(a['balance'])) or removeParentNode('font')]] [[ company.currency_id.symbol ]]
+ [[(a['code'] and a['name']) and formatLang(a['balance']) or removeParentNode('font')]] [[ company.currency_id.symbol ]]
|
@@ -223,13 +223,13 @@
Balance:
- [[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]]
|
Balance:
|
- [[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]]
|
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index 1047b9017d6..294c7fa99cf 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -40,9 +40,10 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
self.sortby = data['form'].get('sortby', 'sort_date')
self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{}))
ctx2 = data['form'].get('used_context',{}).copy()
- ctx2.update({'initial_bal': True})
+ self.init_balance = data['form'].get('initial_balance', True)
+ if self.init_balance:
+ ctx2.update({'initial_bal': True})
self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
- self.init_balance = data['form']['initial_balance']
self.display_account = data['form']['display_account']
self.target_move = data['form'].get('target_move', 'all')
ctx = self.context.copy()
@@ -116,10 +117,10 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
num_entry = self.cr.fetchone()[0] or 0
sold_account = self._sum_balance_account(child_account)
self.sold_accounts[child_account.id] = sold_account
- if self.display_account == 'bal_movement':
+ if self.display_account == 'movement':
if child_account.type != 'view' and num_entry <> 0:
res.append(child_account)
- elif self.display_account == 'bal_solde':
+ elif self.display_account == 'not_zero':
if child_account.type != 'view' and num_entry <> 0:
if not currency_obj.is_zero(self.cr, self.uid, currency, sold_account):
res.append(child_account)
diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml
index 22712af0f8c..ac100c3ecd0 100644
--- a/addons/account/report/account_general_ledger_landscape.rml
+++ b/addons/account/report/account_general_ledger_landscape.rml
@@ -395,7 +395,7 @@
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
- [[ (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']]
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']]
|
[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py
index 9c7cf014e4d..839c9b13043 100644
--- a/addons/account/report/account_invoice_report.py
+++ b/addons/account/report/account_invoice_report.py
@@ -47,7 +47,6 @@ class account_invoice_report(osv.osv):
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'user_id': fields.many2one('res.users', 'Salesman', readonly=True),
'price_total': fields.float('Total Without Tax', readonly=True),
- 'price_total_tax': fields.float('Total With Tax', readonly=True),
'price_average': fields.float('Average Price', readonly=True, group_operator="avg"),
'currency_rate': fields.float('Currency Rate', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
@@ -69,6 +68,7 @@ class account_invoice_report(osv.osv):
'address_contact_id': fields.many2one('res.partner.address', 'Contact Address Name', readonly=True),
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True),
'account_id': fields.many2one('account.account', 'Account',readonly=True),
+ 'account_line_id': fields.many2one('account.account', 'Account Line',readonly=True),
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
'residual': fields.float('Total Residual', readonly=True),
'delay_to_pay': fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
@@ -89,7 +89,7 @@ class account_invoice_report(osv.osv):
ai.payment_term as payment_term,
ai.period_id as period_id,
(case when u.uom_type not in ('reference') then
- (select name from product_uom where uom_type='reference' and category_id=u.category_id)
+ (select name from product_uom where uom_type='reference' and active and category_id=u.category_id LIMIT 1)
else
u.name
end) as uom_name,
@@ -106,44 +106,30 @@ class account_invoice_report(osv.osv):
ai.address_contact_id as address_contact_id,
ai.address_invoice_id as address_invoice_id,
ai.account_id as account_id,
+ ail.account_id as account_line_id,
ai.partner_bank_id as partner_bank_id,
sum(case when ai.type in ('out_refund','in_invoice') then
- ail.quantity / u.factor * -1
+ -ail.quantity / u.factor
else
ail.quantity / u.factor
end) as product_qty,
+
sum(case when ai.type in ('out_refund','in_invoice') then
- ail.quantity*ail.price_unit * -1
+ -ail.price_subtotal
else
- ail.quantity*ail.price_unit
+ ail.price_subtotal
end) / cr.rate as price_total,
- sum(case when ai.type in ('out_refund','in_invoice') then
- ai.amount_total * -1
- else
- ai.amount_total
- end) / (CASE WHEN
- (select count(l.id) from account_invoice_line as l
- left join account_invoice as a ON (a.id=l.invoice_id)
- where a.id=ai.id) <> 0
- THEN
- (select count(l.id) from account_invoice_line as l
- left join account_invoice as a ON (a.id=l.invoice_id)
- where a.id=ai.id)
- ELSE 1
- END) / cr.rate as price_total_tax,
+
(case when ai.type in ('out_refund','in_invoice') then
- sum(ail.quantity*ail.price_unit*-1)
+ sum(-ail.price_subtotal)
else
- sum(ail.quantity*ail.price_unit)
- end) / (CASE WHEN
- (case when ai.type in ('out_refund','in_invoice')
- then sum(ail.quantity/u.factor*-1)
- else sum(ail.quantity/u.factor) end) <> 0
- THEN
- (case when ai.type in ('out_refund','in_invoice')
- then sum(ail.quantity/u.factor*-1)
- else sum(ail.quantity/u.factor) end)
- ELSE 1
+ sum(ail.price_subtotal)
+ end) / (CASE WHEN sum(ail.quantity/u.factor) <> 0
+ THEN
+ (case when ai.type in ('out_refund','in_invoice')
+ then sum(-ail.quantity/u.factor)
+ else sum(ail.quantity/u.factor) end)
+ ELSE 1
END)
/ cr.rate as price_average,
@@ -159,22 +145,23 @@ class account_invoice_report(osv.osv):
left join account_invoice_line as l ON (a.id=l.invoice_id)
where a.id=ai.id)) as due_delay,
(case when ai.type in ('out_refund','in_invoice') then
- ai.residual * -1
+ -ai.residual
else
ai.residual
- end)/ (CASE WHEN
+ end)/ (CASE WHEN
(select count(l.id) from account_invoice_line as l
left join account_invoice as a ON (a.id=l.invoice_id)
- where a.id=ai.id) <> 0
+ where a.id=ai.id) <> 0
THEN
(select count(l.id) from account_invoice_line as l
left join account_invoice as a ON (a.id=l.invoice_id)
- where a.id=ai.id)
- ELSE 1
+ where a.id=ai.id)
+ ELSE 1
END) / cr.rate as residual
from account_invoice_line as ail
left join account_invoice as ai ON (ai.id=ail.invoice_id)
- left join product_template pt on (pt.id=ail.product_id)
+ left join product_product pr on (pr.id=ail.product_id)
+ left join product_template pt on (pt.id=pr.product_tmpl_id)
left join product_uom u on (u.id=ail.uos_id),
res_currency_rate cr
where cr.id in (select id from res_currency_rate cr2 where (cr2.currency_id = ai.currency_id)
@@ -202,6 +189,7 @@ class account_invoice_report(osv.osv):
ai.address_contact_id,
ai.address_invoice_id,
ai.account_id,
+ ail.account_id,
ai.partner_bank_id,
ai.residual,
ai.amount_total,
diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml
index 6c1bc3f9762..963c41b0a0f 100644
--- a/addons/account/report/account_invoice_report_view.xml
+++ b/addons/account/report/account_invoice_report_view.xml
@@ -27,12 +27,11 @@
+
-
-
@@ -103,6 +102,7 @@
+
@@ -120,6 +120,7 @@
+
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
index 187b9b2578f..fcc112d9d81 100644
--- a/addons/account/report/account_partner_balance.py
+++ b/addons/account/report/account_partner_balance.py
@@ -242,7 +242,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
- temp_res = 0.0
self.cr.execute(
"SELECT sum(debit) " \
"FROM account_move_line AS l " \
@@ -261,7 +260,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
- temp_res = 0.0
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line AS l " \
@@ -281,7 +279,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
- temp_res = 0.0
self.cr.execute(
"SELECT sum(debit-credit) " \
"FROM account_move_line AS l " \
@@ -295,7 +292,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
return temp_res
def _get_partners(self):
- cr, uid = self.cr, self.uid
if self.result_selection == 'customer':
return _('Receivable Accounts')
diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py
index 92d84e05c26..ca0515c9f08 100644
--- a/addons/account/report/account_partner_ledger.py
+++ b/addons/account/report/account_partner_ledger.py
@@ -23,6 +23,7 @@ import time
import re
from report import report_sxw
from common_report_header import common_report_header
+from tools.translate import _
class third_party_ledger(report_sxw.rml_parse, common_report_header):
@@ -53,15 +54,23 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
'get_target_move': self._get_target_move,
})
+ def _get_filter(self, data):
+ if data['form']['filter'] == 'unreconciled':
+ return _('Unreconciled Entries')
+ return super(third_party_ledger, self)._get_filter(data)
+
def set_context(self, objects, data, ids, report_type=None):
obj_move = self.pool.get('account.move.line')
obj_partner = self.pool.get('res.partner')
self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
ctx2 = data['form'].get('used_context',{}).copy()
- ctx2.update({'initial_bal': True})
- self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
- self.reconcil = data['form'].get('reconcil', True)
self.initial_balance = data['form'].get('initial_balance', True)
+ if self.initial_balance:
+ ctx2.update({'initial_bal': True})
+ self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
+ self.reconcil = True
+ if data['form']['filter'] == 'unreconciled':
+ self.reconcil = False
self.result_selection = data['form'].get('result_selection', 'customer')
self.amount_currency = data['form'].get('amount_currency', False)
self.target_move = data['form'].get('target_move', 'all')
@@ -118,7 +127,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
else:
amount = str(amount)
if (amount == '0'):
- return ' '
+ return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
@@ -169,7 +178,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
-
self.cr.execute(
"SELECT COALESCE(SUM(l.debit),0.0), COALESCE(SUM(l.credit),0.0), COALESCE(sum(debit-credit), 0.0) " \
"FROM account_move_line AS l, " \
@@ -402,14 +410,14 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
return currency_total
def _display_initial_balance(self, data):
- if self.initial_balance:
- return True
- return False
+ if self.initial_balance:
+ return True
+ return False
def _display_currency(self, data):
- if self.amount_currency:
- return True
- return False
+ if self.amount_currency:
+ return True
+ return False
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
'addons/account/report/account_partner_ledger.rml',parser=third_party_ledger,
diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml
index 69faa977da1..c1ef9b22502 100644
--- a/addons/account/report/account_partner_ledger.rml
+++ b/addons/account/report/account_partner_ledger.rml
@@ -355,7 +355,7 @@
Journal
|
- Filters By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+ Filters By [[ data['form']['filter'] not in ('filter_no','unreconciled') and get_filter(data) ]]
|
Partner's
@@ -377,7 +377,7 @@
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
|
- [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ data['form']['filter'] in ('filter_no','unreconciled') and get_filter(data) or removeParentNode('para') ]]
[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml
index 22942e15c78..2f58fc8ec95 100644
--- a/addons/account/report/account_partner_ledger_other.rml
+++ b/addons/account/report/account_partner_ledger_other.rml
@@ -356,7 +356,7 @@
Journal
|
- Filters By [[ get_filter(data)!='No Filter' and get_filter(data) ]]
+ Filters By [[ data['form']['filter'] not in ('filter_no','unreconciled') and get_filter(data) ]]
|
Partner's
@@ -378,7 +378,7 @@
[[', '.join([ lt or '' for lt in get_journal(data) ]) ]]
|
- [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ [[ data['form']['filter'] in ('filter_no','unreconciled') and get_filter(data) or removeParentNode('para') ]]
[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml
index ca444bb4eca..6c70bb47310 100644
--- a/addons/account/report/account_profit_horizontal.rml
+++ b/addons/account/report/account_profit_horizontal.rml
@@ -180,7 +180,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']] |
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] |
[[ get_target_move(data) ]] |
diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py
index b672c930f95..4c8896ee630 100644
--- a/addons/account/report/account_profit_loss.py
+++ b/addons/account/report/account_profit_loss.py
@@ -101,6 +101,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
cal_list = {}
account_id = data['form'].get('chart_account_id', False)
+ company_currency = account_pool.browse(self.cr, self.uid, account_id).company_id.currency_id
account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
@@ -110,18 +111,21 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
if (account.user_type.report_type) and (account.user_type.report_type == typ):
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
- self.result_sum_dr += abs(account.debit - account.credit)
+ self.result_sum_dr += account.debit - account.credit
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
- self.result_sum_cr += abs(account.debit - account.credit)
- if data['form']['display_account'] == 'bal_movement':
+ self.result_sum_cr += account.credit - account.debit
+ if data['form']['display_account'] == 'movement':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account)
- elif data['form']['display_account'] == 'bal_solde':
+ elif data['form']['display_account'] == 'not_zero':
if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance):
accounts_temp.append(account)
else:
accounts_temp.append(account)
- if self.result_sum_dr > self.result_sum_cr:
+ if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
+ self.res_pl['type'] = None
+ self.res_pl['balance'] = 0.0
+ elif self.result_sum_dr > self.result_sum_cr:
self.res_pl['type'] = _('Net Loss')
self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
else:
diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml
index 582885d89dc..2b29f479478 100644
--- a/addons/account/report/account_profit_loss.rml
+++ b/addons/account/report/account_profit_loss.rml
@@ -24,9 +24,8 @@
-
+
-
@@ -41,17 +40,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -136,7 +124,38 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -156,7 +175,7 @@
Chart of Account |
Fiscal Year |
Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] |
- Display Account |
+ Display Account |
Target Moves |
@@ -184,42 +203,33 @@
|
- [[ (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']] |
+ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] |
[[ get_target_move(data) ]] |
-
-
-
+ Expenses
Code
|
- Expenses
+ Account
|
Balance
|
-
-
-
- [[ repeatIn(get_lines_another('expense'),'a' ) ]] [[ a.code ]][[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]
-
- |
-
-
- [[ '. '*(a.level-1) ]][[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a.name ]]
-
- |
-
- [[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a.balance)) ]] [[ company.currency_id.symbol ]]
- |
+
+ [[ repeatIn(get_lines_another('expense'),'a' ) ]]
+ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
+ [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] |
+ [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] |
+ [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] |
+ [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] |
@@ -231,7 +241,7 @@
[[ final_result()['type'] == 'Net Profit' and final_result()['type'] or removeParentNode('blockTable') ]]
- [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance'])) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and company.currency_id.symbol ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(final_result()['balance']) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and company.currency_id.symbol ]]
|
@@ -241,7 +251,7 @@
Total:
- [[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_dr()) ]] [[ company.currency_id.symbol ]]
|
@@ -249,32 +259,26 @@
-
+ Incomes
+
Code
|
- Incomes
+ Account
|
Balance
|
-
-
-
- [[ repeatIn(get_lines_another('income'),'a') ]] [[ a.code ]][[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]]
-
- |
-
-
- [[ '. '*(a.level-1) ]][[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a.name ]]
-
- |
-
- [[ a.level<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a.balance)) ]] [[ company.currency_id.symbol ]]
- |
+
+ [[ repeatIn(get_lines_another('income'),'a' ) ]]
+ [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
+ [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] |
+ [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] |
+ [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] |
+ [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]] |
@@ -286,7 +290,7 @@
[[ final_result()['type'] == 'Net Loss' and final_result()['type'] or removeParentNode('blockTable') ]]
- [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(abs(final_result()['balance'])) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and company.currency_id.symbol ]]
+ [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(final_result()['balance']) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and company.currency_id.symbol ]]
|
@@ -296,7 +300,7 @@
Total:
- [[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]
+ [[ formatLang(sum_cr()) ]] [[ company.currency_id.symbol ]]
|
diff --git a/addons/account/report/account_report.py b/addons/account/report/account_report.py
index 8a77ce47280..6666b1ccd83 100644
--- a/addons/account/report/account_report.py
+++ b/addons/account/report/account_report.py
@@ -101,20 +101,20 @@ class report_aged_receivable(osv.osv):
def _calc_bal(self, cr, uid, ids, name, args, context=None):
res = {}
for period in self.read(cr, uid, ids, ['name'], context=context):
- date1,date2 = period['name'].split(' to ')
- cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
+ date1,date2 = period['name'].split(' to ')
+ cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
AND (COALESCE(line.date,date) BETWEEN %s AND %s) \
AND (reconcile_id IS NULL) AND ac.active",(str(date2),str(date1),))
- amount = cr.fetchone()
- amount = amount[0] or 0.00
- res[period['id']] = amount
+ amount = cr.fetchone()
+ amount = amount[0] or 0.00
+ res[period['id']] = amount
return res
_columns = {
'name': fields.char('Month Range', size=7, readonly=True),
- 'balance': fields.function(_calc_bal, method=True, string='Balance', readonly=True),
+ 'balance': fields.function(_calc_bal, string='Balance', readonly=True),
}
def init(self, cr, uid=1):
diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py
index 86d3128cfe7..56895987b45 100644
--- a/addons/account/report/account_tax_code.py
+++ b/addons/account/report/account_tax_code.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
diff --git a/addons/account/report/account_treasury_report.py b/addons/account/report/account_treasury_report.py
new file mode 100644
index 00000000000..fce3661b4c4
--- /dev/null
+++ b/addons/account/report/account_treasury_report.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import tools
+from osv import fields,osv
+import decimal_precision as dp
+
+class account_treasury_report(osv.osv):
+ _name = "account.treasury.report"
+ _description = "Treasury Analysis"
+ _auto = False
+
+ def _compute_balances(self, cr, uid, ids, field_names, arg=None, context=None,
+ query='', query_params=()):
+ all_treasury_lines = self.search(cr, uid, [], context=context)
+ all_companies = self.pool.get('res.company').search(cr, uid, [], context=context)
+ current_sum = dict((company, 0.0) for company in all_companies)
+ res = dict((id, dict((fn, 0.0) for fn in field_names)) for id in all_treasury_lines)
+ for record in self.browse(cr, uid, all_treasury_lines, context=context):
+ res[record.id]['starting_balance'] = current_sum[record.company_id.id]
+ current_sum[record.company_id.id] += record.balance
+ res[record.id]['ending_balance'] = current_sum[record.company_id.id]
+ return res
+
+ _columns = {
+ 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscalyear', readonly=True),
+ 'period_id': fields.many2one('account.period', 'Period', readonly=True),
+ 'debit': fields.float('Debit', readonly=True),
+ 'credit': fields.float('Credit', readonly=True),
+ 'balance': fields.float('Balance', readonly=True),
+ 'date': fields.date('Beginning of Period Date', readonly=True),
+ 'starting_balance': fields.function(_compute_balances, digits_compute=dp.get_precision('Account'), string='Starting Balance', multi='balance'),
+ 'ending_balance': fields.function(_compute_balances, digits_compute=dp.get_precision('Account'), string='Ending Balance', multi='balance'),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ }
+
+ _order = 'date asc'
+
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_treasury_report')
+ cr.execute("""
+ create or replace view account_treasury_report as (
+ select
+ p.id as id,
+ p.fiscalyear_id as fiscalyear_id,
+ p.id as period_id,
+ sum(l.debit) as debit,
+ sum(l.credit) as credit,
+ sum(l.debit-l.credit) as balance,
+ p.date_start as date,
+ am.company_id as company_id
+ from
+ account_move_line l
+ left join account_account a on (l.account_id = a.id)
+ left join account_move am on (am.id=l.move_id)
+ left join account_period p on (am.period_id=p.id)
+ where l.state != 'draft'
+ and a.type = 'liquidity'
+ group by p.id, p.fiscalyear_id, p.date_start, am.company_id
+ )
+ """)
+account_treasury_report()
diff --git a/addons/account/report/account_treasury_report_view.xml b/addons/account/report/account_treasury_report_view.xml
new file mode 100644
index 00000000000..eceb1e5c760
--- /dev/null
+++ b/addons/account/report/account_treasury_report_view.xml
@@ -0,0 +1,63 @@
+
+
+
+
+ account.treasury.report.tree
+ account.treasury.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.treasury.report.graph
+ account.treasury.report
+ graph
+
+
+
+
+
+
+
+
+ account.treasury.report.search
+ account.treasury.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+ Treasury Analysis
+ account.treasury.report
+ form
+ tree,graph
+
+
+ {'group_by':[], 'group_by_no_leaf':0}
+ From this view, have an analysis of your treasury. It sums the balance of every accounting entries made on liquidity accounts per period.
+
+
+
+
diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml
index b7271fec84b..5c4c9a0a525 100644
--- a/addons/account/security/account_security.xml
+++ b/addons/account/security/account_security.xml
@@ -2,14 +2,15 @@
- Accounting / Invoice
+ Accounting / Invoicing & Payments
-
Accounting / Accountant
+
Accounting / Manager
+
@@ -97,6 +98,13 @@
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+ Invoice Analysis multi-company
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+
Account fiscal Mapping company rule
diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv
index 1ab94806b63..cd945a2248d 100644
--- a/addons/account/security/ir.model.access.csv
+++ b/addons/account/security/ir.model.access.csv
@@ -37,6 +37,7 @@
"access_account_analytic_line_manager","account.analytic.line manager","model_account_analytic_line","account.group_account_manager",1,0,0,0
"access_account_analytic_account","account.analytic.account","analytic.model_account_analytic_account","base.group_user",1,0,0,0
"access_account_analytic_journal","account.analytic.journal","model_account_analytic_journal","account.group_account_user",1,0,0,0
+"access_account_analytic_journal_user","account.analytic.journal","model_account_analytic_journal","base.group_user",1,1,1,0
"access_account_invoice_uinvoice","account.invoice","model_account_invoice","account.group_account_invoice",1,1,1,1
"access_account_invoice_line_uinvoice","account.invoice.line","model_account_invoice_line","account.group_account_invoice",1,1,1,1
"access_account_invoice_tax_uinvoice","account.invoice.tax","model_account_invoice_tax","account.group_account_invoice",1,1,1,1
@@ -125,3 +126,5 @@
"access_account_invoice_tax_sale_manager","account.invoice.tax sale manager","model_account_invoice_tax","base.group_sale_salesman",1,0,0,0
"access_account_sequence_fiscal_year_sale_user","account.sequence.fiscalyear.sale.user","model_account_sequence_fiscalyear","base.group_sale_salesman",1,1,1,0
"access_account_sequence_fiscal_year_sale_manager","account.sequence.fiscalyear.sale.manager","model_account_sequence_fiscalyear","base.group_sale_manager",1,1,1,1
+"access_account_treasury_report_manager","account.treasury.report.manager","model_account_treasury_report","account.group_account_manager",1,0,0,0
+
diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py
index 009352aa7c9..eb4319a56b6 100644
--- a/addons/account/wizard/account_change_currency.py
+++ b/addons/account/wizard/account_change_currency.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index 89e28950535..927f895bb3b 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -103,6 +103,14 @@ class account_fiscalyear_close(osv.osv_memory):
if accnt_type_data.close_method=='none' or account.type == 'view':
continue
if accnt_type_data.close_method=='balance':
+ balance_in_currency = 0.0
+ if account.currency_id:
+ cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
+ 'WHERE account_id = %s ' \
+ 'AND ' + query_line + ' ' \
+ 'AND currency_id = %s', (account.id, account.currency_id.id))
+ balance_in_currency = cr.dictfetchone()['balance_in_currency']
+
if abs(account.balance)>0.0001:
obj_acc_move_line.create(cr, uid, {
'debit': account.balance>0 and account.balance,
@@ -111,7 +119,9 @@ class account_fiscalyear_close(osv.osv_memory):
'date': period.date_start,
'journal_id': new_journal.id,
'period_id': period.id,
- 'account_id': account.id
+ 'account_id': account.id,
+ 'currency_id': account.currency_id and account.currency_id.id or False,
+ 'amount_currency': balance_in_currency,
}, {'journal_id': new_journal.id, 'period_id':period.id})
if accnt_type_data.close_method == 'unreconciled':
offset = 0
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
index dec34e6e717..99aa83826df 100644
--- a/addons/account/wizard/account_move_journal.py
+++ b/addons/account/wizard/account_move_journal.py
@@ -78,7 +78,7 @@ class account_move_journal(osv.osv_memory):
@return: Returns a dict that contains definition for fields, views, and toolbars
"""
- res = super(account_move_journal, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
+ res = super(account_move_journal, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if not view_id:
return res
diff --git a/addons/account/wizard/account_move_journal_view.xml b/addons/account/wizard/account_move_journal_view.xml
index 24fe913d179..01795140c69 100644
--- a/addons/account/wizard/account_move_journal_view.xml
+++ b/addons/account/wizard/account_move_journal_view.xml
@@ -8,7 +8,7 @@
form
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
index b69c6d65d71..873ede3832c 100644
--- a/addons/account/wizard/account_report_balance_sheet.py
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -44,11 +44,11 @@ class account_bs_report(osv.osv_memory):
help='This Account is used for transfering Profit/Loss ' \
'(Profit: Amount will be added, Loss: Amount will be duducted), ' \
'which is calculated from Profilt & Loss Report',
- domain = [('type','=','payable')]),
+ domain = [('type','=','other')]),
}
_defaults={
- 'display_type': True,
+ 'display_type': False,
'journal_ids': [],
'reserve_account_id': _get_def_reserve_account,
}
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 42153c096e6..7aa4c465e0d 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -56,7 +56,7 @@ class account_common_report(osv.osv_memory):
return res
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None):
- res = {}
+ res = {'value': {}}
if filter == 'filter_no':
res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False}
if filter == 'filter_date':
@@ -68,7 +68,7 @@ class account_common_report(osv.osv_memory):
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
- ORDER BY p.date_start ASC
+ ORDER BY p.date_start ASC, p.special ASC
LIMIT 1) AS period_start
UNION
SELECT * FROM (SELECT p.id
diff --git a/addons/account/wizard/account_report_common_account.py b/addons/account/wizard/account_report_common_account.py
index 0040d563bdd..4e0fe2d6c66 100644
--- a/addons/account/wizard/account_report_common_account.py
+++ b/addons/account/wizard/account_report_common_account.py
@@ -26,13 +26,13 @@ class account_common_account_report(osv.osv_memory):
_description = 'Account Common Account Report'
_inherit = "account.common.report"
_columns = {
- 'display_account': fields.selection([('bal_all','All'), ('bal_movement','With movements'),
- ('bal_solde','With balance is not equal to 0'),
+ 'display_account': fields.selection([('all','All'), ('movement','With movements'),
+ ('not_zero','With balance is not equal to 0'),
],'Display Accounts', required=True),
}
_defaults = {
- 'display_account': 'bal_all',
+ 'display_account': 'movement',
}
def pre_print_report(self, cr, uid, ids, data, context=None):
diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py
index 1e17a66dd85..ed75b3c1dce 100644
--- a/addons/account/wizard/account_report_general_ledger.py
+++ b/addons/account/wizard/account_report_general_ledger.py
@@ -28,8 +28,8 @@ class account_report_general_ledger(osv.osv_memory):
_columns = {
'landscape': fields.boolean("Landscape Mode"),
- 'initial_balance': fields.boolean("Include Initial Balances",
- help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
+ 'initial_balance': fields.boolean('Include Initial Balances',
+ help='If you selected to filter by date or period, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.'),
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort by', required=True),
}
diff --git a/addons/account/wizard/account_report_general_ledger_view.xml b/addons/account/wizard/account_report_general_ledger_view.xml
index 671d66b81bb..b4203134fd6 100644
--- a/addons/account/wizard/account_report_general_ledger_view.xml
+++ b/addons/account/wizard/account_report_general_ledger_view.xml
@@ -17,10 +17,12 @@
-