From fba0a0032826b6f9be55faf5d73ccca67c33dcac Mon Sep 17 00:00:00 2001 From: jas Date: Sat, 16 Oct 2010 16:13:47 +0530 Subject: [PATCH 01/36] [IMP] project: improved tasks analysis bzr revid: jas@tinyerp.com-20101016104347-h2355o7drlzs9h2w --- addons/project/report/project_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index eb781690c1b..94f9ce9d745 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -149,7 +149,7 @@ Get detailed analysis by task - + From e9336e5e03a4a03cca6bc4411249cf97422031ac Mon Sep 17 00:00:00 2001 From: jas Date: Mon, 18 Oct 2010 12:06:11 +0530 Subject: [PATCH 02/36] [IMP] document : improved search view bzr revid: jas@tinyerp.com-20101018063611-v7ls2kptyrwagfqv --- addons/document/document.py | 3 +- addons/document/document_view.xml | 53 ++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/addons/document/document.py b/addons/document/document.py index 92a00f3222c..552fdf235df 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -90,7 +90,7 @@ class document_file(osv.osv): 'partner_id':fields.many2one('res.partner', 'Partner', select=1), 'file_size': fields.integer('File Size', required=True), 'file_type': fields.char('Content Type', size=128), - + 'company_id': fields.many2one('res.company', 'Company'), # fields used for file storage 'store_fname': fields.char('Stored Filename', size=200), } @@ -101,6 +101,7 @@ class document_file(osv.osv): return dirobj._get_root_directory(cr, uid, context) _defaults = { + 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.attachment', context=c), 'user_id': lambda self, cr, uid, ctx:uid, 'file_size': lambda self, cr, uid, ctx:0, 'parent_id': __get_def_directory diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index e5719705ebe..9b20a6ef048 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -278,41 +278,56 @@ - - IR Attachment0 + + IR Attachment ir.attachment search - - - - - - + + + - - + + + IR Attachment + ir.attachment + search + + + + + + + + + + + + + + + - - + IR Attachment2 ir.attachment search - - - + + + - + From 1bd0ee3fc3ea1b46584bca7ea20c6dd70a63b064 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 19 Oct 2010 12:59:52 +0530 Subject: [PATCH 03/36] [IMP]: crm: Improvement in domain for opportunities in statistics dashboard bzr revid: rpa@tinyerp.com-20101019072952-rud8dk3xrgrc21mp --- addons/crm/board_crm_statistical_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/board_crm_statistical_view.xml b/addons/crm/board_crm_statistical_view.xml index bd952d9e9ba..ae76031ecc0 100644 --- a/addons/crm/board_crm_statistical_view.xml +++ b/addons/crm/board_crm_statistical_view.xml @@ -48,7 +48,7 @@ form graph,tree,form - [('state','!=','done'),('state','!=','cancel')] + [('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')] @@ -56,7 +56,7 @@ form graph,tree,form - [('state','!=','done'),('state','!=','cancel')] + [('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')] From 7f69fa64b244db039fd18107bdcc5df18dfe87ac Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 19 Oct 2010 10:34:13 +0300 Subject: [PATCH 04/36] 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 05/36] 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 06/36] 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 07/36] 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 08/36] 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 09/36] 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 10/36] 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 11/36] 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 From bc3e0aae692b74655b1d43ff74f4b6a29189866e Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 19 Oct 2010 16:55:33 +0530 Subject: [PATCH 12/36] [IMP]: crm_claim: Report a claim should fill partner data by default bzr revid: rpa@tinyerp.com-20101019112533-rulf9mkxiep33lwp --- addons/crm_claim/crm_claim_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index 975e8d33bec..8175dd20da6 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -325,7 +325,7 @@ Date: Tue, 19 Oct 2010 18:10:08 +0530 Subject: [PATCH 13/36] [FIX] fixed no reference to project.group_project_finance_user for Tasks Analysis bzr revid: jas@tinyerp.com-20101019124008-e6b1dw94a5hniwim --- addons/project/report/project_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index 832967f115a..aec1296b3c4 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -149,7 +149,7 @@ This report allows you to analyse the performance of your projects and users. You can analyse the quantities of tasks, the hours spent compared to the planned hours, the average number of days to open or close a task, etc. - + From d9f36476d5717c34d94a4112ccfd43700e15d7c3 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 16:34:52 +0530 Subject: [PATCH 15/36] [IMP]: sale: Added rule to display sale orders of current user only * Put current user as default salesman in search view bzr revid: rpa@tinyerp.com-20101020110452-g1juwcgks1mrvnyv --- addons/sale/sale_view.xml | 1 + addons/sale/security/sale_security.xml | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index b9eabcaa02e..3431c911a97 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -292,6 +292,7 @@ form tree,form,calendar,graph + {"search_default_user_id":uid} Sales Orders helps you manage quotations and orders done with your customers. OpenERP suggests that you to start by creating a quotation. Once the order is confirmed, the quotation is converted into a Sale Order. OpenERP can handle several types of products so that a sales order can trigger tasks, delivery orders, manufacturing orders, purchases and so on. Based on the configuration of the sale order, a draft invoice will be generated so that you just have to confirm it when you want to bill your customer. diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml index 36a8fc15118..27852979773 100644 --- a/addons/sale/security/sale_security.xml +++ b/addons/sale/security/sale_security.xml @@ -31,6 +31,19 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + Personal Orders + + ['|',('user_id','=',user.id),('user_id','=',False)] + + + + + Personal Order Lines + + ['|',('order_id.user_id','=',user.id),('order_id.user_id','=',False)] + + From b57746aa19914c9cab1510bab1db9afc87a85897 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 16:36:17 +0530 Subject: [PATCH 16/36] [FIX]: sale: Fixed error when confirming sale order having lines without product bzr revid: rpa@tinyerp.com-20101020110617-bqkc4m4sp87asxh4 --- addons/sale/sale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index caee07d4aff..7b7f098ffd9 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -940,9 +940,10 @@ class sale_order_line(osv.osv): 'for this product: "%s" (id:%d)') % \ (line.product_id.name, line.product_id.id,)) else: - a = self.pool.get('ir.property').get(cr, uid, + prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', - context=context).id + context=context) + a = prop and prop.id or False uosqty = _get_line_qty(line) uos_id = _get_line_uom(line) pu = 0.0 From 99ff1171680817e3bd8924d59b8f52fba3dee0bb Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 17:11:39 +0530 Subject: [PATCH 17/36] [FIX]: event: Fixed access right to open partner menu for sales user bzr revid: rpa@tinyerp.com-20101020114139-xojcqy1kilkiy65l --- addons/event/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/event/security/ir.model.access.csv b/addons/event/security/ir.model.access.csv index 9ee5ae7ec80..a2e4b55bed5 100644 --- a/addons/event/security/ir.model.access.csv +++ b/addons/event/security/ir.model.access.csv @@ -13,3 +13,4 @@ "access_event_event_sale_salesman","event.event.sale","model_event_event","base.group_sale_salesman",1,0,0,0 "access_account_account_invoice_manager","account.account.invoice","account.model_account_invoice","base.group_marketing_manager",1,0,0,0 "access_event_registration_badge","event.registration.badge","model_event_registration_badge","marketing.group_marketing_user",1,0,0,0 +"access_event_registration_sale_user","event.registration.sale.user","model_event_registration","base.group_sale_salesman",1,0,0,0 From 2ca04d347f030f08d6a8e26ca4d102a22a17d9af Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 17:50:32 +0530 Subject: [PATCH 18/36] [ADD,REM,IMP]: hr_payroll_account, share, crm_profiling: Improvements for security warnings bzr revid: rpa@tinyerp.com-20101020122032-3zxovx028cpm093g --- addons/crm_profiling/security/ir.model.access.csv | 2 ++ addons/hr_payroll_account/__openerp__.py | 3 ++- addons/hr_payroll_account/security/ir.model.access.csv | 2 ++ addons/share/__openerp__.py | 1 - addons/share/security/ir.model.access.csv | 2 -- 5 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 addons/hr_payroll_account/security/ir.model.access.csv delete mode 100644 addons/share/security/ir.model.access.csv diff --git a/addons/crm_profiling/security/ir.model.access.csv b/addons/crm_profiling/security/ir.model.access.csv index 6ba022b2535..fb110ba70d1 100644 --- a/addons/crm_profiling/security/ir.model.access.csv +++ b/addons/crm_profiling/security/ir.model.access.csv @@ -3,3 +3,5 @@ "access_crm_profiling_answer_manager","crm_profiling.answer manager","model_crm_profiling_answer","base.group_sale_manager",1,0,0,0 "access_crm_profiling_question_manager","crm_profiling.question manager","model_crm_profiling_question","base.group_sale_salesman",1,1,1,0 "access_crm_profiling_question_user","crm_profiling.question user","model_crm_profiling_question","base.group_sale_manager",1,0,0,0 +"access_crm_profiling_questionnarie_user","crm_profiling.questionnarie user","model_crm_profiling_questionnaire","base.group_sale_salesman",1,0,0,0 +"access_crm_profiling_questionnarie_manager","crm_profiling.questionnarie manager","model_crm_profiling_questionnaire","base.group_sale_manager",1,1,1,1 diff --git a/addons/hr_payroll_account/__openerp__.py b/addons/hr_payroll_account/__openerp__.py index 9da1394382a..563f1b52bc1 100644 --- a/addons/hr_payroll_account/__openerp__.py +++ b/addons/hr_payroll_account/__openerp__.py @@ -38,6 +38,7 @@ 'init_xml': [ ], 'update_xml': [ + "security/ir.model.access.csv", "hr_payroll_account_view.xml", ], 'demo_xml': [ @@ -47,4 +48,4 @@ 'active': False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_payroll_account/security/ir.model.access.csv b/addons/hr_payroll_account/security/ir.model.access.csv new file mode 100644 index 00000000000..d71b8404a12 --- /dev/null +++ b/addons/hr_payroll_account/security/ir.model.access.csv @@ -0,0 +1,2 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_hr_payslip_account_move_user","access.hr.payslip.account.move.user","model_hr_payslip_account_move","base.group_user",1,0,0,0 diff --git a/addons/share/__openerp__.py b/addons/share/__openerp__.py index 4f2eafb4e52..21b63fd3bc1 100644 --- a/addons/share/__openerp__.py +++ b/addons/share/__openerp__.py @@ -43,7 +43,6 @@ 'website': 'http://www.openerp.com', 'data': [ 'security/share_security.xml', - 'security/ir.model.access.csv', 'share_view.xml', 'res_users_view.xml', 'wizard/share_wizard_view.xml' diff --git a/addons/share/security/ir.model.access.csv b/addons/share/security/ir.model.access.csv deleted file mode 100644 index a8f37d300c6..00000000000 --- a/addons/share/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_share_wizard_user","access_share_wizard_user","model_share_wizard","share.group_share_user",1,1,1,1 \ No newline at end of file From dc02be1d0710c8185295918c0df7101607864b92 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 19:08:53 +0530 Subject: [PATCH 19/36] [FIX]: association: Fixed duplicate menu bzr revid: rpa@tinyerp.com-20101020133853-yktsrcmisbv038z1 --- addons/association/profile_association.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml index d5a5baab946..7b9ddb4ebc3 100644 --- a/addons/association/profile_association.xml +++ b/addons/association/profile_association.xml @@ -54,7 +54,6 @@ - From 42f09c3188298b3e2c751d9464ce0c51ce34e6c3 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 20 Oct 2010 19:11:01 +0530 Subject: [PATCH 20/36] [FIX]: auction: Fixed access rights for auction user bzr revid: rpa@tinyerp.com-20101020134101-tgr8oxcbff3q7c91 --- addons/auction/security/ir.model.access.csv | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/auction/security/ir.model.access.csv b/addons/auction/security/ir.model.access.csv index 5458e6c2ac3..94c9c1f83aa 100644 --- a/addons/auction/security/ir.model.access.csv +++ b/addons/auction/security/ir.model.access.csv @@ -1,11 +1,13 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_auction_artists","auction.artists","model_auction_artists","group_auction_manager",1,1,1,1 +"access_auction_dates_user","auction.dates user","model_auction_dates","group_auction_user",1,0,0,0 "access_auction_dates_manager","auction.dates manager","model_auction_dates","group_auction_manager",1,1,1,1 "access_auction_deposit_manager","auction.deposit manager","model_auction_deposit","group_auction_manager",1,1,1,1 +"access_auction_deposit_user","auction.deposit user","model_auction_deposit","group_auction_user",1,0,0,0 "access_auction_deposit_cost","auction.deposit.cost","model_auction_deposit_cost","group_auction_manager",1,1,1,1 "access_auction_lot_category","auction.lot.category","model_auction_lot_category","group_auction_user",1,0,0,0 "access_auction_lot_category_manager","auction.lot.category manager","model_auction_lot_category","group_auction_manager",1,1,1,1 -"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,1 +"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,0 "access_auction_lots_manager","auction.lots manager","model_auction_lots","group_auction_manager",1,0,0,0 "access_auction_bid","auction.bid","model_auction_bid","group_auction_user",1,1,1,1 "access_auction_bid_manager","auction.bid manager","model_auction_bid","group_auction_manager",1,0,0,0 @@ -18,6 +20,7 @@ "access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","group_auction_manager",1,1,1,1 "access_report_object_encoded","report.object.encoded","model_report_object_encoded","group_auction_manager",1,1,1,1 "access_aie_category","aie.category","model_aie_category","group_auction_manager",1,1,1,1 +"access_auction_account_tax_user","account.tax user","account.model_account_tax","group_auction_user",1,0,0,0 "access_auction_account_tax","account.tax manager","account.model_account_tax","group_auction_manager",1,1,1,0 "access_auction_account_fiscalyear","account.fiscalyear manager","account.model_account_fiscalyear","group_auction_manager",1,1,1,0 "access_auction_account_journal","account.journal manager","account.model_account_journal","group_auction_manager",1,1,1,0 From 7f9d3675330fc09d81664e9f4e0fe1118975425d Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 21 Oct 2010 11:42:52 +0530 Subject: [PATCH 21/36] [FIX]: Project issue history shown in tab email bzr revid: ksa@tinyerp.co.in-20101021061252-iusjp11g48hnxr52 --- addons/project_issue/project_issue_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 3894740f0f1..e3493f5af9b 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -93,7 +93,7 @@