From bf1b0cfba728a3046a4d87c31b359108f39d00eb Mon Sep 17 00:00:00 2001 From: "RCH(OpenERP)" <> Date: Tue, 9 Feb 2010 12:51:57 +0530 Subject: [PATCH 1/6] Small changes in menus bzr revid: vir@tinyerp.com-20100209072157-rhhux4xaju9oeqd2 --- addons/point_of_sale/pos_view.xml | 2 +- .../process/project_timesheet_process.xml | 10 +++++----- addons/report_project/report_project_view.xml | 4 ++-- addons/survey/survey_view.xml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml index c05df176d56..dbe892cb116 100644 --- a/addons/point_of_sale/pos_view.xml +++ b/addons/point_of_sale/pos_view.xml @@ -167,7 +167,7 @@ - + diff --git a/addons/project_timesheet/process/project_timesheet_process.xml b/addons/project_timesheet/process/project_timesheet_process.xml index bcfac8bd8ce..d6ca5cde8bc 100644 --- a/addons/project_timesheet/process/project_timesheet_process.xml +++ b/addons/project_timesheet/process/project_timesheet_process.xml @@ -34,11 +34,11 @@ - + - + @@ -133,7 +133,7 @@ tree - + diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index b71dbe97fb9..779e6eac466 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -3,7 +3,7 @@ - + From 4db5d00fc1667e335f8f501627f7a114c622c7b4 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Wed, 10 Feb 2010 10:55:42 +0530 Subject: [PATCH 2/6] [IMP]:survey:(REF-YSA) -improved code. bzr revid: apa@tinyerp.com-20100210052542-v4r6mq8c9on0c7or --- addons/survey/report/survey_browse_response.py | 6 +++--- addons/survey/survey.py | 7 +++++-- addons/survey/wizard/wizard_survey.py | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index 6e423cb53c1..40c75755e1f 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -218,16 +218,16 @@ class survey_browse_response(report_rml): """ if survey.note: rml += """ - """ + to_xml(tools.ustr(survey.note)) + """ + """ + to_xml(tools.ustr(survey.note or '')) + """ """ for page in survey.page_ids: rml += """ - Page :- """ + to_xml(tools.ustr(page.title)) + """ + Page :- """ + to_xml(tools.ustr(page.title or '')) + """ """ if page.note: rml += """ - """ + to_xml(tools.ustr(page.note)) + """ + """ + to_xml(tools.ustr(page.note or '')) + """ """ for que in page.question_ids: rml += """ diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 744829b2d45..cd3584f5361 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -31,6 +31,7 @@ from tools import to_xml import tools from mx.DateTime import * import netsvc +import os class survey_type(osv.osv): _name = 'survey.type' @@ -902,7 +903,7 @@ class survey_question_wiz(osv.osv_memory): context.update({'response_id':response_id}) report = self.create_report(cr, uid, [int(survey_id)], 'report.survey.browse.response', survey_data.title,context) attachments = [] - file = open("/tmp/" + survey_data.title + ".pdf") + file = open(tools.config['addons_path'] + '/survey/report/' + survey_data.title + ".pdf") file_data = "" while 1: line = file.readline() @@ -910,6 +911,8 @@ class survey_question_wiz(osv.osv_memory): if not line: break attachments.append((survey_data.title + ".pdf",file_data)) + file.close() + os.remove(tools.config['addons_path'] + '/survey/report/' + survey_data.title + ".pdf") user_email = False resp_email = False if user_obj.browse(cr, uid, uid).address_id.id: @@ -938,7 +941,7 @@ class survey_question_wiz(osv.osv_memory): if not report_name or not res_ids: return (False, Exception('Report name and Resources ids are required !!!')) try: - ret_file_name = '/tmp/'+file_name+'.pdf' + ret_file_name = tools.config['addons_path'] + '/survey/report/' + file_name + '.pdf' service = netsvc.LocalService(report_name); (result, format) = service.create(cr, uid, res_ids, {}, context) fp = open(ret_file_name, 'wb+'); diff --git a/addons/survey/wizard/wizard_survey.py b/addons/survey/wizard/wizard_survey.py index b623c8ecd27..631b8d56aea 100755 --- a/addons/survey/wizard/wizard_survey.py +++ b/addons/survey/wizard/wizard_survey.py @@ -114,7 +114,7 @@ def send_mail(self, cr, uid, data, context): attachments = [] for id in survey_ref.browse(cr, uid, data['ids']): report = create_report(cr, uid, [id.id], 'report.survey.form', id.title) - file = open("/tmp/" + id.title +".pdf") + file = open(tools.config['addons_path'] + '/survey/report/' + id.title +".pdf") file_data = "" while 1: line = file.readline() @@ -122,6 +122,8 @@ def send_mail(self, cr, uid, data, context): if not line: break attachments.append((id.title +".pdf",file_data)) + file.close() + os.remove(tools.config['addons_path'] + '/survey/report/' + id.title + ".pdf") for partner in pool.get('res.partner').browse(cr, uid, partner_ids): for addr in partner.address: @@ -191,7 +193,7 @@ def create_report(cr, uid, res_ids, report_name=False, file_name=False): if not report_name or not res_ids: return (False, Exception('Report name and Resources ids are required !!!')) try: - ret_file_name = '/tmp/'+file_name+'.pdf' + ret_file_name = tools.config['addons_path'] + '/survey/report/' + file_name + '.pdf' service = netsvc.LocalService(report_name); (result, format) = service.create(cr, uid, res_ids, {}, {}) fp = open(ret_file_name, 'wb+'); From 5d5d093baf6cad7d8e492bfa4baf3b7c348477d0 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 10 Feb 2010 11:08:01 +0530 Subject: [PATCH 3/6] [IMP] crm: help desk view improve with default of section_id in its search view bzr revid: mra@tinyerp.com-20100210053801-bkch7xv8opwryiso --- addons/crm/crm_helpdesk_view.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/crm/crm_helpdesk_view.xml b/addons/crm/crm_helpdesk_view.xml index 9c9045c5f87..09d53676339 100644 --- a/addons/crm/crm_helpdesk_view.xml +++ b/addons/crm/crm_helpdesk_view.xml @@ -9,9 +9,9 @@ Helpdesk Categories crm.case.categ form - - [('object_id.model', '=', 'crm.helpdesk')] - {'object_id':'crm.helpdesk'} + + [('object_id.model', '=', 'crm.helpdesk')] + {'object_id':'crm.helpdesk'} # ------------------------------------------------------ @@ -26,9 +26,9 @@ - + - + @@ -36,10 +36,10 @@ - + - + @@ -158,7 +158,7 @@ - + CRM - Helpdesk Search crm.helpdesk @@ -186,11 +186,11 @@ - + - + help="My section"/> + From 289d243b616a72ddce4c05f23a45a54d5ef95eb2 Mon Sep 17 00:00:00 2001 From: "VRA(OpenERP)" <> Date: Wed, 10 Feb 2010 11:41:07 +0530 Subject: [PATCH 4/6] [FIX] Amount_To_Text Corrected lp bug: https://launchpad.net/bugs/453269 fixed bzr revid: jvo@tinyerp.com-20100210061107-a8ck50crust98lxd --- bin/tools/amount_to_text.py | 2 ++ bin/tools/amount_to_text_en.py | 1 + 2 files changed, 3 insertions(+) diff --git a/bin/tools/amount_to_text.py b/bin/tools/amount_to_text.py index 3612440a5ef..0b626af8a7a 100644 --- a/bin/tools/amount_to_text.py +++ b/bin/tools/amount_to_text.py @@ -74,6 +74,7 @@ def french_number(val): return ret def amount_to_text_fr(number, currency): + number = '%.2f' % number units_name = currency list = str(number).split('.') start_word = french_number(abs(int(list[0]))) @@ -137,6 +138,7 @@ def dutch_number(val): return ret def amount_to_text_nl(number, currency): + number = '%.2f' % number units_name = currency list = str(number).split('.') start_word = dutch_number(int(list[0])) diff --git a/bin/tools/amount_to_text_en.py b/bin/tools/amount_to_text_en.py index 1dbf1f95822..66d749e5fb3 100644 --- a/bin/tools/amount_to_text_en.py +++ b/bin/tools/amount_to_text_en.py @@ -74,6 +74,7 @@ def english_number(val): return ret def amount_to_text(number, currency): + number = '%.2f' % number units_name = currency list = str(number).split('.') start_word = english_number(int(list[0])) From d9de08890966bbeb4b5ba2e3c08afcb9cd3fbbde Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 10 Feb 2010 14:16:48 +0530 Subject: [PATCH 5/6] [IMP] document: improve document view bzr revid: hmo@tinyerp.com-20100210084648-fdr7mkhclu26aak6 --- addons/document/document_view.xml | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index 658dfc3630e..cdbdf161891 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -43,11 +43,11 @@ form tree,form - + parent="menu_document_management_configuration"/> document.directory @@ -173,14 +173,13 @@ form - + - - + @@ -208,17 +207,18 @@ - - - - + + + + + + + + - - - - - - + + + @@ -232,7 +232,7 @@ tree - + @@ -251,7 +251,7 @@ From 4741259d1422dbac8d7177a0d4fca795a56cc911 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 10 Feb 2010 14:25:33 +0530 Subject: [PATCH 6/6] [IMP] document: if storage media is not specify in file , it should take db storage on get datas bzr revid: hmo@tinyerp.com-20100210085533-54502lynruy569pn --- addons/document/nodes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 6181b5678e8..c6e2f1b10d1 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -598,7 +598,8 @@ class node_file(node_class): if fil.parent_id: self.storage_id = fil.parent_id.storage_id.id else: - self.storage_id = None + self.storage_id = None + def get_data(self, cr, fil_obj = None): """ Retrieve the data for some file. @@ -607,12 +608,20 @@ class node_file(node_class): the browse object. """ # this is where storage kicks in.. stor = self.storage_id + if not stor: + data_obj = self.context._dirobj.pool.get('ir.model.data') + data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db') + if data_id: + stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id assert stor stobj = self.context._dirobj.pool.get('document.storage') return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj) def get_data_len(self, cr, fil_obj = None): # TODO: verify with the storage object! + bin_size = self.context.context.get('bin_size', False) + if bin_size and not self.content_length: + self.content_length = fil_obj.db_datas return self.content_length def set_data(self, cr, data, fil_obj = None):