From c76b97ce217bf3c49a1db7ee07ca1c7be532c7da Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Thu, 16 Oct 2008 13:06:31 +0530 Subject: [PATCH 01/11] Modified printing indicator report using pychart :Account_report bzr revid: jvo@tinyerp.com-20081016073631-rqhrjdsuyouep4lt --- .../account_report/report/print_indicator.py | 92 ++++++++++++------- .../account_report/report/print_indicator.rml | 3 + 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index 8496dd3e834..ec0e84fb314 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -40,6 +40,11 @@ import reportlab.lib.colors as colors #from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection #from reportlab.graphics.charts.textlabels import BarChartLabel #from reportlab.graphics import renderPM +from report.render import render +from report.interface import report_int +from pychart import * +import StringIO +theme.use_color = 1 import tools @@ -157,7 +162,7 @@ class accounting_report_indicator(report_sxw.rml_parse): def test1(self,data,object,intercall=False): - path=tools.config['root_path']+"/Temp_report/Image" + path=tools.config['root_path']+"/Temp_images/Image" obj_history=self.pool.get('account.report.history') if data['select_base']=='year': @@ -179,41 +184,60 @@ class accounting_report_indicator(report_sxw.rml_parse): if intercall: return True self.count +=1 - drawing = Drawing(400, 300) - data = [ - tuple(data_val), - ] - value_min=0.0 - vmin=min(data_val) - vmax=max(data_val) - - val_min=((vmin < 0.00 and vmin-2.00) or 0.00) - # calculating maximum - val_max=(vmax/(pow(10,len(str(int(vmax)))-2))+1)*pow(10,len(str(int(vmax)))-2) - bc = VerticalBarChart() - bc.x = 50 - bc.y = 50 - bc.height = 245 - bc.width = 300 - bc.data = data - value_step=(abs(val_max)-abs(val_min))/5 - - bc.strokeColor = colors.black - bc.valueAxis.valueMin = val_min - bc.valueAxis.valueMax = val_max - bc.valueAxis.valueStep = value_step - - bc.categoryAxis.labels.boxAnchor = 'ne' - bc.categoryAxis.labels.dx = 8 - - bc.categoryAxis.labels.dy = -2 - bc.categoryAxis.labels.angle = 30 - bc.categoryAxis.categoryNames = data_period - drawing.add(bc) - drawing.save(formats=['png'],fnRoot=path+str(self.count),title="helo") +# drawing = Drawing(400, 300) +# data = [ +# tuple(data_val), +# ] +# value_min=0.0 +# vmin=min(data_val) +# vmax=max(data_val) +# +# val_min=((vmin < 0.00 and vmin-2.00) or 0.00) +# # calculating maximum +# val_max=(vmax/(pow(10,len(str(int(vmax)))-2))+1)*pow(10,len(str(int(vmax)))-2) +# bc = VerticalBarChart() +# bc.x = 50 +# bc.y = 50 +# bc.height = 245 +# bc.width = 300 +# bc.data = data +# value_step=(abs(val_max)-abs(val_min))/5 +# +# bc.strokeColor = colors.black +# bc.valueAxis.valueMin = val_min +# bc.valueAxis.valueMax = val_max +# bc.valueAxis.valueStep = value_step +# +# bc.categoryAxis.labels.boxAnchor = 'ne' +# bc.categoryAxis.labels.dx = 8 +# +# bc.categoryAxis.labels.dy = -2 +# bc.categoryAxis.labels.angle = 30 +# bc.categoryAxis.categoryNames = data_period +# drawing.add(bc) +# drawing.save(formats=['png'],fnRoot=path+str(self.count),title="helo") # renderPM.drawToFile(drawing1, 'example1.jpg','jpg') - return path+str(self.count)+'.png' + import os + dirname ='Temp_images' + if not os.path.isdir('./' + dirname + '/'): + os.mkdir('./' + dirname + '/') + pdf_string = StringIO.StringIO() + can = canvas.init('Image'+str(self.count)+".png") + chart_object.set_defaults(line_plot.T, line_style=None) + data=zip(self.header_name,self.header_val) + ar = area.T(size = (400,200),x_coord = category_coord.T(data, 0), y_range = (0, None), + x_axis = axis.X(label="Period//Year",format="/a-30{}%s"), + y_axis = axis.Y(label="Value")) + + + ar.add_plot(bar_plot.T(data = data, label = "Value",fill_style=fill_style.red)) + ar.draw() + + can.close() + os.system('cp '+'Image'+str(self.count)+'.png ' +path+str(self.count)+'.png') + os.system('rm '+'Image'+str(self.count)+'.png') + return path+str(self.count)+'.png' report_sxw.report_sxw('report.print.indicators', 'account.report.history', 'addons/account_report/report/print_indicator.rml', diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml index 1834c8f128b..6727812fc6f 100644 --- a/addons/account_report/report/print_indicator.rml +++ b/addons/account_report/report/print_indicator.rml @@ -129,6 +129,9 @@ [[ o['disp_graph'] and setTag('para','image',{'file':test(data['form'],o)}) or removeParentNode('para') ]] + + +
[[ repeatIn(getarray(data['form'],o),'array',td=len(data['form']['base_selection'][0][2])) ]] From fd9adc56d7f53f30c4589b6af6c16e8091d18eb6 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Thu, 16 Oct 2008 16:22:36 +0530 Subject: [PATCH 03/11] Gantt view of project tasks. bzr revid: ame@tinyerp.com-20081016105236-o9yowg6lp88avo8r --- addons/project/project_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 517c8d8dad5..12f9a17491f 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -325,7 +325,7 @@ - + From 2149818ccbce4bc20a325974240197f94acc1983 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 16 Oct 2008 15:33:53 +0200 Subject: [PATCH 04/11] fix view bzr revid: christophe@tinyerp.com-20081016133353-ziupkdoktil8rtwo --- addons/sale_journal/sale_journal_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml index 17975fe9755..a0b397282e8 100644 --- a/addons/sale_journal/sale_journal_view.xml +++ b/addons/sale_journal/sale_journal_view.xml @@ -285,9 +285,9 @@ form - + - + From bf866163acb3f42e4fc3c4e24511ad285ebd10ad Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Thu, 16 Oct 2008 19:30:26 +0530 Subject: [PATCH 05/11] =?UTF-8?q?for=20reports,=20partner=20balance=20et?= =?UTF-8?q?=20partner=20ledger.=20Can=20u=20change=20this=20to=20not=20hav?= =?UTF-8?q?e=20the=20wizard=20that=20asks=20by=20date=20or=20by=20period?= =?UTF-8?q?=20when=20we=20run=20the=20wizard.=20We=20should=20include=20a?= =?UTF-8?q?=20field=20selection=20filter=20with=20that=20values=20=C2=A0?= =?UTF-8?q?=20No=20one=20=C2=A0=20By=20date=20=C2=A0=20By=20period=20With?= =?UTF-8?q?=20attrs,=20the=20fields=20'date=20from=20et=20date=20to'=20and?= =?UTF-8?q?=20=20Period=20should=20print=20or=20not=20depending=20on=20the?= =?UTF-8?q?=20value=20of=20the=20field=20selection.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bzr revid: patelamit2003@gmail.com-20081016140026-xi90zggjh51zvkwa --- addons/account/report/partner_balance.py | 13 +- .../wizard/wizard_partner_balance_report.py | 141 +++++++++++------- 2 files changed, 93 insertions(+), 61 deletions(-) diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index d7e82431ce4..0e9b0777d14 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -85,6 +85,7 @@ class partner_balance(report_sxw.rml_parse): def transform_date_into_date_array(self,data): + return_array = self.date_range(data['form']['date1'],data['form']['date2']) self.date_lst = return_array self.date_lst.sort() @@ -109,9 +110,12 @@ class partner_balance(report_sxw.rml_parse): # Transformation des date # # - if data['form'].has_key('fiscalyear'): + + if data['form']['fiscalyear']: + print"data['form']['fiscalyear']=True" self.transform_period_into_date_array(data) else: + print"data['form']['fiscalyear']=False" self.transform_date_into_date_array(data) ## self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\'' @@ -202,7 +206,7 @@ class partner_balance(report_sxw.rml_parse): "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \ "ORDER BY l.account_id,p.name") res = self.cr.dictfetchall() - print"=====res=====",res + for r in res: full_account.append(r) @@ -241,7 +245,7 @@ class partner_balance(report_sxw.rml_parse): # r['type'] = 1 r['balance'] = float(r['sdebit']) - float(r['scredit']) - print"====i = 0 :completearray====",completearray,i + completearray.append(r) # tot_debit = r['debit'] @@ -303,7 +307,7 @@ class partner_balance(report_sxw.rml_parse): r['balance'] = float(r['sdebit']) - float(r['scredit']) # completearray.append(r) - print"====i!=0 completearray====",completearray,i + if cleanarray[i]['account_id'] == cleanarray[i-1]['account_id']: # we reset the counter @@ -332,6 +336,7 @@ class partner_balance(report_sxw.rml_parse): result_tmp = 0.0 # # + if data['form']['soldeinit'] : self.cr.execute( 'SELECT sum(debit) ' \ diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index 08af6074215..7334bfc56fc 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -29,78 +29,105 @@ import time import wizard import pooler -report_type = ''' -
-
''' - - -dates_form = ''' -
- - - - - - - -''' - -dates_fields = { - 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, - 'result_selection':{'string':"Display partner ",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, - 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, - 'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, - 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, -} +#report_type = ''' +#
+#
''' +# +# +#dates_form = ''' +#
+# +# +# +# +# +# +# +#''' +# +#dates_fields = { +# 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, +# 'result_selection':{'string':"Display partner ",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, +# 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, +# 'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, +# 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, +#} period_form = ''' -
+ + + + + + + + - + ''' period_fields = { 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, + 'state':{'string':"Select Report Type",'type':'selection','selection':[('none','None'),('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'none' }, 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', - 'help': 'Keep empty for all open fiscal year'}, - 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}, + 'help': 'Keep empty for all open fiscal year','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, + 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, + 'date1': {'string':'Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')}, + 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')}, } class wizard_report(wizard.interface): - def _get_defaults(self, cr, uid, data, context): - fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') - data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) - + + def _get_load(self,cr,uid,data,context): user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) if user.company_id: - company_id = user.company_id.id + company_id = user.company_id.id else: - company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] + company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] + + fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') + periods_obj=pooler.get_pool(cr.dbname).get('account.period') + data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) + data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) data['form']['company_id'] = company_id data['form']['soldeinit'] = True data['form']['result_selection'] = 'all' return data['form'] - def _get_defaults_fordate(self, cr, uid, data, context): - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) - if user.company_id: - company_id = user.company_id.id - else: - company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] - data['form']['company_id'] = company_id - data['form']['soldeinit'] = True - data['form']['result_selection'] = 'all' + def _get_defaults(self, cr, uid, data, context): + + if data['form']['state'] == 'none': + return 'report' + else : + if data['form']['state'] == 'byperiod': + data['form']['fiscalyear'] = True + else : + self._check_date(cr, uid, data, context) + data['form']['fiscalyear'] = False + return data['form'] +# def _get_defaults_fordate(self, cr, uid, data, context): +# user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) +# if user.company_id: +# company_id = user.company_id.id +# else: +# company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] +# data['form']['company_id'] = company_id +# data['form']['soldeinit'] = True +# data['form']['result_selection'] = 'all' +# return data['form'] + def _check_date(self, cr, uid, data, context): + sql = """ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date1']) cr.execute(sql) @@ -117,24 +144,24 @@ class wizard_report(wizard.interface): states = { 'init': { - 'actions': [], - 'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]} - }, - 'with_period': { - 'actions': [_get_defaults], - 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]} - }, - 'with_date': { - 'actions': [_get_defaults_fordate], - 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]} - }, - 'checkdate': { - 'actions': [], - 'result': {'type':'choice','next_state':_check_date} + 'actions': [_get_load], + 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]} }, +# 'with_period': { +# 'actions': [_get_defaults], +# 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]} +# }, +# 'with_date': { +# 'actions': [_get_defaults_fordate], +# 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]} +# }, +## 'checkdate': { +## 'actions': [], +## 'result': {'type':'choice','next_state':_check_date} +## }, 'report': { - 'actions': [], + 'actions': [_get_defaults], 'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'} } } From c55049f936e58c133b55cc44958e3e1579714569 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 10:08:19 +0530 Subject: [PATCH 06/11] small changes in partner balance wizard bzr revid: patelamit2003@gmail.com-20081017043819-rw1qcd4dqqlg4z9m --- .../wizard/wizard_partner_balance_report.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index 7334bfc56fc..f2191e586c0 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -55,15 +55,16 @@ import pooler period_form = '''
+ - + - + @@ -73,7 +74,7 @@ period_form = ''' period_fields = { 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, - 'state':{'string':"Select Report Type",'type':'selection','selection':[('none','None'),('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'none' }, + 'state':{'string':"Select Report Type",'type':'selection','selection':[('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'byperiod' }, 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'help': 'Keep empty for all open fiscal year','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, @@ -104,14 +105,11 @@ class wizard_report(wizard.interface): def _get_defaults(self, cr, uid, data, context): - if data['form']['state'] == 'none': - return 'report' - else : - if data['form']['state'] == 'byperiod': - data['form']['fiscalyear'] = True - else : - self._check_date(cr, uid, data, context) - data['form']['fiscalyear'] = False + if data['form']['state'] == 'byperiod': + data['form']['fiscalyear'] = True + else : + self._check_date(cr, uid, data, context) + data['form']['fiscalyear'] = False return data['form'] From e1650076da90ae4d2b862bed0765ac1f3867eb3b Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 10:20:38 +0530 Subject: [PATCH 07/11] small changes in partner balance wizard bzr revid: patelamit2003@gmail.com-20081017045038-i2jm738qhpbam3y7 --- .../wizard/wizard_partner_balance_report.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index f2191e586c0..169a4c1e051 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -55,9 +55,10 @@ import pooler period_form = ''' - - - + + + + @@ -65,8 +66,8 @@ period_form = ''' - - + + @@ -74,13 +75,13 @@ period_form = ''' period_fields = { 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, - 'state':{'string':"Select Report Type",'type':'selection','selection':[('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'byperiod' }, + 'state':{'string':"Report Type",'type':'selection','selection':[('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'byperiod' }, 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'help': 'Keep empty for all open fiscal year','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, - 'date1': {'string':'Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')}, + 'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')}, 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')}, } From 35b1d51fbde011a259842a14dbbf78a1a42d063a Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 10:32:34 +0530 Subject: [PATCH 08/11] Small changes in Partner Balance... bzr revid: patelamit2003@gmail.com-20081017050234-tqsp2elknj6bgsh7 --- addons/account/wizard/wizard_partner_balance_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index 169a4c1e051..fac51eb1dcb 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -79,8 +79,8 @@ period_fields = { 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'help': 'Keep empty for all open fiscal year','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, - 'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, - 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, + 'result_selection':{'string':" Partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, + 'soldeinit':{'string':" Inclure les soldes initiaux",'type':'boolean'}, 'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')}, 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')}, } From 0cf29af07a7b2121a7671e9902601b169d04b603 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 10:50:16 +0530 Subject: [PATCH 09/11] Completed OverDue Payment Report(Viral Rami) bzr revid: patelamit2003@gmail.com-20081017052016-l8xsv8xc37kxix1c --- addons/account/report/overdue.rml | 301 ++++++++++++++++-------------- 1 file changed, 162 insertions(+), 139 deletions(-) diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index f9f213f0d89..aa0d111b28f 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -14,195 +14,193 @@ + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - [[ repeatIn(objects,'o') ]] - [[ setLang(o.lang) ]] + [[ repeatIn(objects,'o') ]] + [[ setLang(o.lang) ]] - + - [[ o.name ]] - [[ adr_get(o, 'invoice')['name'] ]] - [[ adr_get(o, 'invoice')['street'] ]] - [[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]] - [[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] - + [[ o.name ]] + [[ adr_get(o, 'invoice')['name'] ]] + [[ adr_get(o, 'invoice')['street'] ]] + [[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]] + [[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] + - VAT: [[ o.vat or removeParentNode('para') ]] + VAT: [[ o.vat or removeParentNode('para') ]] + + + + + + + Document: Customer account statement - + Date: + [[ time.strftime('%d/%m/%Y') ]] - - - - Document: Customer account statement - - Date: - [[ time.strftime('%d/%m/%Y') ]] - - Customer Ref: [[ o.id ]] - - - - Dear Sir/Madam, - - - - Exception made of a mistake of our side, it seems that the following bills stay unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. - - - - Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at [[ tel_get(company.partner_id) ]]. - - - - Best regards. + Customer Ref: [[ o.id ]] - + Dear Sir/Madam, + + + + Exception made of a mistake of our side, it seems that the following bills stay unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. + + + + Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00. + + + + Best regards. + + + + - Date + Date - Description + Description - Ref + Ref - Maturity date + Maturity date - Due + Due - Paid + Paid - Maturity + Maturity - Li. + Li. - + - - [[repeatIn(getLines(o), 'line') ]] - [[ line['date'] ]] - + Sub-Total: + + + + + + [[ '%.2f' % (reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] - [[ line['name'] ]] + [[ '%.2f' % (reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] - [[ line['ref'] ]] + [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] - [[ line['date_maturity'] ]] - - - [[ line['debit'] and '%.2f' % (line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] - - - [[ line['credit'] and '%.2f' % (line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] - - - [[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and '%.2f' % ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] - - - [[ line['blocked'] and 'X' or '' ]] - - - - - - - Sub-Total: - - - [[ '%.2f' % (reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] - - - - [[ '%.2f' % (reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] - - - - [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] - - - + - Balance: + Balance: + + + + + + [[ '%.2f' % (reduce(lambda x, y: x +((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] - [[ '%.2f' % (reduce(lambda x, y: x +((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] + + + @@ -210,27 +208,52 @@ - + + + + + + + [[repeatIn(getLines(o), 'line') ]] + [[ line['date'] ]] + + - - - + [[ line['name'] ]] + + + [[ line['ref'] ]] + + + [[ line['date_maturity'] ]] + + + [[ line['debit'] and '%.2f' % (line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ line['credit'] and '%.2f' % (line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and '%.2f' % ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ line['blocked'] and 'X' or '' ]] - + - - Total amount due: - [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] [[ company.currency_id.name ]]. + + Total amount due: + [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] [[ company.currency_id.name ]] + . - + - From fe7b7268f076a5627b756d0800120416638c69eb Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 11:20:48 +0530 Subject: [PATCH 10/11] Production Order and Purchase Order Report Prob Solved---(Viral Rami) bzr revid: patelamit2003@gmail.com-20081017055048-yv2q4zxxszo91hun --- addons/mrp/report/order.py | 5 +- addons/mrp/report/order.rml | 18 +++++-- addons/purchase/report/order.rml | 80 +++++++++++++++----------------- 3 files changed, 56 insertions(+), 47 deletions(-) mode change 100644 => 100755 addons/purchase/report/order.rml diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py index 98f4bf1c0fb..6e2cf896660 100644 --- a/addons/mrp/report/order.py +++ b/addons/mrp/report/order.py @@ -39,4 +39,7 @@ class order(report_sxw.rml_parse): }) -report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order, header=2) + +report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order,header=1) + + diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml index b9d62c5138f..341793ee79d 100644 --- a/addons/mrp/report/order.rml +++ b/addons/mrp/report/order.rml @@ -91,16 +91,19 @@ + - - + + + + @@ -118,6 +121,7 @@ + @@ -142,8 +146,10 @@ + + Printing date @@ -157,6 +163,7 @@ Product Name + @@ -164,6 +171,7 @@ + [[ time.strftime('%d/%m/%Y') ]] @@ -177,10 +185,12 @@ [[ '['+ o.product_id.code +']' ]] [[ o.product_id.name ]] +
+ @@ -200,10 +210,10 @@ [[ repeatIn(o.move_lines,'line') ]] - [[ '['+line.product_id.code +']' ]][[ line.product_id.name ]] + [[ '['+line.product_id.code +']' ]] [[ line.product_id.name ]] - [[ line.product_qty ]] [[line.product_uom.name]] + [[ '%.2f' % line.product_qty ]] [[line.product_uom.name]] diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml old mode 100644 new mode 100755 index 8b84e34d18d..d8959d3663d --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -101,9 +101,9 @@ - - - + + + @@ -140,7 +140,7 @@ [[ repeatIn(objects,'o') ]] - + @@ -149,52 +149,52 @@ - + - [[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]] - Shipping address : - [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] - [[ addr.title or '' ]] [[ addr.name ]] - [[ addr.street ]] - [[ addr.street2 or '' ]] - [[ addr.zip or '' ]] [[ addr.city or '' ]] - [[ addr.state_id and addr.state_id.name or '' ]] - [[ addr.country_id and addr.country_id.name or '' ]] + [[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]] + Shipping address : + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ addr.title or '' ]] [[ addr.name ]] + [[ addr.street ]] + [[ addr.street2 or '' ]] + [[ addr.zip or '' ]] [[ addr.city or '' ]] + [[ addr.state_id and addr.state_id.name or '' ]] + [[ addr.country_id and addr.country_id.name or '' ]] - + - + - [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] - [[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]] - [[ o.partner_address_id.street ]] - [[ o.partner_address_id.street2 or '' ]] - [[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]] - [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]] - [[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]] - + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]] + [[ o.partner_address_id.street ]] + [[ o.partner_address_id.street2 or '' ]] + [[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]] + [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]] + [[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]] + - Tel. : [[ o.partner_address_id.phone or '' ]] - Fax : [[ o.partner_address_id.fax or '' ]] - TVA : [[ o.partner_id.vat or '' ]] + Tél. : [[ o.partner_address_id.phone or '' ]] + Fax : [[ o.partner_address_id.fax or '' ]] + TVA : [[ o.partner_id.vat or '' ]] - + @@ -203,10 +203,7 @@ - [[ (o.state=='draft' or removeParentNode('font')) and 'Request for Quotation' ]] [[ (o.state<>'draft' or removeParentNode('font')) and 'Purchase Order Confirmation' ]] N° [[ o.name ]] - - - + [[ (o.state=='draft' or removeParentNode('font')) and 'Request for Quotation' ]] [[ (o.state<>'draft' or removeParentNode('font')) and 'Purchase Order Confirmation' ]] N° [[ o.name ]] @@ -229,23 +226,23 @@ - [[ o.name or '' ]] + [[ o.name or '' ]] - [[ o.partner_ref or '' ]] + [[ o.partner_ref or '' ]] - [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]] - + [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]] + - [[ o.validator and o.validator.name or '' ]] + [[ o.validator and o.validator.name or '' ]] - + Description @@ -269,7 +266,7 @@
[[ repeatIn(o.order_line,'line') ]] - + [[ line.name ]] @@ -278,7 +275,7 @@ [[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]] - [[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d %H:%M:%S')) ]] + [[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d %H:%M:%S')) ]] [[ line.product_qty ]] @@ -330,7 +327,7 @@
- + @@ -395,4 +392,3 @@
- From fa7bf2568301aa1afa28ca932449b0d14f6e8314 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Fri, 17 Oct 2008 11:59:19 +0530 Subject: [PATCH 11/11] small changes in partner Balance wizard... bzr revid: patelamit2003@gmail.com-20081017062919-azy0tzz98ic6made --- .../wizard/wizard_partner_balance_report.py | 58 ++----------------- 1 file changed, 5 insertions(+), 53 deletions(-) diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index fac51eb1dcb..98c5d0a5984 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -29,30 +29,6 @@ import time import wizard import pooler -#report_type = ''' -# -#''' -# -# -#dates_form = ''' -#
-# -# -# -# -# -# -# -#''' -# -#dates_fields = { -# 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, -# 'result_selection':{'string':"Display partner ",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]}, -# 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, -# 'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, -# 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, -#} - period_form = '''
@@ -85,10 +61,9 @@ period_fields = { 'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')}, } - class wizard_report(wizard.interface): - def _get_load(self,cr,uid,data,context): + def _get_defaults(self,cr,uid,data,context): user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) if user.company_id: company_id = user.company_id.id @@ -104,7 +79,7 @@ class wizard_report(wizard.interface): data['form']['result_selection'] = 'all' return data['form'] - def _get_defaults(self, cr, uid, data, context): + def _check_state(self, cr, uid, data, context): if data['form']['state'] == 'byperiod': data['form']['fiscalyear'] = True @@ -113,18 +88,7 @@ class wizard_report(wizard.interface): data['form']['fiscalyear'] = False return data['form'] - -# def _get_defaults_fordate(self, cr, uid, data, context): -# user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) -# if user.company_id: -# company_id = user.company_id.id -# else: -# company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] -# data['form']['company_id'] = company_id -# data['form']['soldeinit'] = True -# data['form']['result_selection'] = 'all' -# return data['form'] - + def _check_date(self, cr, uid, data, context): sql = """ @@ -143,24 +107,12 @@ class wizard_report(wizard.interface): states = { 'init': { - 'actions': [_get_load], + 'actions': [_get_defaults], 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]} }, -# 'with_period': { -# 'actions': [_get_defaults], -# 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]} -# }, -# 'with_date': { -# 'actions': [_get_defaults_fordate], -# 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]} -# }, -## 'checkdate': { -## 'actions': [], -## 'result': {'type':'choice','next_state':_check_date} -## }, 'report': { - 'actions': [_get_defaults], + 'actions': [_check_state], 'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'} } }