diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 65f8aae76db..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: @@ -163,6 +162,7 @@ class account_balance(report_sxw.rml_parse): 'credit1':'', 'balance1' :'', 'id' : account.id, + 'type' : account.type, 'code': account.code, 'name': account.name, 'level': level, @@ -195,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) @@ -226,6 +225,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..05c258ba5ed 100755 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -2,7 +2,7 @@ + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - + - + + + + + - + + + + + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - [[ 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 @@ -269,36 +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['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') ]][[ 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' ]] + + + + + 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 + diff --git a/addons/profile_manufacturing/profile_manufacturing.py b/addons/profile_manufacturing/profile_manufacturing.py index 0b65346db02..19098a6d1d2 100644 --- a/addons/profile_manufacturing/profile_manufacturing.py +++ b/addons/profile_manufacturing/profile_manufacturing.py @@ -75,6 +75,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."),