From 3666ed98289408b1d2a4f914dbc7ef395ff27b19 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 13 Jun 2012 11:02:22 +0200 Subject: [PATCH 001/169] [FIX] (safe_eval) opcode STORE_MAP belongs into _CONST_OPCODES otherwise, const_eval("{'hello':'world'}") won't work bzr revid: hbrunn@therp.nl-20120613090222-gt33zwz1aymcmxqo --- openerp/tools/safe_eval.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/tools/safe_eval.py b/openerp/tools/safe_eval.py index 601fd95200a..1c3870004a7 100644 --- a/openerp/tools/safe_eval.py +++ b/openerp/tools/safe_eval.py @@ -46,7 +46,7 @@ _ALLOWED_MODULES = ['_strptime', 'time'] _CONST_OPCODES = set(opmap[x] for x in [ 'POP_TOP', 'ROT_TWO', 'ROT_THREE', 'ROT_FOUR', 'DUP_TOP', 'DUP_TOPX', 'POP_BLOCK','SETUP_LOOP', 'BUILD_LIST', 'BUILD_MAP', 'BUILD_TUPLE', - 'LOAD_CONST', 'RETURN_VALUE', 'STORE_SUBSCR'] if x in opmap) + 'LOAD_CONST', 'RETURN_VALUE', 'STORE_SUBSCR', 'STORE_MAP'] if x in opmap) _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [ 'UNARY_POSITIVE', 'UNARY_NEGATIVE', 'UNARY_NOT', @@ -61,7 +61,7 @@ _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [ ] if x in opmap)) _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [ - 'STORE_MAP', 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', + 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', 'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'DELETE_NAME', 'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE', 'MAKE_FUNCTION', 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3', From df107e19ec3e51827721f96557dd97927c23126d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 3 Sep 2012 14:16:25 +0530 Subject: [PATCH 002/169] [FIX] pass context in search and name_get method inside name_search. bzr revid: tpa@tinyerp.com-20120903084625-nnkl9k2ljaauv4bh --- openerp/addons/base/res/res_users.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index ca45f03258c..012ab8a116a 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -310,10 +310,10 @@ class res_users(osv.osv): context={} ids = [] if name: - ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit) + ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit, context=context) if not ids: - ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit) - return self.name_get(cr, user, ids) + ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) + return self.name_get(cr, user, ids, context=context) def copy(self, cr, uid, id, default=None, context=None): user2copy = self.read(cr, uid, [id], ['login','name'])[0] From e6178297dfea0f56c887467f0c5486c06243719f Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 18 Sep 2012 10:40:18 +0530 Subject: [PATCH 003/169] [IMP]all : set appropriate method on action for mark read as well as unread for fix the issue of read and unread bzr revid: mma@tinyerp.com-20120918051018-ghdv7tk80g5pqlq6 --- addons/base_calendar/crm_meeting_view.xml | 4 ++-- addons/crm/crm_lead_view.xml | 4 ++-- addons/crm/crm_phonecall_view.xml | 4 ++-- addons/event/event_view.xml | 8 ++++---- addons/hr_holidays/hr_holidays_view.xml | 4 ++-- addons/hr_recruitment/hr_recruitment_view.xml | 4 ++-- addons/project/project_view.xml | 8 ++++---- addons/project_issue/project_issue_view.xml | 4 ++-- addons/purchase/purchase_view.xml | 4 ++-- addons/sale/sale_view.xml | 4 ++-- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index 928f8d94d5c..50ea749bff1 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -10,7 +10,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_crm_meeting_read @@ -28,7 +28,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_crm_meeting_unread diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index f018a355579..bca64f863cf 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -9,7 +9,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_crm_lead_unread @@ -27,7 +27,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_crm_lead_read diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 2f885e09b61..4b6352bb86e 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -9,7 +9,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_crm_phonecall_unread @@ -27,7 +27,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_crm_phonecall_read diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index e2ff2e67e87..36bdbef75b2 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -65,7 +65,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_event_event_unread @@ -83,7 +83,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_event_event_read @@ -387,7 +387,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_event_registration_unread @@ -405,7 +405,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_event_registration_read diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 5a2e0603b88..92ebebc5d5c 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -8,7 +8,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_holidays_unread @@ -26,7 +26,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_holidays_read diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 098a8aec210..838bda35db7 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -42,7 +42,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_project_unread @@ -60,7 +60,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_project_read diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index ff8ac943a67..466472d7324 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -27,7 +27,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_project_unread @@ -45,7 +45,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_project_read @@ -354,7 +354,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_project_task_unread @@ -372,7 +372,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_project_task_read diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index fea22c519a8..1683256673b 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -11,7 +11,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_project_issue_unread @@ -29,7 +29,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_project_issue_read diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 53f27245e7e..e020092eb40 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -118,7 +118,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_purchase_order_unread @@ -136,7 +136,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_purchase_order_read diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 651454ef73d..0c71a1961b4 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -77,7 +77,7 @@ ir.actions.server code - self.message_check_and_set_unread(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_unread(cr, uid, context.get('active_ids'), context=context) action_sale_order_unread @@ -95,7 +95,7 @@ ir.actions.server code - self.message_check_and_set_read(cr, uid, context.get('active_ids'), context=context) + self.message_mark_as_read(cr, uid, context.get('active_ids'), context=context) action_sale_order_read From fd6da42e301f8061fbc9657a2d76dc664e7ca9d0 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 3 Oct 2012 16:53:19 +0530 Subject: [PATCH 004/169] [IMP] project_timesheet : Click on timesheet button from a new project. You will get this 'Record your timesheets for the project '%s''.Instead of name of the project. bzr revid: mdi@tinyerp.com-20121003112319-ancbub1h7u5mtylk --- addons/project_timesheet/project_timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 4036217b886..87699401e09 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -50,7 +50,7 @@ class project_project(osv.osv): 'search_default_account_id': [project.analytic_account_id.id], 'default_account_id': project.analytic_account_id.id, } - help = _("""

Record your timesheets for the project '%s'.

""") + help = _("""

Record your timesheets for the project '%s'.

""") % (project.name,) try: if project.to_invoice and project.partner_id: help+= _("""

Timesheets on this project may be invoiced to %s, according to the terms defined in the contract.

""" ) % (project.partner_id.name,) From 6401dc03d76021030c9b686cb1ea2e4fd990a40a Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 3 Oct 2012 17:39:55 +0530 Subject: [PATCH 005/169] [IMP] project : 'Task Stages' tab should be visible only if 'tasks' is checked. bzr revid: mdi@tinyerp.com-20121003120955-vhxaey5fdhzkk89q --- 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 bd63eec84c5..442efd4660e 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -144,7 +144,7 @@ - + From c8a093941d6e8da9223def633354cd86b82df6a5 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 3 Oct 2012 17:54:46 +0530 Subject: [PATCH 006/169] [IMP] project : Added 'date_start' on project form view. bzr revid: mdi@tinyerp.com-20121003122446-e4iwfe3ctrzq2yt5 --- addons/project/project_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 442efd4660e..b07fb17614f 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -135,6 +135,7 @@ + From b273232b71865369f4be306e496b471423b0e299 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 4 Oct 2012 17:10:21 +0530 Subject: [PATCH 007/169] [FIX] project_timesheet : Fix the integrity error when we embeded 'Timesheet Line' created through project. bzr revid: mdi@tinyerp.com-20121004114021-rgbzhr84uditlhhj --- addons/project_timesheet/project_timesheet.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 41478d60210..6125d59c621 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -46,6 +46,9 @@ class project_project(osv.osv): def open_timesheets(self, cr, uid, ids, context=None): """ open Timesheets view """ + mod_obj = self.pool.get('ir.model.data') + act_obj = self.pool.get('ir.actions.act_window') + project = self.browse(cr, uid, ids[0], context) view_context = { 'search_default_account_id': [project.analytic_account_id.id], @@ -59,16 +62,13 @@ class project_project(osv.osv): # if the user do not have access rights on the partner pass - return { - 'type': 'ir.actions.act_window', - 'name': _('Timesheets'), - 'res_model': 'hr.analytic.timesheet', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'context': view_context, - 'nodestroy': True, - 'help': help - } + result = mod_obj.get_object_reference(cr, uid, 'hr_timesheet', 'act_hr_timesheet_line_evry1_all_form') + id = result and result[1] or False + result = act_obj.read(cr, uid, [id], context=context)[0] + result['name'] = _('Timesheets') + result['context'] = view_context + result['help'] = help + return result project_project() From f00e26b9ca52c3261c270a22d3fda6a38e786c30 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Thu, 4 Oct 2012 18:36:06 +0530 Subject: [PATCH 008/169] [FIX] weekly,monthly report problem in hr module bzr revid: shp@tinyerp.com-20121004130606-ju9ahpnk20qxeeyr --- addons/hr_attendance/report/attendance_by_month.py | 4 +++- addons/hr_attendance/report/timesheet.py | 2 +- addons/hr_attendance/wizard/hr_attendance_byweek.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index 17cf548345e..ab6ba3ce609 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -84,8 +84,10 @@ class report_custom(report_rml): # sum up the attendances' durations ldt = None for att in attendences: - dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') + dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') if ldt and att['action'] == 'sign_out': + if dt.date() > ldt.date(): + dt = ldt wh += (float((dt - ldt).seconds)/60/60) else: ldt = dt diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 900f982dc74..fdb2569b4a2 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -38,7 +38,7 @@ class report_custom(report_rml): def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') - + ids = datas['active_ids'] start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().weekday()) diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index 9ee69a937d1..454ba7764da 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -37,6 +37,7 @@ class hr_attendance_byweek(osv.osv_memory): def print_report(self, cr, uid, ids, context=None): datas = { 'ids': [], + 'active_ids': context['active_ids'], 'model': 'hr.employee', 'form': self.read(cr, uid, ids)[0] } From 529b8c9e64c8bce4f628cbc89ef4b3cb5e5c6b9f Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 5 Oct 2012 12:25:08 +0530 Subject: [PATCH 009/169] [FIX] widget is undefined when press cost and revenus bzr revid: shp@tinyerp.com-20121005065508-4axokyk4llathg21 --- addons/account/project/project_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 70db95425b1..342663e700f 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -160,7 +160,7 @@ account.analytic.line.tree account.analytic.line - + From 12c0f14d3916dc79aa1d1a13521b2589f311bdb6 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Fri, 5 Oct 2012 14:12:13 +0530 Subject: [PATCH 010/169] [FIX] remove duplicate name when click sign in/out project bzr revid: shp@tinyerp.com-20121005084213-d4qkc25iyy5maq0m --- addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py index e92e88bdcbd..031a17baee0 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -147,7 +147,7 @@ class hr_si_project(osv.osv_memory): 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'hr.sign.%s.project' % in_out, - 'views': [(False,'tree'), (resource_id,'form')], + 'views': [(resource_id,'form')], 'type': 'ir.actions.act_window', 'target': 'new' } From ddb869f1804da7ad549dc9565653c861ab77ba0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 5 Oct 2012 16:06:16 +0200 Subject: [PATCH 011/169] [FIX] fixing css errors as reported by firefox bzr revid: fva@openerp.com-20121005140616-w5tulvk6v6hesjmn --- addons/point_of_sale/static/src/css/pos.css | 2 +- addons/process/static/src/css/process.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index cbb625c02d7..81c6a1e1a6e 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -897,7 +897,7 @@ width: 100%; height: 100%; margin: 0; - margin-right: 18px + margin-right: 18px; font-family: "Inconsolata"; color: #6c6c6c; text-shadow: 0px 3px 3px rgba(0,0,0, 0.2); diff --git a/addons/process/static/src/css/process.css b/addons/process/static/src/css/process.css index 7442db9bc4a..5f438622653 100644 --- a/addons/process/static/src/css/process.css +++ b/addons/process/static/src/css/process.css @@ -44,7 +44,7 @@ a.cta-a strong { background-color:#FFF; } .process_canvas svg{ - height:500px;!important; + height:500px; padding:15px; } .oe_process { From 6761871c4ea8427da90703d942f553b7334d6043 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Mon, 8 Oct 2012 10:40:14 +0530 Subject: [PATCH 012/169] [IMP] indentation of active ids of timesheet.py bzr revid: shp@tinyerp.com-20121008051014-fvftsi2mt44abyyn --- addons/hr_attendance/report/timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index fdb2569b4a2..326ffce63e0 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -38,7 +38,7 @@ class report_custom(report_rml): def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') - ids = datas['active_ids'] + ids = datas['active_ids'] start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().weekday()) From 667da9253fd647a7888d7986d996b9c66f4797e7 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Mon, 8 Oct 2012 15:04:56 +0530 Subject: [PATCH 013/169] [IMP] Exprience instead of Experience bzr revid: shp@tinyerp.com-20121008093456-ff27x03xt89v4og3 --- addons/hr_recruitment/hr_recruitment_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 21f4e48e42d..1bedd411cf2 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -312,7 +312,7 @@ You can automatically create application records from an email gateway, that you This question requires an answer. - Exprience + Experience comment The comment you entered is in an invalid format. From 82138688a2d27337fc30d0143d00bd7275754e00 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Mon, 8 Oct 2012 21:16:47 +0530 Subject: [PATCH 014/169] [FIX]: Fix analytic line shown. bzr revid: atp@tinyerp.com-20121008154647-bdxw4ajq5hgb7jsk --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index cd58f52f959..76c6ac7ca35 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -468,7 +468,7 @@ class hr_timesheet_line(osv.osv): for ts_line in self.browse(cursor, user, ids, context=context): sheet_ids = sheet_obj.search(cursor, user, [('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), - ('employee_id.user_id', '=', ts_line.user_id.id)], + ('employee_id.user_id', '=', ts_line.sheet_id and ts_line.sheet_id.employee_id.user_id.id)], context=context) if sheet_ids: # [0] because only one sheet possible for an employee between 2 dates From f44f548f066e98d62b05ec762e46997d85a7a932 Mon Sep 17 00:00:00 2001 From: Vishmita Date: Tue, 9 Oct 2012 12:49:54 +0530 Subject: [PATCH 015/169] [IMP]replace callenabled for on_write bzr revid: vja@tinyerp.com-20121009071954-jojvmfs7cjuc0elg --- addons/web_diagram/static/src/js/diagram.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index 508aeb30563..35ce3277116 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -240,9 +240,9 @@ instance.web.DiagramView = instance.web.View.extend({ } ); - pop.on_write.add(function() { + pop.on('on_write_complete',self,function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); - }); + }); var form_fields = [self.parent_field]; var form_controller = pop.view_form; @@ -303,7 +303,7 @@ instance.web.DiagramView = instance.web.View.extend({ title: _t("Open: ") + title } ); - pop.on_write.add(function() { + pop.on('on_write_complete',self,function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); }, From fbe1e7f913571f8dbbaddeceb5d877d09bc5f6df Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Tue, 9 Oct 2012 16:18:42 +0530 Subject: [PATCH 016/169] [FIX]: analytic account onchange problem. bzr revid: atp@tinyerp.com-20121009104842-njdr868dtc4ly1w9 --- addons/analytic_user_function/analytic_user_function.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 9233845f7eb..7ac947981fc 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -65,7 +65,7 @@ class hr_analytic_timesheet(osv.osv): return False - def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): + def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): res = {} if not (account_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index b752ade8da0..95fa39a6eda 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -50,7 +50,7 @@ - +
@@ -72,7 +72,7 @@ - + From 2bacc70085275b15b74a2b84038e1571d6f01367 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 9 Oct 2012 16:41:24 +0530 Subject: [PATCH 017/169] [IMP] project_timesheet : Improved the code. bzr revid: mdi@tinyerp.com-20121009111124-sdii9no8mui4zopz --- addons/project_timesheet/project_timesheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 6125d59c621..c6513e75942 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -62,8 +62,8 @@ class project_project(osv.osv): # if the user do not have access rights on the partner pass - result = mod_obj.get_object_reference(cr, uid, 'hr_timesheet', 'act_hr_timesheet_line_evry1_all_form') - id = result and result[1] or False + res = mod_obj.get_object_reference(cr, uid, 'hr_timesheet', 'act_hr_timesheet_line_evry1_all_form') + id = res and res[1] or False result = act_obj.read(cr, uid, [id], context=context)[0] result['name'] = _('Timesheets') result['context'] = view_context From 28bc19896dbed07842923a43bc52ccc267014195 Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Wed, 10 Oct 2012 10:54:49 +0530 Subject: [PATCH 018/169] [MERGE] merged with lp:openobject-addons bzr revid: shp@tinyerp.com-20121010052449-hvnp0e53d1sp6xs2 --- addons/analytic_user_function/analytic_user_function.py | 2 ++ addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 7ac947981fc..fdf8b7eb94a 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -65,6 +65,7 @@ class hr_analytic_timesheet(osv.osv): return False + def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): res = {} if not (account_id): @@ -106,6 +107,7 @@ class hr_analytic_timesheet(osv.osv): return res def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): + print "---------------onchageuser id",user_id res = {} if not (user_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 097568a391d..383f837ac32 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -155,6 +155,7 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): + print "------------vvvvvvvvvals",vals if 'employee_id' in vals: new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False if not new_user_id: @@ -308,6 +309,7 @@ hr_timesheet_sheet() class hr_timesheet_line(osv.osv): _inherit = "hr.analytic.timesheet" + def _get_default_date(self, cr, uid, context=None): if context is None: context = {} @@ -404,6 +406,7 @@ class hr_attendance(osv.osv): return time.strftime('%Y-%m-%d %H:%M:%S') def _get_hr_timesheet_sheet(self, cr, uid, ids, context=None): + print "-----------get_hr_time sheet" attendance_ids = [] for ts in self.browse(cr, uid, ids, context=context): cr.execute(""" @@ -470,6 +473,7 @@ class hr_attendance(osv.osv): return super(hr_attendance,self).unlink(cr, uid, ids,*args, **kwargs) def write(self, cr, uid, ids, vals, context=None): + print "------------write " if context is None: context = {} if isinstance(ids, (int, long)): From e65a9208b8bf04b39b2a0499b5e1a3da3bccf50c Mon Sep 17 00:00:00 2001 From: "pankita shah (Open ERP)" Date: Wed, 10 Oct 2012 14:39:13 +0530 Subject: [PATCH 019/169] [Fix] when click time sheet timesheet sheet analysis in reporting bzr revid: shp@tinyerp.com-20121010090913-lugvm9jwb43hdmmq --- addons/hr_timesheet_sheet/report/hr_timesheet_report.py | 4 ++-- addons/hr_timesheet_sheet/report/timesheet_report.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/report/hr_timesheet_report.py b/addons/hr_timesheet_sheet/report/hr_timesheet_report.py index 1fdcac9f7c6..bdb0ddbb116 100644 --- a/addons/hr_timesheet_sheet/report/hr_timesheet_report.py +++ b/addons/hr_timesheet_sheet/report/hr_timesheet_report.py @@ -54,8 +54,8 @@ class hr_timesheet_report(osv.osv): min(t.id) as id, l.date as date, to_char(l.date, 'YYYY-MM-DD') as day, - to_char(l.date,'YYYY') as year, - to_char(l.date,'MM') as month, + to_char(l.date, 'YYYY') as year, + to_char(l.date, 'MM') as month, sum(l.amount) as cost, sum(l.unit_amount) as quantity, l.account_id as account_id, diff --git a/addons/hr_timesheet_sheet/report/timesheet_report.py b/addons/hr_timesheet_sheet/report/timesheet_report.py index 497fe8da117..0b541f18b3f 100644 --- a/addons/hr_timesheet_sheet/report/timesheet_report.py +++ b/addons/hr_timesheet_sheet/report/timesheet_report.py @@ -46,6 +46,7 @@ class timesheet_report(osv.osv): 'department_id':fields.many2one('hr.department','Department',readonly=True), 'date_from': fields.date('Date from',readonly=True,), 'date_to': fields.date('Date to',readonly=True), + 'date_current': fields.date('Current date', required=True), 'state' : fields.selection([ ('new', 'New'), ('draft','Draft'), @@ -64,6 +65,9 @@ class timesheet_report(osv.osv): htss.name, htss.date_from, htss.date_to, + to_char(htss.date_from, 'YYYY-MM-DD') as day, + to_char(htss.date_from, 'YYYY') as year, + to_char(htss.date_from, 'MM') as month, count(*) as nbr, aal.unit_amount as quantity, aal.amount as cost, @@ -105,6 +109,7 @@ class timesheet_report(osv.osv): htss.id, htss.department_id, htss.user_id + ) """) timesheet_report() From 98eaf2c2bc96055d32f5f6d2fa54c2698d61efe6 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 16:04:50 +0530 Subject: [PATCH 020/169] [FIX]: Fix on_change_account_id() argument problem bzr revid: atp@tinyerp.com-20121010103450-n4gt4ikp05t6b8yu --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 3 +-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b9574b553d1..d4950708294 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 383f837ac32..65ad4ce5905 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -155,7 +155,6 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): - print "------------vvvvvvvvvals",vals if 'employee_id' in vals: new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False if not new_user_id: @@ -390,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', uid))) for el in account_ids]) hr_timesheet_line() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 7dd2b9a1b88..28e886b779f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@
- + From eb20086d59b5dc06df721b774e50de326a646e4f Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 16:41:51 +0530 Subject: [PATCH 021/169] [REM]: Remove print statement bzr revid: atp@tinyerp.com-20121010111151-cgylp0roe61vhzs9 --- addons/analytic_user_function/analytic_user_function.py | 1 - addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index fdf8b7eb94a..7e4d00ef095 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -107,7 +107,6 @@ class hr_analytic_timesheet(osv.osv): return res def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): - print "---------------onchageuser id",user_id res = {} if not (user_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 65ad4ce5905..0fb98e142ec 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -405,7 +405,6 @@ class hr_attendance(osv.osv): return time.strftime('%Y-%m-%d %H:%M:%S') def _get_hr_timesheet_sheet(self, cr, uid, ids, context=None): - print "-----------get_hr_time sheet" attendance_ids = [] for ts in self.browse(cr, uid, ids, context=context): cr.execute(""" @@ -472,7 +471,6 @@ class hr_attendance(osv.osv): return super(hr_attendance,self).unlink(cr, uid, ids,*args, **kwargs) def write(self, cr, uid, ids, vals, context=None): - print "------------write " if context is None: context = {} if isinstance(ids, (int, long)): From f935c9e4823ddf126369359b4eb720bac5505df7 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 18:17:16 +0530 Subject: [PATCH 022/169] [FIX]: get sheet id using timesheet line user id bzr revid: atp@tinyerp.com-20121010124716-hdaebwpsowpowhl7 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 0fb98e142ec..32fbf978175 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -322,7 +322,7 @@ class hr_timesheet_line(osv.osv): for ts_line in self.browse(cursor, user, ids, context=context): sheet_ids = sheet_obj.search(cursor, user, [('date_to', '>=', ts_line.date), ('date_from', '<=', ts_line.date), - ('employee_id.user_id', '=', ts_line.sheet_id and ts_line.sheet_id.employee_id.user_id.id)], + ('employee_id.user_id', '=', ts_line.user_id.id)], context=context) if sheet_ids: # [0] because only one sheet possible for an employee between 2 dates From 6454fd15904d430ea5c0038829f15b158f958b30 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Wed, 10 Oct 2012 18:53:49 +0530 Subject: [PATCH 023/169] [IMP] Remove add_last in on_search method bzr revid: ggh@tinyerp.com-20121010132349-n3gdg0jhtyjfufma --- addons/web/static/src/js/search.js | 4 +--- addons/web/static/src/js/view_form.js | 2 +- addons/web/static/src/js/views.js | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..b403dab95db 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -783,7 +783,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.on_invalid(search.errors); return; } - return this.on_search(search.domains, search.contexts, search.groupbys); + return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, /** * Triggered after the SearchView has collected all relevant domains and @@ -801,8 +801,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * @param {Array} contexts an array of literal contexts or context refs * @param {Array} groupbys ordered contexts which may or may not have group_by keys */ - on_search: function (domains, contexts, groupbys) { - }, /** * Triggered after a validation error in the SearchView fields. * diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 9315ce15d1a..0ee753ccb52 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4533,7 +4533,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend } this.searchview = new instance.web.SearchView(this, this.dataset, false, search_defaults); - this.searchview.on_search.add(function(domains, contexts, groupbys) { + this.searchview.on('data_search', self, function(domains, contexts, groupbys) { if (self.initial_ids) { self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]), contexts, groupbys); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f985e5f6dc8..a49bf96441f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -629,7 +629,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ } this.searchview = new instance.web.SearchView(this, this.dataset, view_id, search_defaults, this.flags.search_view === false); - this.searchview.on_search.add(this.do_searchview_search); + this.searchview.on('data_search', self, this.do_searchview_search); return this.searchview.appendTo(this.$el.find(".oe_view_manager_view_search")); }, do_searchview_search: function(domains, contexts, groupbys) { From e2a28b011ad70ad3cfb1c8d4ba6c65ac5df89201 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 20:38:49 +0530 Subject: [PATCH 024/169] [FIX]: Fix on_change_analytic_id problem bzr revid: atp@tinyerp.com-20121010150849-u4cldadvfjzmw8mj --- addons/analytic_user_function/analytic_user_function.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 7e4d00ef095..9c84b75b293 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -66,7 +66,7 @@ class hr_analytic_timesheet(osv.osv): - def on_change_account_id(self, cr, uid, ids, account_id, user_id, unit_amount=0): + def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0): res = {} if not (account_id): #avoid a useless call to super diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index d4950708294..b9574b553d1 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 32fbf978175..bec3c641776 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -389,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', uid))) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) hr_timesheet_line() diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 28e886b779f..7dd2b9a1b88 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@ - + From 23a0926efd757cd7850d619a63b02d8c0c4c874a Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 10 Oct 2012 20:52:58 +0530 Subject: [PATCH 025/169] [FIX]: Fix for analytic account in hr timesheet sheet line. bzr revid: atp@tinyerp.com-20121010152258-997mxrukpjeawcpb --- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 7dd2b9a1b88..28e886b779f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -97,7 +97,7 @@ - + @@ -110,7 +110,7 @@ - + From 1a476fed6919117c4f916a82b49b2162d7603338 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 11:09:07 +0530 Subject: [PATCH 026/169] [IMP] Remove add() in on_search method bzr revid: ggh@tinyerp.com-20121011053907-tykje6i145fmjrl3 --- addons/web/static/src/js/search.js | 16 ---------------- addons/web/static/test/search.js | 6 +++--- addons/web_hello/static/openerp/base_hello.js | 2 +- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index b403dab95db..6810cfd35fa 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -785,22 +785,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, - /** - * Triggered after the SearchView has collected all relevant domains and - * contexts. - * - * It is provided with an Array of domains and an Array of contexts, which - * may or may not be evaluated (each item can be either a valid domain or - * context, or a string to evaluate in order in the sequence) - * - * It is also passed an array of contexts used for group_by (they are in - * the correct order for group_by evaluation, which contexts may not be) - * - * @event - * @param {Array} domains an array of literal domains or domain references - * @param {Array} contexts an array of literal contexts or context refs - * @param {Array} groupbys ordered contexts which may or may not have group_by keys - */ /** * Triggered after a validation error in the SearchView fields. * diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js index 6dc37f31d08..7c6556da363 100644 --- a/addons/web/static/test/search.js +++ b/addons/web/static/test/search.js @@ -652,7 +652,7 @@ $(document).ready(function () { } }); var ds, cs, gs; - view.on_search.add(function (d, c, g) { + view.on('data_search', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -690,7 +690,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds, cs, gs; - view.on_search.add(function (d, c, g) { + view.on('data_search', this, function (d, c, g) { ds = d, cs = c, gs = g; }); view.appendTo($fix) @@ -718,7 +718,7 @@ $(document).ready(function () { } }, {dummy: 42}); var ds; - view.on_search.add(function (d) { ds = d; }); + view.on('data_search', this, function (d) { ds = d; }); view.appendTo($fix) .always(start) .fail(function (error) { ok(false, error.message); }) diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index a74b8ef8f2f..7bfbf7b78e8 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -7,7 +7,7 @@ openerp.web_hello = function(instance) { instance.web.SearchView = instance.web.SearchView.extend({ init:function() { this._super.apply(this,arguments); - this.on_search.add(function(){console.log('hello');}); + this.on('data_search', this, function(){console.log('hello');}); } }); From 4e33d693239fed16ae1b3b355b6c64c245f67f92 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 11:13:09 +0530 Subject: [PATCH 027/169] [IMP]Remove add() in on_search method bzr revid: ggh@tinyerp.com-20121011054309-1y2f54y735r6h9qh --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e0c9ac9b7fc..e6a4ace66c7 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1110,7 +1110,7 @@ openerp.mail = function(session) { var self = this; this.searchview = new session.web.SearchView(this, this.ds_msg, false, defaults || {}, hidden || false); return this.searchview.appendTo(this.$('.oe_view_manager_view_search')).then(function () { - self.searchview.on_search.add(self.do_searchview_search); + self.searchview.on('data_search', self, self.do_searchview_search); }); }, From 73c32663d6050563eb5fb18a2492a1f1d898d876 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 11 Oct 2012 14:28:07 +0530 Subject: [PATCH 028/169] add on_search comment bzr revid: ggh@tinyerp.com-20121011085807-vmldw354xdbruj1s --- addons/web/static/src/js/search.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 6810cfd35fa..b403dab95db 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -785,6 +785,22 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } return this.trigger('data_search', search.domains, search.contexts, search.groupbys); }, + /** + * Triggered after the SearchView has collected all relevant domains and + * contexts. + * + * It is provided with an Array of domains and an Array of contexts, which + * may or may not be evaluated (each item can be either a valid domain or + * context, or a string to evaluate in order in the sequence) + * + * It is also passed an array of contexts used for group_by (they are in + * the correct order for group_by evaluation, which contexts may not be) + * + * @event + * @param {Array} domains an array of literal domains or domain references + * @param {Array} contexts an array of literal contexts or context refs + * @param {Array} groupbys ordered contexts which may or may not have group_by keys + */ /** * Triggered after a validation error in the SearchView fields. * From a31de511b6d753e52a114f9c9b438c07c449e8c6 Mon Sep 17 00:00:00 2001 From: Vishmita Date: Thu, 11 Oct 2012 15:33:01 +0530 Subject: [PATCH 029/169] [FIX]change event name bzr revid: vja@tinyerp.com-20121011100301-nc4en7cn431zkgp6 --- addons/web_diagram/static/src/js/diagram.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_diagram/static/src/js/diagram.js b/addons/web_diagram/static/src/js/diagram.js index 1ee2e54cc3e..d5262604ef4 100644 --- a/addons/web_diagram/static/src/js/diagram.js +++ b/addons/web_diagram/static/src/js/diagram.js @@ -240,7 +240,7 @@ instance.web.DiagramView = instance.web.View.extend({ } ); - pop.on('on_write_complete', self, function() { + pop.on('write_completed', self, function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); @@ -304,7 +304,7 @@ instance.web.DiagramView = instance.web.View.extend({ title: _t("Open: ") + title } ); - pop.on('on_write_complete', self, function() { + pop.on('write_completed', self, function() { self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded); }); }, From 540248ed9ea38846a417bee3c7d08966e1ae6e6a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 11 Oct 2012 12:40:48 +0200 Subject: [PATCH 030/169] [IMP] mail: cleaner code bzr revid: chm@openerp.com-20121011104048-4vy0k8pp1rrjug1k --- addons/mail/mail_message.py | 2 +- addons/mail/mail_thread.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 9631918050a..975e7fc1aaf 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -509,7 +509,7 @@ class mail_message(osv.Model): Call mail_notification.notify to manage the email sending """ message = self.browse(cr, uid, newid, context=context) - if message and (message.is_private!=False and message.is_private!=None): + if not message: self._notify_followers(cr, uid, newid, message, context=context) # add myself if I wrote on my wall, diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index e5b93ac4000..cb69b08a86d 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -708,7 +708,7 @@ class mail_thread(osv.AbstractModel): attachment_ids=[] if attachments: ir_attachment = self.pool.get('ir.attachment') - attachment_ids = ir_attachment.search(cr, 1, [('res_model', '=', ""), ('res_id', '=', ""), ('user_id', '=', uid), ('id', 'in', attachments)], context=context) + attachment_ids = ir_attachment.search(cr, 1, [('res_model', '=', False), ('res_id', '=', False), ('user_id', '=', uid), ('id', 'in', attachments)], context=context) if attachment_ids: self.pool.get('ir.attachment').write(cr, 1, attachment_ids, { 'res_model': self._name, 'res_id': thread_id }, context=context) self.pool.get('mail.message').write(cr, 1, [added_message_id], {'attachment_ids': [(6, 0, [pid for pid in attachment_ids])]} ) From b27b12db1ba97ee029ced20436fd31547501aa51 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 17:42:01 +0530 Subject: [PATCH 031/169] [FIX]: Fix onchange account id problem bzr revid: atp@tinyerp.com-20121011121201-h6030emuz00t55nv --- addons/hr_timesheet/hr_timesheet.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index a28508be4db..cd0f873ccfd 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -154,7 +154,7 @@ class hr_analytic_timesheet(osv.osv): 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), } - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): return {'value':{}} def on_change_date(self, cr, uid, ids, date): diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b9574b553d1..d4950708294 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -174,7 +174,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id): res = {} if not account_id: return res diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index bec3c641776..887ce15a741 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -389,7 +389,7 @@ class hr_timesheet_line(osv.osv): return True def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None): - return dict([(el, self.on_change_account_id(cr, uid, ids, el)) for el in account_ids]) + return dict([(el, self.on_change_account_id(cr, uid, ids, el, context.get('user_id', False) or uid)) for el in account_ids]) hr_timesheet_line() From de0023a14f723f21edbd8a2d41d4a4b7e458392e Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 18:04:41 +0530 Subject: [PATCH 032/169] [FIX]: Fix default user timesheetline problem bzr revid: atp@tinyerp.com-20121011123441-5zg1nm394d0b45ky --- addons/hr_timesheet/hr_timesheet.py | 4 ++-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index cd0f873ccfd..7934b8e5be1 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -136,7 +136,7 @@ class hr_analytic_timesheet(osv.osv): emp_obj = self.pool.get('hr.employee') if context is None: context = {} - emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context) + emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', False) or uid)], context=context) if not emp_id : raise osv.except_osv(_('Warning!'), _('Please create an employee for this user, using the menu: Human Resources > Employees.')) emp = emp_obj.browse(cr, uid, emp_id[0], context=context) @@ -152,7 +152,7 @@ class hr_analytic_timesheet(osv.osv): 'general_account_id': _getGeneralAccount, 'journal_id': _getAnalyticJournal, 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), - 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), + 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', False) or uid, } def on_change_account_id(self, cr, uid, ids, account_id, user_id): return {'value':{}} diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 28e886b779f..c96d256b7e2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -106,7 +106,7 @@ - + From 4a77345f634b6f419f4d2da919b091ab92abb980 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 11 Oct 2012 18:16:14 +0200 Subject: [PATCH 033/169] [IMP] mail, following: access bzr revid: chm@openerp.com-20121011161614-k72bm2f6gw451u5g --- addons/mail/mail_followers.py | 2 +- addons/mail/mail_message.py | 60 +++++++++++---------- addons/mail/mail_message_view.xml | 14 +++-- addons/mail/mail_thread.py | 4 +- addons/mail/mail_thread_view.xml | 8 ++- addons/mail/static/src/js/mail.js | 3 ++ addons/mail/static/src/js/mail_followers.js | 18 +++---- addons/mail/static/src/xml/mail.xml | 3 +- addons/mrp/procurement.py | 2 +- 9 files changed, 66 insertions(+), 48 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 6f122a87ba5..e0883988cd8 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -92,7 +92,7 @@ class mail_notification(osv.Model): partner_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id notif_ids = self.search(cr, uid, [('partner_id', '=', partner_id), ('message_id', 'in', msg_ids)], context=context) - return self.write(cr, uid, notif_ids, {'read': read}, context=context) + return self.write(cr, 1, notif_ids, {'read': read}, context=context) def get_partners_to_notify(self, cr, uid, message, context=None): """ Return the list of partners to notify, based on their preferences. diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 975e7fc1aaf..9ea826c84a7 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -163,7 +163,7 @@ class mail_message(osv.Model): mail.message not always granted. ''' if not user_ids: user_ids = [uid] - for message in self.read(cr, uid, ids, ['vote_user_ids'], context=context): + for message in self.read(cr, SUPERUSER_ID, ids, ['vote_user_ids'], context=context): for user_id in user_ids: has_voted = user_id in message.get('vote_user_ids') if not has_voted: @@ -189,17 +189,17 @@ class mail_message(osv.Model): has_voted = True break try: - attachment_ids = [{'id': attach[0], 'name': attach[1]} for attach in self.pool.get('ir.attachment').name_get(cr, uid, [x.id for x in msg.attachment_ids], context=context)] + attachment_ids = [{'id': attach[0], 'name': attach[1]} for attach in self.pool.get('ir.attachment').name_get(cr, SUPERUSER_ID, [x.id for x in msg.attachment_ids], context=context)] except (orm.except_orm, osv.except_osv): attachment_ids = [] try: - author_id = self.pool.get('res.partner').name_get(cr, uid, [msg.author_id.id], context=context)[0] + author_id = self.pool.get('res.partner').name_get(cr, SUPERUSER_ID, [msg.author_id.id], context=context)[0] is_author = uid == msg.author_id.user_ids[0].id except Exception: author_id = False is_author = False try: - partner_ids = self.pool.get('res.partner').name_get(cr, uid, [x.id for x in msg.partner_ids], context=context) + partner_ids = self.pool.get('res.partner').name_get(cr, SUPERUSER_ID, [x.id for x in msg.partner_ids], context=context) except (orm.except_orm, osv.except_osv): partner_ids = [] @@ -222,7 +222,7 @@ class mail_message(osv.Model): 'unread': msg.unread and msg.unread['unread'] or False } - def _message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit): + def _message_read_expandable(self, cr, uid, tree, result, message_loaded_ids, domain, context, parent_id, limit): """ create the expandable message for all parent message read this function is used by message_read @@ -230,28 +230,28 @@ class mail_message(osv.Model): tree_not = [] # expandable for not show message - for id_msg in tree: + for msg in tree: # get all childs - not_loaded_ids = self.search(cr, SUPERUSER_ID, [['parent_id','=',id_msg],['id','not in',message_loaded]], None, limit=1000) + not_loaded_ids = self.search(cr, SUPERUSER_ID, [['parent_id','=',msg.id],['id','not in',message_loaded_ids]], None, limit=1000) # group childs not read id_min=None id_max=None nb=0 - for not_loaded_id in not_loaded_ids: - if not_loaded_id not in tree: + for not_loaded in self.browse(cr, SUPERUSER_ID, not_loaded_ids, context=context): + if not_loaded not in tree: nb+=1 - if id_min==None or id_min>not_loaded_id: - id_min=not_loaded_id - if id_max==None or id_maxnot_loaded.id: + id_min=not_loaded.id + if id_max==None or id_max0: result.append({ - 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]], + 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',msg.id]], 'nb_messages': nb, 'type': 'expandable', - 'parent_id': id_msg, + 'parent_id': msg.id, 'id': id_min }) id_min=None @@ -259,16 +259,18 @@ class mail_message(osv.Model): nb=0 if nb>0: result.append({ - 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]], + 'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',msg.id]], 'nb_messages': nb, 'type': 'expandable', - 'parent_id': id_msg, + 'parent_id': msg.id, 'id': id_min }) + for msg in tree+tree_not: + message_loaded_ids.append( msg.id ) # expandable for limit max - ids = self.search(cr, SUPERUSER_ID, domain+[['id','not in',message_loaded+tree+tree_not]], context=context, limit=1) + ids = self.search(cr, SUPERUSER_ID, domain+[['id','not in',message_loaded_ids]], context=context, limit=1) if len(ids) > 0: result.append( { @@ -297,11 +299,11 @@ class mail_message(osv.Model): further parents :return list: list of trees of messages """ - message_loaded = context and context.get('message_loaded') or [0] + message_loaded_ids = context and context.get('message_loaded') or [0] # don't read the message display by .js, in context message_loaded list if context and context.get('message_loaded'): - domain += [ ['id','not in',message_loaded] ]; + domain += [ ['id','not in',message_loaded_ids] ]; limit = limit or self._message_read_limit context = context or {} @@ -317,27 +319,27 @@ class mail_message(osv.Model): return result # key: ID, value: record - ids = self.search(cr, SUPERUSER_ID, domain, context=context, limit=limit) + ids = self.search(cr, uid, domain, context=context, limit=limit) for msg in self.browse(cr, uid, ids, context=context): # if not in record and not in message_loded list - if msg.id not in tree and msg.id not in message_loaded : + if msg not in tree and msg.id not in message_loaded_ids : record = self._message_dict_get(cr, uid, msg, context=context) - tree.append(msg.id) + tree.append(msg) result.append(record) while msg.parent_id and msg.parent_id.id != parent_id: parent_id = msg.parent_id.id if msg.parent_id.id not in tree: msg = msg.parent_id - tree.append(msg.id) + tree.append(msg) # if not in record and not in message_loded list - if msg.id not in message_loaded : + if msg.id not in message_loaded_ids : record = self._message_dict_get(cr, uid, msg, context=context) result.append(record) result = sorted(result, key=lambda k: k['id']) - result = self._message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit) + result = self._message_read_expandable(cr, uid, tree, result, message_loaded_ids, domain, context, parent_id, limit) return result @@ -465,13 +467,14 @@ class mail_message(osv.Model): def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): """ Override to explicitely call check_access_rule, that is not called by the ORM. It instead directly fetches ir.rules and apply them. """ - res = super(mail_message, self).read(cr, uid, ids, fields=fields, context=context, load=load) self.check_access_rule(cr, uid, ids, 'read', context=context) + res = super(mail_message, self).read(cr, uid, ids, fields=fields, context=context, load=load) return res def unlink(self, cr, uid, ids, context=None): # cascade-delete attachments that are directly attached to the message (should only happen # for mail.messages that act as parent for a standalone mail.mail record). + self.check_access_rule(cr, uid, ids, 'unlink', context=context) attachments_to_delete = [] for message in self.browse(cr, uid, ids, context=context): for attach in message.attachment_ids: @@ -499,7 +502,6 @@ class mail_message(osv.Model): fol_objs = fol_obj.browse(cr, uid, fol_ids, context=context) extra_notified = set(fol.partner_id.id for fol in fol_objs) missing_notified = extra_notified - partners_to_notify - missing_notified = missing_notified if missing_notified: self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(4, p_id) for p_id in missing_notified]}, context=context) partners_to_notify |= extra_notified diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 0c572384bb4..fd304a309af 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -56,6 +56,7 @@ + @@ -87,21 +88,28 @@ Inbox mail.wall - + + + + To: me + mail.wall + Archives mail.wall - Sent mail.wall - diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index cb69b08a86d..d00f132f1c8 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -102,12 +102,12 @@ class mail_thread(osv.AbstractModel): # find the document followers, update the data fol_obj = self.pool.get('mail.followers') - fol_ids = fol_obj.search(cr, uid, [ + fol_ids = fol_obj.search(cr, SUPERUSER_ID, [ ('partner_id', '=', user_pid), ('res_id', 'in', ids), ('res_model', '=', self._name), ], context=context) - for fol in fol_obj.browse(cr, uid, fol_ids, context=context): + for fol in fol_obj.browse(cr, SUPERUSER_ID, fol_ids, context=context): thread_subtype_dict = res[fol.res_id]['message_subtype_data'] res[fol.res_id]['message_is_follower'] = True for subtype in fol.subtype_ids: diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml index 696edde0e15..65ad477042c 100644 --- a/addons/mail/mail_thread_view.xml +++ b/addons/mail/mail_thread_view.xml @@ -3,7 +3,7 @@ - @@ -18,6 +18,12 @@ + + To: me + + + + Archives diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 15a81be4c54..a9a9bc5429d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1115,6 +1115,9 @@ openerp.mail = function(session) { /* Send the records to his parent thread */ switch_new_message: function(records) { + + console.log(records); + var self=this; _(records).each(function(record){ self.browse_thread({ diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 236e3081136..d69c46e0242 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -74,7 +74,7 @@ openerp_mail_followers = function(session, mail) { target: 'new', context: { 'default_res_model': self.view.dataset.model, - 'default_res_id': self.view.datarecord.id + 'default_res_id': self.view.dataset.ids[0] }, } self.do_action(action, function() { self.read_value(); }); @@ -83,7 +83,7 @@ openerp_mail_followers = function(session, mail) { read_value: function() { var self = this; - return this.ds_model.read_ids([this.view.datarecord.id], ['message_follower_ids']).pipe(function (results) { + return this.ds_model.read_ids([this.view.dataset.ids[0]], ['message_follower_ids']).pipe(function (results) { self.set_value(results[0].message_follower_ids); }); }, @@ -158,7 +158,7 @@ openerp_mail_followers = function(session, mail) { set_subtypes:function(data){ var self = this; - var records = (data[this.view.datarecord.id] || data[null]).message_subtype_data; + var records = data[this.view.dataset.ids[0]].message_subtype_data; _(records).each(function (record, record_name) { record.name = record_name; @@ -168,14 +168,14 @@ openerp_mail_followers = function(session, mail) { }, /** Display subtypes: {'name': default, followed} */ - display_subtypes: function (visible) { + display_subtypes: function () { var self = this; var recthread_subtypes = self.$('.oe_recthread_subtypes'); subtype_list_ul = self.$('ul.oe_subtypes'); if(subtype_list_ul.is(":empty")) { var context = new session.web.CompoundContext(this.build_context(), {}); - this.ds_model.call('get_message_subtypes',[[self.view.datarecord.id], context]).pipe(this.proxy('set_subtypes')); + this.ds_model.call('get_message_subtypes',[[self.view.dataset.ids[0]], context]).pipe(this.proxy('set_subtypes')); } }, @@ -191,7 +191,7 @@ openerp_mail_followers = function(session, mail) { $(record).attr('checked',false); }); var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).pipe(this.proxy('read_value')); + return this.ds_model.call('message_unsubscribe_users', [[this.view.dataset.ids[0]], [this.session.uid], context]).pipe(this.proxy('read_value')); }, do_update_subscription: function (event) { @@ -207,9 +207,9 @@ openerp_mail_followers = function(session, mail) { return this.do_unfollow(); else{ var context = new session.web.CompoundContext(this.build_context(), {}); - return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, context]).pipe(function(value_){ - self.read_value(value_); - self.display_subtypes(true); + return this.ds_model.call('message_subscribe_users', [[this.view.dataset.ids[0]], [this.session.uid], undefined, context]).pipe(function(){ + self.read_value(); + self.display_subtypes(); }); } diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 2fc97154e33..734a2395d24 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -111,8 +111,7 @@ wall main template Template used to display the communication history in the wall. --> -
+
diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 8c7068c7fa0..ee9ad9e1905 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -112,7 +112,7 @@ class procurement_order(osv.osv): def production_order_create_note(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): - body = "Manufacturing Order %s created." % ( procurement.production_id.name,) + body = _("Manufacturing Order %s created.") % ( procurement.production_id.name,) self.message_post(cr, uid, [procurement.id], body=body, context=context) procurement_order() From 87e89592056f5290f64c28fdfe72dc9b1aa93fb6 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 23:11:26 +0530 Subject: [PATCH 034/169] [FIX] bzr revid: atp@tinyerp.com-20121011174126-lii90i9fnfhfsy9v --- addons/hr_timesheet/hr_timesheet.py | 2 +- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 7934b8e5be1..0345ca6c06b 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -154,7 +154,7 @@ class hr_analytic_timesheet(osv.osv): 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', False) or uid, } - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id): return {'value':{}} def on_change_date(self, cr, uid, ids, date): diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index f7a490c4604..30e4ff40885 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -176,7 +176,7 @@ account_analytic_line() class hr_analytic_timesheet(osv.osv): _inherit = "hr.analytic.timesheet" - def on_change_account_id(self, cr, uid, ids, account_id, user_id): + def on_change_account_id(self, cr, uid, ids, account_id, user_id=False): res = {} if not account_id: return res From 15974eb2e095238cb1016d832e97110fb7a6794d Mon Sep 17 00:00:00 2001 From: Vishmita Date: Fri, 12 Oct 2012 17:15:34 +0530 Subject: [PATCH 035/169] [IMP]replace callenabled for on_loaded bzr revid: vja@tinyerp.com-20121012114534-qx7y6dzmqkw7t7px --- addons/web/static/src/js/search.js | 2 +- addons/web/static/src/js/view_form.js | 12 ++++++------ addons/web/static/src/js/view_list.js | 1 + addons/web/static/src/js/views.js | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..400411937c4 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -671,7 +671,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'facet_for_defaults', this.defaults)).then(function () { self.query.reset(_(arguments).compact(), {preventSearch: true}); }); - + self.trigger("search_view_load"); return $.when(drawer_started, defaults_fetched) .then(function () { self.ready.resolve(); }) }, diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index afb5e258c0b..d21c2320783 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -211,7 +211,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM e.stopPropagation(); } }); - + this._super.apply(this, arguments); return $.when(); }, extract_qweb_template: function(fvg) { @@ -4078,7 +4078,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ } this.list_view.m2m_field = this; var loaded = $.Deferred(); - this.list_view.on_loaded.add_last(function() { + this.list_view.on("view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4203,7 +4203,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( } this.kanban_view.m2m = this; var loaded = $.Deferred(); - this.kanban_view.on_loaded.add_last(function() { + this.kanban_view.on("view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4427,7 +4427,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.view_form.set_embedded_view(this.options.alternative_form_view); } this.view_form.appendTo(this.$el.find(".oe_popup_form")); - this.view_form.on_loaded.add_last(function() { + this.view_form.on("view_loaded",self,function() { var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { multi_select: multi_select, @@ -4546,7 +4546,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys); } }); - this.searchview.on_loaded.add_last(function () { + this.searchview.on("search_view_load",self,function () { self.view_list = new instance.web.form.SelectCreateListView(self, self.dataset, false, _.extend({'deletable': false, @@ -4563,7 +4563,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }).pipe(function() { self.searchview.do_search(); }); - self.view_list.on_loaded.add_last(function() { + self.view_list.on("view_loaded",self,function() { self.$buttonpane.html(QWeb.render("SelectCreatePopup.search.buttons", {widget:self})); var $cbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-close"); $cbutton.click(function() { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 7457ca5ef67..08e7662c630 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -358,6 +358,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.sidebar.add_toolbar(this.fields_view.toolbar); this.sidebar.$el.hide(); } + this._super.apply(this, arguments); }, /** * Configures the ListView pager based on the provided dataset's information diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f985e5f6dc8..1d99ab31727 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1146,6 +1146,7 @@ instance.web.View = instance.web.Widget.extend({ * Must return a promise. */ on_loaded: function(fields_view_get) { + this.trigger("view_loaded"); }, set_default_options: function(options) { this.options = options || {}; From adc318837a86c72c1a9f490f56305a941c638e88 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 12 Oct 2012 14:40:03 +0200 Subject: [PATCH 036/169] [IMP]mail: secu bzr revid: chm@openerp.com-20121012124003-zs8uj68gr1upgc57 --- addons/mail/mail_message.py | 73 ++++++++++++++------- addons/mail/mail_thread.py | 9 +-- addons/mail/static/src/js/mail.js | 56 ++++++++++------ addons/mail/static/src/js/mail_followers.js | 3 + 4 files changed, 91 insertions(+), 50 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 9ea826c84a7..f6db94f3b75 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -232,12 +232,12 @@ class mail_message(osv.Model): # expandable for not show message for msg in tree: # get all childs - not_loaded_ids = self.search(cr, SUPERUSER_ID, [['parent_id','=',msg.id],['id','not in',message_loaded_ids]], None, limit=1000) + not_loaded_ids = self.search(cr, uid, [['parent_id','=',msg.id],['id','not in',message_loaded_ids]], None, limit=1000) # group childs not read id_min=None id_max=None nb=0 - for not_loaded in self.browse(cr, SUPERUSER_ID, not_loaded_ids, context=context): + for not_loaded in self.browse(cr, uid, not_loaded_ids, context=context): if not_loaded not in tree: nb+=1 if id_min==None or id_min>not_loaded.id: @@ -270,7 +270,7 @@ class mail_message(osv.Model): message_loaded_ids.append( msg.id ) # expandable for limit max - ids = self.search(cr, SUPERUSER_ID, domain+[['id','not in',message_loaded_ids]], context=context, limit=1) + ids = self.search(cr, uid, domain+[['id','not in',message_loaded_ids]], context=context, limit=1) if len(ids) > 0: result.append( { @@ -309,33 +309,47 @@ class mail_message(osv.Model): context = context or {} tree = [] - result = [] + message_ids = [] record = None # select ids if ids and ids!=[None]: for msg in self.browse(cr, uid, ids, context=context): - result.append(self._message_dict_get(cr, uid, msg, context=context)) - return result + message_ids.append(msg.id) - # key: ID, value: record - ids = self.search(cr, uid, domain, context=context, limit=limit) - for msg in self.browse(cr, uid, ids, context=context): - # if not in record and not in message_loded list - if msg not in tree and msg.id not in message_loaded_ids : - record = self._message_dict_get(cr, uid, msg, context=context) - tree.append(msg) - result.append(record) - - while msg.parent_id and msg.parent_id.id != parent_id: - parent_id = msg.parent_id.id - if msg.parent_id.id not in tree: - msg = msg.parent_id + # key: ID, value: tree + if not ids: + ids = self.search(cr, uid, domain, context=context, limit=limit) + for msg in self.browse(cr, uid, ids, context=context): + # if not in tree and not in message_loded list + if msg not in tree and msg.id not in message_loaded_ids : + message_ids.append(msg.id) tree.append(msg) - # if not in record and not in message_loded list - if msg.id not in message_loaded_ids : - record = self._message_dict_get(cr, uid, msg, context=context) - result.append(record) + + try: + parent = msg.parent_id + except orm.except_orm, inst: + print inst + parent = False + + while parent and parent.id != parent_id: + parent_id = msg.parent_id.id + if msg.parent_id.id not in tree: + tree.append(parent) + # if not in tree and not in message_loded list + if parent.id not in message_loaded_ids : + message_ids.append(parent.id) + + try: + parent = msg.parent_id + except orm.except_orm, inst: + print inst + parent = False + + result = [] + for msg in self.browse(cr, uid, message_ids, context=context): + record = self._message_dict_get(cr, uid, msg, context=context) + result.append( record ) result = sorted(result, key=lambda k: k['id']) @@ -371,7 +385,8 @@ class mail_message(osv.Model): - Otherwise: raise - create: if - I am in the document message_follower_ids OR - - I can write on the related document if res_model, res_id + - I can write on the related document if res_model, res_id OR + - I write a mail to another user (no res_model) - Otherwise: raise - write: if - I can write on the related document if res_model, res_id @@ -412,7 +427,7 @@ class mail_message(osv.Model): else: author_ids = [] - # Create: Check message_follower_ids + # Create: Check message_follower_ids and author_ids if operation == 'create': doc_follower_ids = [] for model, mids in model_record_ids.items(): @@ -428,6 +443,12 @@ class mail_message(osv.Model): else: doc_follower_ids = [] + # Create/write: Check author_ids + if operation == 'create' or operation == 'write': + author_ids = author_ids+[mid for mid, message in message_values.iteritems() + if message.get('author_id') and message.get('author_id') == partner_id and not message.get('res_model')] + + # Calculate remaining ids, and related model/res_ids model_record_ids = {} other_ids = set(ids).difference(set(notified_ids), set(author_ids), set(doc_follower_ids)) @@ -511,6 +532,8 @@ class mail_message(osv.Model): Call mail_notification.notify to manage the email sending """ message = self.browse(cr, uid, newid, context=context) + + print message.partner_ids if not message: self._notify_followers(cr, uid, newid, message, context=context) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index d00f132f1c8..81846258921 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -221,8 +221,8 @@ class mail_thread(osv.AbstractModel): def create(self, cr, uid, vals, context=None): """ Override to subscribe the current user. """ - thread_id = super(mail_thread, self).create(cr, uid, vals, context=context) - self.message_subscribe_users(cr, uid, [thread_id], [uid], context=context) + thread_id = super(mail_thread, self).create(cr, SUPERUSER_ID, vals, context=context) + self.message_subscribe_users(cr, SUPERUSER_ID, [thread_id], [uid], context=context) return thread_id def unlink(self, cr, uid, ids, context=None): @@ -682,9 +682,10 @@ class mail_thread(osv.AbstractModel): # if the parent is private, the message must be private if parent_id: msg = messages.browse(cr, uid, parent_id, context=context) - if msg.is_private: - values["is_private"] = msg.is_private + values["is_private"] = msg.is_private or False + values["partner_ids"] = [(4, partner.id) for partner in msg.partner_ids] + print values # Avoid warnings about non-existing fields for x in ('from', 'to', 'cc'): values.pop(x, None) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index a9a9bc5429d..468b628ab5a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -27,6 +27,7 @@ openerp.mail = function(session) { if( key!='default_template_id' && key!='default_use_template' && key!='default_is_private' && + key!='default_partner_ids' && key!='default_model' && key!='default_res_id' && key!='default_subtype' && @@ -331,6 +332,11 @@ openerp.mail = function(session) { for(var i in this.attachment_ids){ attachments.push(this.attachment_ids[i].id); } + var partner_ids=[]; + for(var i in this.partner_ids){ + partner_ids.push(this.partner_ids[i][0]); + } + var action = { type: 'ir.actions.act_window', res_model: 'mail.compose.message', @@ -346,14 +352,15 @@ openerp.mail = function(session) { 'default_is_private': true, 'default_parent_id': this.id, 'default_body': mail.ChatterUtils.get_text2html(this.$('textarea').val() || ''), - 'default_attachment_ids': attachments + 'default_attachment_ids': attachments, + 'default_partner_ids': partner_ids }, }; this.do_action(action); }, - on_cancel: function(){ - event.stopPropagation(); + on_cancel: function(event){ + if(event) event.stopPropagation(); this.$('textarea').val(""); this.$('input[data-id]').remove(); //this.attachment_ids=[]; @@ -365,6 +372,7 @@ openerp.mail = function(session) { /*post a message and fetch the message*/ on_message_post: function (body) { + var self = this; if (! body) { var comment_node = this.$('textarea'); @@ -390,9 +398,11 @@ openerp.mail = function(session) { false, this.context.default_parent_id, attachments] - ).then(this.parent_thread.proxy('switch_new_message')); - this.attachment_ids=[]; - this.on_cancel(); + ).then(function(records){ + self.parent_thread.switch_new_message(records); + self.attachment_ids=[]; + self.on_cancel(); + }); return true; } }, @@ -451,8 +461,12 @@ openerp.mail = function(session) { */ on_expandable: function (event) { if(event)event.stopPropagation(); + var self = this; this.parent_thread.message_fetch(false, this.domain, this.context); - this.destroy(); + this.$el.fadeOut(300, function(){ + self.destroy(); + }); + this.$('*').unbind(); return false; }, }); @@ -841,7 +855,7 @@ openerp.mail = function(session) { this.messages = []; - this.ds_thread = new session.web.DataSetSearch(this, this.context.default_model); + this.ds_thread = new session.web.DataSetSearch(this, this.context.default_model || 'mail.thread'); this.ds_message = new session.web.DataSetSearch(this, 'mail.message'); }, @@ -1002,7 +1016,7 @@ openerp.mail = function(session) { * @param {Array} replace_domain: added to this.domain * @param {Object} replace_context: added to this.context */ - message_fetch: function (initial_mode, replace_domain, replace_context, ids) { + message_fetch: function (initial_mode, replace_domain, replace_context, ids, callback) { var self = this; // initial mode: try to use message_data or message_ids @@ -1015,7 +1029,7 @@ openerp.mail = function(session) { fetch_context.message_loaded= [this.id||0].concat( self.options.thread._parents[0].get_child_ids() ); return this.ds_message.call('message_read', [ids, fetch_domain, fetch_context, 0, this.context.default_parent_id || undefined] - ).then(this.proxy('switch_new_message')); + ).then(function (records) { self.switch_new_message(records); }); }, /* create record object and linked him @@ -1072,13 +1086,15 @@ openerp.mail = function(session) { // check older and newer message for insert var parent_newer = false; var parent_older = false; - for(var i in thread_messages){ - if(thread_messages[i].id > message.id){ - if(!parent_newer || parent_newer.id>=thread_messages[i].id) - parent_newer = thread_messages[i]; - } else if(thread_messages[i].id>0 && thread_messages[i].id < message.id) { - if(!parent_older || parent_older.id 0 ){ + for(var i in thread_messages){ + if(thread_messages[i].id > message.id){ + if(!parent_newer || parent_newer.id>=thread_messages[i].id) + parent_newer = thread_messages[i]; + } else if(thread_messages[i].id>0 && thread_messages[i].id < message.id) { + if(!parent_older || parent_older.id 0){ message.prependTo(thread.list_ul); } else { message.appendTo(thread.list_ul); } } + return message }, @@ -1115,9 +1132,6 @@ openerp.mail = function(session) { /* Send the records to his parent thread */ switch_new_message: function(records) { - - console.log(records); - var self=this; _(records).each(function(record){ self.browse_thread({ diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index d69c46e0242..1a7f16d6987 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -158,6 +158,9 @@ openerp_mail_followers = function(session, mail) { set_subtypes:function(data){ var self = this; + if (!data[this.view.dataset.ids[0]]) { + return false; + } var records = data[this.view.dataset.ids[0]].message_subtype_data; _(records).each(function (record, record_name) { From 41c039a0a0bdea8014d314ffd8b290e4b361aa92 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 12 Oct 2012 14:40:39 +0200 Subject: [PATCH 037/169] [IMP]mail: suppress ajax attachment bzr revid: chm@openerp.com-20121012124039-x2b2kojr8935ro1e --- addons/mail/static/src/js/mail.js | 47 ----------------------------- addons/mail/static/src/xml/mail.xml | 5 --- 2 files changed, 52 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 468b628ab5a..395f1a6dc2c 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -199,7 +199,6 @@ openerp.mail = function(session) { // submit file //session.web.blockUI(); self.$('form.oe_form_binary_form').submit(); - //self.submit_ajax_attachment(); this.$(".oe_attachment_file").hide(); @@ -214,52 +213,6 @@ openerp.mail = function(session) { } }, - submit_ajax_attachment: function(){ - var self=this; - var $form = self.$('form.oe_form_binary_form'); - var filename = this.$('input.oe_form_binary_file').val().replace(/.*[\\\/]/,''); - - // create form data - var fomdata = new FormData(); - $.each($form.find('input'), function(i, field) { - var $field=$(field); - if($field.attr('type')!='file'){ - fomdata.append($field.attr('name'), $field.val()); - } else { - fomdata.append($field.attr('name'), field.files[0]); - } - }); - - var progress=function(event) { - self.$("span[name='"+filename+"'] div:lt("+Math.floor(event.loaded / event.total*5)+")").show(); - }; - - $.ajax({ - url: $form.attr("action"), - data: fomdata, - cache: false, - contentType: false, - processData: false, - type: 'POST', - enctype: 'multipart/form-data', - xhr: function() { - // custom xhr - myXhr = $.ajaxSettings.xhr(); - if(myXhr.upload){ - // for handling the progress of the upload - myXhr.upload.addEventListener('progress', progress, false); - } - myXhr.addEventListener('progress', progress, false); - return myXhr; - }, - success: function(data){ - $iframe=$('