From 41c55dd0de31aa047ec9d9dba2eab0a5643d60dc Mon Sep 17 00:00:00 2001 From: Najlaa Date: Wed, 29 Oct 2008 16:27:44 +0100 Subject: [PATCH 1/5] skip create action for documentics menu bzr revid: nel@silver-20081029152744-1kbdglu78vrzyf1r --- addons/crm_configuration/crm_config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/crm_configuration/crm_config.py b/addons/crm_configuration/crm_config.py index e04b5d8825f..367f906da00 100644 --- a/addons/crm_configuration/crm_config.py +++ b/addons/crm_configuration/crm_config.py @@ -103,6 +103,8 @@ class crm_menu_config_wizard(osv.osv_memory): for section in res : if res[section]: file_name = 'crm_'+section+'_menu.xml' + if section=='document_ics': + continue try: tools.convert_xml_import(cr, 'crm_configuration', tools.file_open(os.path.join('crm_configuration',file_name )), {}, 'init', *args) except Exception, e: From a9564f2c62706396200a7da98c7bf6d5612f35b9 Mon Sep 17 00:00:00 2001 From: Najlaa Date: Wed, 29 Oct 2008 17:17:12 +0100 Subject: [PATCH 2/5] add warnings on profile manufacturing bzr revid: nel@silver-20081029161712-f24161cu8ohynq4a --- addons/profile_manufacturing/profile_manufacturing.py | 2 ++ addons/profile_manufacturing/profile_manufacturing.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/addons/profile_manufacturing/profile_manufacturing.py b/addons/profile_manufacturing/profile_manufacturing.py index 9a2c37d3691..80b263e88f2 100644 --- a/addons/profile_manufacturing/profile_manufacturing.py +++ b/addons/profile_manufacturing/profile_manufacturing.py @@ -72,6 +72,8 @@ class profile_manufacturing_config_install_modules_wizard(osv.osv_memory): help="This module allows you to manage a Portal system."), 'mrp_subproduct': fields.boolean('Mrp Sub Product', help="This module allows you to add sub poducts in mrp bom."), + 'warning': fields.boolean('Warning', + help="Able you to set warnings on products and partners."), 'board_document':fields.boolean('Document Management', help= "The Document Management System of Open ERP allows you to store, browse, automatically index, search and preview all kind of documents (internal documents, printed reports, calendar system). It opens an FTP access for the users to easily browse association's document."), diff --git a/addons/profile_manufacturing/profile_manufacturing.xml b/addons/profile_manufacturing/profile_manufacturing.xml index f550935bc15..54fd5162705 100644 --- a/addons/profile_manufacturing/profile_manufacturing.xml +++ b/addons/profile_manufacturing/profile_manufacturing.xml @@ -19,6 +19,7 @@ + From 049ff01b392c865e99df48febe9638fcbdd900e7 Mon Sep 17 00:00:00 2001 From: Najlaa Date: Thu, 30 Oct 2008 09:09:11 +0100 Subject: [PATCH 3/5] account balance, blockstyles still missing bzr revid: nel@silver-20081030080911-s3fexcdrk16yddyo --- addons/account/report/account_balance.py | 3 + addons/account/report/account_balance.rml | 102 +++++++++++----------- addons/crm_configuration/__terp__.py | 2 +- 3 files changed, 53 insertions(+), 54 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 65f8aae76db..5aaf0c63e0a 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -163,6 +163,7 @@ class account_balance(report_sxw.rml_parse): 'credit1':'', 'balance1' :'', 'id' : account.id, + 'type' : account.type, 'code': account.code, 'name': account.name, 'level': level, @@ -172,6 +173,7 @@ class account_balance(report_sxw.rml_parse): 'leef': not bool(account.child_id), 'bal_type':'', } + print ">>>",res['type'] self.sum_debit += account.debit self.sum_credit += account.credit if not (res['credit'] or res['debit']) and not account.child_id: @@ -226,6 +228,7 @@ class account_balance(report_sxw.rml_parse): for r in res: sum = r['debit1'] - r['credit1'] r['balance1'] = sum + r['type']= '' r['id'] ='' r['code']= '' r['name']='' diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index d42e96710c6..6272d775d21 100755 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -76,7 +76,7 @@ - + @@ -108,33 +108,37 @@ + fontSize="4.5" /> + fontSize="5.0" /> + fontSize="5.5" /> + fontName="Helvetica" + fontSize="6.0" /> + + fontName="Times-Italic" + fontSize="6.5" /> + + fontName="Helvetica" + fontSize="6.8" /> + + @@ -174,11 +178,11 @@ + fontSize="7.0" leading="7"/> + fontSize="7.5" leading="7"/> + fontSize="8.5" leading="7"/> + fontSize="9.0" leading="7"/> + fontSize="9.5" leading="7"/> + fontSize="7.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> + fontSize="7.5" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> + fontSize="8.5" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> + fontSize="9.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> + fontSize="9.5" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/> @@ -251,7 +255,7 @@ - + Code @@ -271,32 +275,24 @@ - - [[ repeatIn(lines(data['form']), 'a') ]] - - [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ a['code'] or removeParentNode('tr') ]] - [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ setTag('blockTable','blockTable',{'style':'TrLevel'+str(a['level'])}) ]][[ a['name'] ]] - - [[ a['level']>3 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['debit']) or '0.00' ]] - [[ a['level']<4 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['debit']) or '0.00' ]] - - - [[ a['level']>3 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['credit']) or '0.00' ]] - [[ a['level']<4 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['credit']) or '0.00' ]] - - - [[ a['level']>3 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['balance']) or '0.00' ]] - [[ a['level']<4 and removeParentNode('font') ]][[ setTag('para','para',{'style':('Amt_Level'+str(a['level']))}) ]][[ formatLang(a['balance']) or '0.00' ]] - - - - [[ setTag('para','para',{'style':('Det_Level'+str(a['level']))}) ]][[ a['jname'] or removeParentNode('tr') ]] - [[ setTag('para','para',{'style':('Det_Level'+str(a['level']))}) ]] [[ setTag('tr','tr',{'style':('TrLevel_Name'+str(a['level']))}) ]][ref: [[ a['ref'] or removeParentNode('font') ]] ] [[ a['lname'] ]] - [[ setTag('para','para',{'style':('Det_Amt_Level'+str(a['level']))}) ]][[ formatLang(a['debit1']) or '0.00']] - [[ setTag('para','para',{'style':('Det_Amt_Level'+str(a['level']))}) ]][[ formatLang(a['credit1']) or '0.00']] - [[ setTag('para','para',{'style':('Det_Amt_Level'+str(a['level']))}) ]][[ formatLang(a['balance1']) or '0.00' ]] - - + + [[ repeatIn(lines(data['form']), 'a') ]] + [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ a['code'] or removeParentNode('tr') ]] + [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ setTag('blockTable','blockTable',{'style':'TrLevel'+str(a['level'])}) ]][[ a['name'] ]] + + [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['debit']) or '0.00' ]] + [[ a['type']!='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['debit']) or '0.00' ]] + + + [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['credit']) or '0.00' ]] + [[ a['type']<>'view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['credit']) or '0.00' ]] + + + [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['balance']) or '0.00' ]] + [[ a['type']<>'view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['balance']) or '0.00' ]] + + + diff --git a/addons/crm_configuration/__terp__.py b/addons/crm_configuration/__terp__.py index ba9f560644e..0f6ccf2cabf 100644 --- a/addons/crm_configuration/__terp__.py +++ b/addons/crm_configuration/__terp__.py @@ -9,7 +9,7 @@ people to intelligently and efficiently manage tasks, issues, and requests. It manages key tasks such as communication, identification, prioritization, assignment, resolution and notification.""", - "depends" : ["crm","report_crm", "process", "account", "board_document"], + "depends" : ["crm","report_crm", "process", "account"], "init_xml" : [ "crm_config_view.xml", "crm_bugs_view.xml", From 24114740a6db004664897111012d8aed71b9355a Mon Sep 17 00:00:00 2001 From: Najlaa Date: Thu, 30 Oct 2008 15:57:40 +0100 Subject: [PATCH 4/5] Data in sxw account balance changes bzr revid: nel@silver-20081030145740-zhx1ag00krxob9av --- addons/account/report/account_balance.py | 3 - addons/account/report/account_balance.rml | 353 ++++++++-------------- 2 files changed, 133 insertions(+), 223 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 5aaf0c63e0a..ef76f9de1b7 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -119,7 +119,6 @@ class account_balance(report_sxw.rml_parse): self.date_lst.sort() def lines(self, form, ids={}, done=None, level=1): - print "DS LINES", ids if not ids: ids = self.ids if not ids: @@ -173,7 +172,6 @@ class account_balance(report_sxw.rml_parse): 'leef': not bool(account.child_id), 'bal_type':'', } - print ">>>",res['type'] self.sum_debit += account.debit self.sum_credit += account.credit if not (res['credit'] or res['debit']) and not account.child_id: @@ -197,7 +195,6 @@ class account_balance(report_sxw.rml_parse): else: result_acc.append(res) res1 = self.moveline(form, account.id,res['level']) - print "NNN",res1, res if res1: for r in res1: result_acc.append(r) diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 6272d775d21..05c258ba5ed 100755 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -2,7 +2,7 @@ + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - + + + + + - + + + + + - - - - + - + fontName="Helvetica" + fontSize="8.0" /> - + fontName="Helvetica" + fontSize="8.0" /> - - - - - - - - + fontSize="8.0" /> - - - + - - - - - - - - - - - - - - - - - - - - + + - - - - [[ get_fiscalyear(data['form']) or removeParentNode('tr') ]]: - [[ get_periods(data['form']) or removeParentNode('tr') ]] - - - - + + + + + + + [[ get_fiscalyear(data['form']) or removeParentNode('para') ]]: + [[ get_periods(data['form']) or removeParentNode('para') ]] + + + + + + + + Code @@ -273,28 +187,27 @@ Balance - - - - [[ repeatIn(lines(data['form']), 'a') ]] - [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ a['code'] or removeParentNode('tr') ]] - [[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ setTag('blockTable','blockTable',{'style':'TrLevel'+str(a['level'])}) ]][[ a['name'] ]] - - [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['debit']) or '0.00' ]] - [[ a['type']!='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['debit']) or '0.00' ]] - - - [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['credit']) or '0.00' ]] - [[ a['type']<>'view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['credit']) or '0.00' ]] - - - [[ a['type']=='view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]][[ formatLang(a['balance']) or '0.00' ]] - [[ a['type']<>'view' and removeParentNode('font') ]][[ setTag('para','para',{'style':('Level'+str(a['level']))}) ]] [[ formatLang(a['balance']) or '0.00' ]] - - - - - - - + + [[ repeatIn(lines(data['form']), 'a') ]][[ a['code'] or removeParentNode('tr') ]] + + + [[ setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))}) ]] + [[ a['name'] ]] + + + [[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]] + [[ a['type']<>'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]] + + + [[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]] + [[ a['type']<>'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]] + + + [[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]] + [[ a['type']<>'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]] + + + + + From ceaf595c7f386a3df3f4154ad026434e42bd5886 Mon Sep 17 00:00:00 2001 From: Najlaa Date: Fri, 31 Oct 2008 13:37:28 +0100 Subject: [PATCH 5/5] filter bzr revid: nel@silver-20081031123728-ggq06yts0i16y5fe --- addons/account/report/partner_balance.py | 165 ++++++++++++++-------- addons/account/report/partner_balance.rml | 4 +- 2 files changed, 111 insertions(+), 58 deletions(-) diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 23d4e54fa55..cf55c5f153f 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -208,12 +208,16 @@ class partner_balance(report_sxw.rml_parse): account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') full_account = [] result_tmp = 0.0 - + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') # # # if data['form']['soldeinit'] : - self.cr.execute( "SELECT p.ref, p.name,l.account_id,ac.name as account_name,ac.code as code , sum(debit) as debit, sum(credit) as credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ @@ -233,11 +237,11 @@ class partner_balance(report_sxw.rml_parse): "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \ "JOIN account_account ac ON (l.account_id = ac.id)" \ "WHERE " \ -# " account_id IN (" + self.account_ids + ") " \ - "l.date < %s AND l.reconcile_id IS NULL " \ + "ac.type IN %s " \ + "AND l.date < %s AND l.reconcile_id IS NULL " \ "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \ "ORDER BY l.account_id,p.name", - (self.date_lst[0],self.date_lst[0])) + (self.date_lst[0],a1,self.date_lst[0])) res = self.cr.dictfetchall() for r in res: @@ -265,10 +269,10 @@ class partner_balance(report_sxw.rml_parse): "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \ "JOIN account_account ac ON (l.account_id = ac.id)" \ "WHERE " \ -# " account_id IN (" + self.account_ids + ") " \ - " l.date IN (" + self.date_lst_string + ") " \ + " ac.type IN %s " \ + "AND l.date IN (" + self.date_lst_string + ") " \ "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \ - "ORDER BY l.account_id,p.name") + "ORDER BY l.account_id,p.name",(a1,)) res = self.cr.dictfetchall() for r in res: @@ -285,7 +289,10 @@ class partner_balance(report_sxw.rml_parse): tot_scredit = 0.0 tot_sdebit = 0.0 tot_enlitige = 0.0 + tot_d=0.0 + print "WWW",cleanarray for r in cleanarray: + print "r",r # For the first element we always add the line # type = 1 is the line is the first of the account # type = 2 is an other line of the account @@ -305,10 +312,12 @@ class partner_balance(report_sxw.rml_parse): new_header['balance'] = float(tot_sdebit) - float(tot_scredit) new_header['type'] = 3 ## + print "33", new_header completearray.append(new_header) # r['type'] = 1 r['balance'] = float(r['sdebit']) - float(r['scredit']) + print "LEVEL1", r completearray.append(r) # @@ -361,6 +370,7 @@ class partner_balance(report_sxw.rml_parse): new_header['enlitige'] = tot_enlitige new_header['balance'] = float(tot_sdebit) - float(tot_scredit) new_header['type'] = 3 + print "NEW GEA", new_header ## ## completearray.append(new_header) @@ -369,6 +379,7 @@ class partner_balance(report_sxw.rml_parse): r['type'] = 1 # r['balance'] = float(r['sdebit']) - float(r['scredit']) + print "RR LEVEEL1",r # completearray.append(r) @@ -384,46 +395,67 @@ class partner_balance(report_sxw.rml_parse): r['type'] = 2 # r['balance'] = float(r['sdebit']) - float(r['scredit']) + print "LEVELE2",i,r # completearray.append(r) - + print "fin",i i = i + 1 return completearray def _sum_debit(self,data): + print "daa",data if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') result_tmp = 0.0 # # - + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') + if data['form']['soldeinit'] : self.cr.execute( 'SELECT sum(debit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - ' l.reconcile_id IS NULL ' \ + ' ac.type IN %s ' \ + 'AND l.reconcile_id IS NULL ' \ 'AND date < %s ', - (self.date_lst[0],)) - result_tmp = float(self.cr.fetchone()[0] or 0.0) + (a1,self.date_lst[0],)) + + v_res = self.cr.fetchone() + if v_res and v_res != None: + result_tmp = float(v_res[0] or 0.0) + else: + result_tmp = 0.0 # # self.cr.execute( 'SELECT sum(debit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ # ' account_id IN (' + self.account_ids + ') ' \ - ' l.date IN (' + self.date_lst_string + ') ' ) + ' ac.type IN %s ' \ + 'AND l.date IN (' + self.date_lst_string + ') ',(a1,) ) result_tmp = result_tmp + float(self.cr.fetchone()[0] or 0.0) return result_tmp def _sum_credit(self,data): + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') + if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -434,27 +466,34 @@ class partner_balance(report_sxw.rml_parse): if data['form']['soldeinit'] : self.cr.execute( 'SELECT sum(credit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - ' l.reconcile_id IS NULL ' \ + ' ac.type IN %s ' \ + 'AND l.reconcile_id IS NULL ' \ 'AND date < %s ' , - (self.date_lst[0],)) + (a1,self.date_lst[0],)) result_tmp = float(self.cr.fetchone()[0] or 0.0) # # self.cr.execute( 'SELECT sum(credit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ # ' account_id IN (' + self.account_ids + ') ' \ - ' l.date IN (' + self.date_lst_string + ') ' ) + ' ac.type IN %s ' \ + 'AND l.date IN (' + self.date_lst_string + ') ',(a1,) ) result_tmp = result_tmp + float(self.cr.fetchone()[0] or 0.0) return result_tmp def _sum_litige(self,data): + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -465,28 +504,35 @@ class partner_balance(report_sxw.rml_parse): if data['form']['soldeinit'] : self.cr.execute( 'SELECT sum(debit-credit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ # ' account_id IN (' + self.account_ids + ') ' \ ' l.reconcile_id IS NULL ' \ + 'AND ac.type IN %s ' \ 'AND date < %s ' \ 'AND blocked=TRUE ' , - (self.date_lst[0],)) + (a1,self.date_lst[0],)) result_tmp = float(self.cr.fetchone()[0] or 0.0) # # self.cr.execute( 'SELECT sum(debit-credit) ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - ' l.date IN (' + self.date_lst_string + ') ' \ - 'AND blocked=TRUE ' ) + 'ac.type IN %s ' \ + 'AND l.date IN (' + self.date_lst_string + ') ' \ + 'AND blocked=TRUE ',(a1,) ) result_tmp = result_tmp + float(self.cr.fetchone()[0] or 0.0) return result_tmp def _sum_sdebit(self,data): + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -500,16 +546,17 @@ class partner_balance(report_sxw.rml_parse): 'THEN sum(debit) - sum(credit) ' \ 'ELSE 0 ' \ 'END ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - ' date < %s ' \ + 'ac.type IN %s ' \ + 'AND date < %s ' \ 'AND reconcile_id IS NULL ' \ 'GROUP BY partner_id', - (self.date_lst[0],)) + (a1,self.date_lst[0],)) - if self.cr.fetchone() != None: - result_tmp = float(self.cr.fetchone()[0]) + v_res = self.cr.fetchone() + if v_res != None : + result_tmp = float(v_res[0]) or 0.0 else: result_tmp = 0.0 # @@ -519,15 +566,14 @@ class partner_balance(report_sxw.rml_parse): 'THEN sum(debit) - sum(credit) ' \ 'ELSE 0 ' \ 'END ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - 'l.date IN (' + self.date_lst_string + ') ' \ - 'GROUP BY partner_id') - a = self.cr.fetchone()[0] - - if self.cr.fetchone() != None: - result_tmp = result_tmp + (a or 0.0) + ' ac.type IN %s ' \ + 'AND l.date IN (' + self.date_lst_string + ') ' \ + 'GROUP BY partner_id',(a1,)) + v_res = self.cr.fetchone() + if v_res != None: + result_tmp = result_tmp + ( v_res[0] or 0.0) else: result_tmp = 0.0 @@ -535,6 +581,12 @@ class partner_balance(report_sxw.rml_parse): def _sum_scredit(self,data): + if data['form']['result_selection']=='all': + a1=('receivable','payable') + elif data['form']['result_selection']=='customer': + a1=('receivable','') + elif data['form']['result_selection']=='supplier': + a1=('payable','') if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -548,16 +600,17 @@ class partner_balance(report_sxw.rml_parse): 'THEN sum(credit) - sum(debit) ' \ 'ELSE 0 ' \ 'END ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - ' date <= %s ' \ + ' ac.type IN %s ' \ + 'AND date <= %s ' \ 'AND l.reconcile_id IS NULL ' \ 'GROUP BY partner_id', - (self.date_lst[0],)) + (a1,self.date_lst[0],)) - if self.cr.fetchone() != None: - result_tmp = float(self.cr.fetchone()[0]) or 0.0 + v_res = self.cr.fetchone() + if v_res != None: + result_tmp = float(v_res[0]) or 0.0 else: result_tmp = 0.0 # @@ -567,14 +620,14 @@ class partner_balance(report_sxw.rml_parse): 'THEN sum(credit) - sum(debit) ' \ 'ELSE 0 ' \ 'END ' \ - 'FROM account_move_line AS l ' \ + 'FROM account_move_line AS l left join account_account ac ON (l.account_id = ac.id)' \ 'WHERE ' \ -# ' account_id IN (' + self.account_ids + ') ' \ - 'l.date IN (' + self.date_lst_string + ') ' \ - 'GROUP BY partner_id') - a = self.cr.fetchone()[0] - if self.cr.fetchone() != None: - result_tmp = result_tmp + (a or 0.0) + ' ac.type IN %s ' \ + ' AND l.date IN (' + self.date_lst_string + ') ' \ + 'GROUP BY partner_id',(a1,)) + a = self.cr.fetchone() + if a != None : + result_tmp = result_tmp + (a[0] or 0.0) else: result_tmp = 0.0 diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index 561eb07f505..2d94d131846 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -17,7 +17,7 @@ [[ company.name ]] - Partnar Balance [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]] [[ company.currency_id.name ]] + Partner Balance [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]] [[ company.currency_id.name ]] @@ -381,4 +381,4 @@ - \ No newline at end of file +