From 7f69fa64b244db039fd18107bdcc5df18dfe87ac Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:34:13 +0300 Subject: [PATCH 1/8] project: expand tabs, cleanyp test_project.yml bzr revid: p_christ@hol.gr-20101019073413-0cgteo1609c1lhfa --- addons/project/test/test_project.yml | 160 +++++++++++++-------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index 8cf8e0afb19..d417debac8c 100644 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -1,108 +1,108 @@ - Test project template feature -- +- Create project 'OpenERP Training Programme' -- +- !record {model: project.project, id: project_project_openerptrainingprogramme0}: company_id: base.main_company - name: OpenERP Training Programme -- + name: OpenERP Training Programme +- Create task 'Technical Training' for this project -- +- !record {model: project.task, id: project_task_technicaltraining0}: date_start: '2010-05-31 11:48:38' name: Technical Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 - state: draft -- + state: draft +- Create task 'Functional Training' for this project -- +- !record {model: project.task, id: project_task_functionaltraining0}: date_start: '2010-05-31 11:49:11' name: Functional Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 - state: draft -- + state: draft +- Set project as project template -- +- !python {model: project.project}: | self.set_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in template state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}: - - state == "template" -- + - state == "template" +- Create new project based on this template -- +- !python {model: project.project}: | new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) if not new_prj: - raise Exception( "New project based on template not created") + raise Exception( "New project based on template not created") new_id = new_prj['res_id'] new_prj = self.read(cr, uid, [new_id], ['name', 'state'])[0] state = new_prj['state'] - name = new_prj['name'] - assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state -- - Reset project template to normal project -- + name = new_prj['name'] + assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state +- + Reset project template to normal project +- !python {model: project.project}: | self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in open state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - - Test for different project-states -- + Test for different project-states +- Keep project pending -- +- !python {model: project.project}: | self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in pending state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}: - - state == "pending" -- + - state == "pending" +- Cancel the project -- +- !python {model: project.project}: | self.set_cancel(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in cancel state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in cancel state}: - state == "cancelled" -- +- Re-open the project -- +- !python {model: project.project}: | self.set_open(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in open state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - @@ -124,16 +124,16 @@ self.compute_hours(cr, uid, [ref('project_task_technicaltraining_remainingwiz0')], {'active_id': ref("project_task_technicaltraining0"),'button_reactivate': True}) - | Check if task 'Technical Training' in open state and for other initial values -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in open state}: - state == "open" - planned_hours == 30 - remaining_hours == 30 - delay_hours == 0.0 - - effective_hours == 0.0 -- + - effective_hours == 0.0 +- Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours -- +- !record {model: project.task, id: project_task_technicaltraining0}: work_ids: - date: '2010-05-31 15:04:22' @@ -146,9 +146,9 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}: - remaining_hours == 20 - effective_hours == 10.0 -- +- Make a work task entry 'Training on OpenERP xml views' of 10 hours -- +- !record {model: project.task, id: project_task_technicaltraining0}: work_ids: - date: '2010-06-01 15:04:46' @@ -161,9 +161,9 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}: - remaining_hours == 10 - effective_hours == 20.0 -- - Make a work task entry 'Training on workflows' of 10 hours -- +- + Make a work task entry 'Training on workflows' of 10 hours +- !record {model: project.task, id: project_task_technicaltraining0}: work_ids: - date: '2010-06-02 15:05:24' @@ -176,20 +176,20 @@ !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}: - remaining_hours == 0 - effective_hours == 30.0 -- - Set remaining hours of 10 hours for reevaluating the task -- +- + Set remaining hours of 10 hours for reevaluating the task +- !record {model: project.task.reevaluate, id: config_compute_remaining_0}: remaining_hours: 10.0 - Reevaluate the task -- +- !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", "project_id": False, "tz": False, "active_model": "project.task", "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - + - Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 - @@ -197,9 +197,9 @@ - planned_hours == 30 - remaining_hours == 10.0 - effective_hours == 30.0 -- +- Make a work task entry 'Training on reports and wizards' of 10 hours -- +- !record {model: project.task, id: project_task_technicaltraining0}: work_ids: - date: '2010-05-31 15:08:40' @@ -213,28 +213,28 @@ - planned_hours == 30 - remaining_hours == 0 - effective_hours == 40.0 -- +- Close the task -- +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) -- +- Check if task in done state -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}: - - state == "done" - - + - state == "done" + + - - Test for task reactivation + Test for task reactivation +- + Reactivate task - - Reactivate task -- !record {model: project.task.reevaluate, id: config_compute_remaining_1}: - remaining_hours: 10.0 -- + remaining_hours: 10.0 +- Reevaluate the task with 10 hours remaining -- +- !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", "project_id": False, "tz": False, "button_reactivate": True, "active_model": @@ -248,9 +248,9 @@ - planned_hours == 30 - remaining_hours == 10.0 - effective_hours == 40.0 -- +- Make a work task entry 'Training on yml' of 5 hours -- +- !record {model: project.task, id: project_task_technicaltraining0}: work_ids: - date: '2010-05-31 16:55:27' @@ -264,16 +264,16 @@ - planned_hours == 30 - remaining_hours == 5.0 - effective_hours == 45.0 -- +- Close the task -- +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) -- +- Check if task in done state -- +- !assert {model: project.task, id: project_task_technicaltraining0, severity: error}: - - state == "done" + - state == "done" - Check for effective hours and remaining hours - @@ -281,16 +281,16 @@ - planned_hours == 30 - remaining_hours == 0.0 - effective_hours == 45.0 -- +- Close project 'OpenERP Training Programme' -- +- !python {model: project.project}: | self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) -- +- Check if project in close state -- +- !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: "Project must be in closed state"}: - - state == "close" - + - state == "close" + From 6b095135b8957922845fba9df889f8d211156898 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:34:32 +0300 Subject: [PATCH 2/8] wiki: expand tabs bzr revid: p_christ@hol.gr-20101019073432-buxfemp2xzhd1g7t --- addons/wiki/web/widgets/wikimarkup/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/wiki/web/widgets/wikimarkup/__init__.py b/addons/wiki/web/widgets/wikimarkup/__init__.py index 5eceea0e86d..ac63feacfbb 100644 --- a/addons/wiki/web/widgets/wikimarkup/__init__.py +++ b/addons/wiki/web/widgets/wikimarkup/__init__.py @@ -1977,9 +1977,9 @@ class Parser(BaseParser): if toclevel < wgMaxTocLevel: toc.append(u"\n") toc.append(u"\n\n" * max(0, toclevel - 1)) - #TODO: use gettext - #toc.insert(0, u'

' + _('Table of Contents') + '

') - toc.insert(0, u'

Table of Contents

') + #TODO: use gettext + #toc.insert(0, u'

' + _('Table of Contents') + '

') + toc.insert(0, u'

Table of Contents

') toc.append(u'\n
') # split up and insert constructed headlines From b7ddcdfe5eb9833293d51b16639eb35b94f8a429 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:34:43 +0300 Subject: [PATCH 3/8] email_template: proper return values, fix fields_view_get() bzr revid: p_christ@hol.gr-20101019073443-x6booxd7044pck62 --- addons/email_template/email_template.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 4e53a895587..7c02334a9fb 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -732,12 +732,16 @@ class email_template_preview(osv.osv_memory): ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model'] model_obj = self.pool.get(ref_obj_name) ref_obj_ids = model_obj.search(cr, uid, [], 0, 20, 'id desc', context=context) + if not ref_obj_ids: + ref_obj_ids = [] # also add the default one if requested, otherwise it won't be available for selection: default_id = context.get('default_rel_model_ref') if default_id and default_id not in ref_obj_ids: ref_obj_ids.insert(0, default_id) return model_obj.name_get(cr, uid, ref_obj_ids, context) + else: + return [] def default_get(self, cr, uid, fields, context=None): if context is None: @@ -761,7 +765,7 @@ class email_template_preview(osv.osv_memory): user, context['template_id'], ['object_name'], - context)['object_name'] + context)['object_name'] or False _columns = { 'ref_template':fields.many2one( @@ -788,7 +792,7 @@ class email_template_preview(osv.osv_memory): 'report':fields.char('Report Name', size=100, readonly=True), } _defaults = { - 'ref_template': lambda self, cr, uid, ctx:ctx['template_id'], + 'ref_template': lambda self, cr, uid, ctx:ctx['template_id'] or False, 'rel_model': _default_model, } def on_change_ref(self, cr, uid, ids, rel_model_ref, context=None): From dbc5924697b74ee6b83ad518a9b8737f721c0cdd Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:35:03 +0300 Subject: [PATCH 4/8] sale_layout: fix inheriting form bzr revid: p_christ@hol.gr-20101019073503-ncmzgprfgsuve0wg --- addons/sale_layout/sale_layout_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index f184f79da49..3eac7eb1f3f 100755 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -10,7 +10,7 @@ form - + From 2f751b3baf613f83e4e8456125ae78a4163b8385 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:36:18 +0300 Subject: [PATCH 5/8] project_retro_planning: fix YAML We need to enter a full date+time, since the field is one. bzr revid: p_christ@hol.gr-20101019073618-nex0uqopdxxvzzh1 --- addons/project_retro_planning/test/deadline_change.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_retro_planning/test/deadline_change.yml b/addons/project_retro_planning/test/deadline_change.yml index 3e778916792..012bc62a4eb 100644 --- a/addons/project_retro_planning/test/deadline_change.yml +++ b/addons/project_retro_planning/test/deadline_change.yml @@ -10,7 +10,7 @@ Create task 'Plan all projects' - !record {model: project.task, id: project_task_planallprojects0}: - date_deadline: '2010-06-07' + date_deadline: '2010-06-07 12:00:00' date_end: '2010-06-04 14:00:00' date_start: '2010-06-01 17:25:32' name: Plan all projects From ddb8793c9be33c49c8e60b82cfe28b6ec4961d15 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:36:28 +0300 Subject: [PATCH 6/8] product_expiry: return False as default for unknown dates This /might/ solve a problem with fields_view_get(). bzr revid: p_christ@hol.gr-20101019073628-538wuaxmipzcvjxb --- addons/product_expiry/product_expiry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py index fbfa7dc1610..01ce50dead8 100644 --- a/addons/product_expiry/product_expiry.py +++ b/addons/product_expiry/product_expiry.py @@ -40,7 +40,7 @@ class stock_production_lot(osv.osv): # set date to False when no expiry time specified on the product date = duration and (datetime.datetime.today() + datetime.timedelta(days=duration)) - return date and date.strftime('%Y-%m-%d %H:%M:%S') + return date and date.strftime('%Y-%m-%d %H:%M:%S') or False return calc_date _columns = { From aac190d37af2adce0d0ad7726bc2701e6c85f296 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:37:52 +0300 Subject: [PATCH 7/8] account_cash_statement: complain where a new statement has no journal It wouldn't be able to create in either case, but have a more user-friendly message. bzr revid: p_christ@hol.gr-20101019073752-bpswr274h1lzctwm --- addons/account/account_cash_statement.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index f88d38734f2..454290c3c5f 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -241,6 +241,8 @@ class account_cash_statement(osv.osv): } def create(self, cr, uid, vals, context=None): + if 'journal_id' not in vals: + raise osv.except_osv('Error', _('You cannot create a bank or cash register without a journal!')) sql = [ ('journal_id', '=', vals['journal_id']), ('state', '=', 'open') @@ -381,4 +383,4 @@ class account_cash_statement(osv.osv): account_cash_statement() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 462caf9d1277f8988c0157abde7fb85c9aa528f7 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 11:38:17 +0300 Subject: [PATCH 8/8] survey: fix non-latin in report, f-v-g() of wizard. bzr revid: p_christ@hol.gr-20101019083817-e1akroq2fl3e2poy --- .../survey/report/survey_browse_response.py | 4 +-- addons/survey/wizard/survey_answer.py | 29 ++++++++++++++----- addons/survey/wizard/survey_selection.py | 6 ++-- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index a2ee95e417e..408a266d2cf 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -201,11 +201,11 @@ class survey_browse_response(report_rml): for survey in surv_obj.browse(cr, uid, [response.survey_id.id]): tbl_width = float(_tbl_widths.replace('cm', '')) colwidth = "4.6cm,5cm," + str(tbl_width - 16.4) +"cm,4cm,3cm" + resp_create = tools.ustr(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) rml += """ Answer Create Date:- - # *-* formatting hard coded, breaks with utf8 - """ + to_xml(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) + """ + """ + to_xml(resp_create) + """ Answer By:- """ + to_xml(response.user_id.login or '') + """ diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 109f4509d81..9e4c801af2d 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -76,29 +76,43 @@ class survey_question_wiz(osv.osv_memory): sur_name_rec = surv_name_wiz.browse(cr, uid, wiz_id) context.update({'sur_name_id' :wiz_id}) else: - sur_name_rec = surv_name_wiz.browse(cr, uid, context.get('sur_name_id', False)) + sur_name_rec = surv_name_wiz.browse(cr, uid, context['sur_name_id']) if context.has_key('active_id'): context.pop('active_id') survey_id = context.get('survey_id', False) + if not survey_id: + # Try one more time to find it + if sur_name_rec.survey_id: + survey_id = sur_name_rec.survey_id[0] + else: + # raise osv.except_osv(_('Error!'), _("Cannot locate survey for the question wizard!")) + # If this function is called without a survey_id in + # its context, it makes no sense to return any view. + # Just return the default, empty view for this object, + # in order to please random calls to this fn(). + return super(survey_question_wiz, self).\ + fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, + toolbar=toolbar, submenu=submenu) + sur_rec = survey_obj.browse(cr, uid, survey_id) p_id = map(lambda x:x.id, sur_rec.page_ids) total_pages = len(p_id) pre_button = False readonly = 0 - if context.has_key('response_id') and context.get('response_id', False) \ + if context.get('response_id', False) \ and int(context['response_id'][0]) > 0: readonly = 1 if not sur_name_rec.page_no + 1 : - surv_name_wiz.write(cr, uid, [context.get('sur_name_id',False)], {'store_ans':{}}) + surv_name_wiz.write(cr, uid, [context['sur_name_id'],], {'store_ans':{}}) - sur_name_read = surv_name_wiz.browse(cr, uid, context.get('sur_name_id',False)) + sur_name_read = surv_name_wiz.browse(cr, uid, context['sur_name_id']) page_number = int(sur_name_rec.page_no) if sur_name_read.transfer or not sur_name_rec.page_no + 1: - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)], {'transfer':False}) + surv_name_wiz.write(cr, uid, [context['sur_name_id']], {'transfer':False}) flag = False fields = {} if sur_name_read.page == "next" or sur_name_rec.page_no == -1: @@ -119,7 +133,7 @@ class survey_question_wiz(osv.osv_memory): survey_obj.write(cr, uid, survey_id, {'state':'close', 'date_close':strftime("%Y-%m-%d %H:%M:%S")}) p_id = p_id[sur_name_rec.page_no + 1] - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)], {'page_no' : sur_name_rec.page_no + 1}) + surv_name_wiz.write(cr, uid, [context['sur_name_id'],], {'page_no' : sur_name_rec.page_no + 1}) flag = True page_number += 1 if sur_name_rec.page_no > - 1: @@ -127,7 +141,7 @@ class survey_question_wiz(osv.osv_memory): else: if sur_name_rec.page_no != 0: p_id = p_id[sur_name_rec.page_no - 1] - surv_name_wiz.write(cr, uid, [context.get('sur_name_id', False)],\ + surv_name_wiz.write(cr, uid, [context['sur_name_id'],],\ {'page_no' : sur_name_rec.page_no - 1}) flag = True page_number -= 1 @@ -140,6 +154,7 @@ class survey_question_wiz(osv.osv_memory): xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) if context.has_key('response_id') and context.get('response_id', False) \ and int(context.get('response_id',0)[0]) > 0: + # TODO: l10n, cleanup this code to make it readable. Or template? xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'}) record = sur_response_obj.browse(cr, uid, context['response_id'][context['response_no']]) etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr('Answer Of :- ' + record.user_id.name + ', Date :- ' + record.date_create.split('.')[0] )), 'align':"0.0"}) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 0f7ca8628f0..2ef83d38fcf 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -27,7 +27,7 @@ from tools.translate import _ class survey_name_wiz(osv.osv_memory): _name = 'survey.name.wiz' - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): """ Set the default value in survey_id field. if open this wizard in survey form then set the default value in survey_id = active survey id. @@ -38,7 +38,7 @@ class survey_name_wiz(osv.osv_memory): @param context: A standard dictionary for contextual values @return : Dictionary value for created survey statistics report """ - if not context: + if context is None: context = {} data = super(survey_name_wiz, self).default_get(cr, uid, fields, context) if context.has_key('survey_id'): @@ -75,7 +75,7 @@ class survey_name_wiz(osv.osv_memory): u_list.append(use.id) if uid in u_list: result.append((sur.id, sur.title)) - return result + return result for sur in surv_obj.browse(cr, uid, surv_obj.search(cr, uid, [])): if sur.state == 'open': res = False