From 3666ed98289408b1d2a4f914dbc7ef395ff27b19 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 13 Jun 2012 11:02:22 +0200 Subject: [PATCH 001/197] [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 e6178297dfea0f56c887467f0c5486c06243719f Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 18 Sep 2012 10:40:18 +0530 Subject: [PATCH 002/197] [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 003/197] [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 004/197] [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 005/197] [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 006/197] [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 007/197] [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 008/197] [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 009/197] [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 010/197] [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 011/197] [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 012/197] [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 013/197] [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 014/197] [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 015/197] [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 016/197] [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 017/197] [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 018/197] [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 019/197] [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 020/197] [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 021/197] [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 022/197] [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 023/197] [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 024/197] [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 025/197] [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 026/197] [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 027/197] 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 028/197] [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 029/197] [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 030/197] [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 031/197] [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 9ff1aa9f4a2f99df7154fef214231284946c33c3 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 16:47:05 +0200 Subject: [PATCH 032/197] Removed lot of useless stuff and modified the form rendering engine to let the form view insert the fields. bzr revid: nicolas.vanhoren@openerp.com-20121011144705-cu4c2gzsghc2or2l --- addons/web/static/src/js/view_form.js | 90 +++++---------------------- 1 file changed, 17 insertions(+), 73 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 97ad0f220e6..7a0bad0a10c 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -118,7 +118,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.__clicked_inside = false; this.__blur_timeout = null; this.rendering_engine = new instance.web.form.FormRenderingEngine(this); - this.qweb = null; // A QWeb instance will be created if the view is a QWeb template self.set({actual_mode: self.options.initial_mode}); this.has_been_loaded.then(function() { self.on("change:actual_mode", self, self.check_actual_mode); @@ -157,11 +156,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.rendering_engine.set_fields_registry(this.fields_registry); this.rendering_engine.set_tags_registry(this.tags_registry); this.rendering_engine.set_widgets_registry(this.widgets_registry); - if (!this.extract_qweb_template(data)) { - this.rendering_engine.set_fields_view(data); - var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); - this.rendering_engine.render_to($dest); - } + this.rendering_engine.set_fields_view(data); + var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); + var rendering_result = this.rendering_engine.render_to($dest); + _.each(rendering_result.to_replace, function(el) { + el[0].replace(el[1]); + }); this.$el.on('mousedown.formBlur', function () { self.__clicked_inside = true; @@ -214,57 +214,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return $.when(); }, - extract_qweb_template: function(fvg) { - for (var i=0, ii=fvg.arch.children.length; i < ii; i++) { - var child = fvg.arch.children[i]; - if (child.tag === "templates") { - this.qweb = new QWeb2.Engine(); - this.qweb.add_template(instance.web.json_node_to_xml(child)); - if (!this.qweb.has_template('form')) { - throw new Error("No QWeb template found for form view"); - } - return true; - } - } - this.qweb = null; - return false; - }, - get_fvg_from_qweb: function(record) { - var view = this.qweb.render('form', this.get_qweb_context(record)); - var fvg = _.clone(this.fields_view); - fvg.arch = instance.web.xml_to_json(instance.web.str_to_xml(view).firstChild); - return fvg; - }, - get_qweb_context: function(record) { - var self = this, - new_record = {}; - _.each(record, function(value_, name) { - var r = _.clone(self.fields_view.fields[name] || {}); - if ((r.type === 'date' || r.type === 'datetime') && value_) { - r.raw_value = instance.web.auto_str_to_date(value_); - } else { - r.raw_value = value_; - } - r.value = instance.web.format_value(value_, r); - new_record[name] = r; - }); - return { - record : new_record, - new_record : !record.id - }; - }, - kill_current_form: function() { - _.each(this.getChildren(), function(el) { - el.destroy(); - }); - this.fields = {}; - this.fields_order = []; - this.default_focus_field = null; - this.default_focus_button = null; - this.translatable_fields = []; - this.$el.find('.oe_form_container').empty(); - }, - widgetFocused: function() { // Clear click flag if used to focus a widget this.__clicked_inside = false; @@ -368,13 +317,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this._actualize_mode(); this.set({ 'title' : record.id ? record.display_name : "New" }); - if (this.qweb) { - this.kill_current_form(); - this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record)); - var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); - this.rendering_engine.render_to($dest); - } - _(this.fields).each(function (field, f) { field._dirty_flag = false; field._inhibit_on_change_flag = true; @@ -1226,7 +1168,12 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt this.$form.appendTo(this.$target); - var ws = _.map(this.fields_to_init, function($elem) { + var res = { + target: $target, + to_replace: [], + }; + + _.each(this.fields_to_init, function($elem) { var name = $elem.attr("name"); if (!self.fvg.fields[name]) { throw new Error("Field '" + name + "' specified in view could not be found."); @@ -1242,24 +1189,21 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt } self.alter_field(w); self.view.register_field(w, $elem.attr("name")); - return [w, $elem]; - }); - _.each(ws, function(w) { - w[0].replace(w[1]); + res.to_replace.push([w, $elem]); }); _.each(this.tags_to_init, function($elem) { var tag_name = $elem[0].tagName.toLowerCase(); var obj = self.tags_registry.get_object(tag_name); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - w.replace($elem); + res.to_replace.push([w, $elem]); }); _.each(this.widgets_to_init, function($elem) { var widget_type = $elem.attr("type"); var obj = self.widgets_registry.get_object(widget_type); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - w.replace($elem); + res.to_replace.push([w, $elem]); }); - // TODO: return a deferred + return res; }, render_element: function(template /* dictionaries */) { var dicts = [].slice.call(arguments).slice(1); @@ -4991,7 +4935,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ */ render_elements: function () { var self = this; - var content = instance.web.qweb.render("FieldStatus.content", {widget: this}); + var content = QWeb.render("FieldStatus.content", {widget: this}); this.$el.html(content); var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); var color = colors[this.selected_value]; From 3da22818fa25bd73d584f058af925c477908ac26 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 16:51:48 +0200 Subject: [PATCH 033/197] Modified the way the fields are inserted a little bit more bzr revid: nicolas.vanhoren@openerp.com-20121011145148-ii0p0t704gdmmf24 --- addons/web/static/src/js/view_form.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 7a0bad0a10c..ea2e9fa289d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -158,10 +158,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.rendering_engine.set_widgets_registry(this.widgets_registry); this.rendering_engine.set_fields_view(data); var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); - var rendering_result = this.rendering_engine.render_to($dest); - _.each(rendering_result.to_replace, function(el) { - el[0].replace(el[1]); - }); + this.rendering_engine.render_to($dest); + this.rendering_engine.init_fields(); this.$el.on('mousedown.formBlur', function () { self.__clicked_inside = true; @@ -1168,10 +1166,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt this.$form.appendTo(this.$target); - var res = { - target: $target, - to_replace: [], - }; + this.to_replace = []; _.each(this.fields_to_init, function($elem) { var name = $elem.attr("name"); @@ -1189,21 +1184,27 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt } self.alter_field(w); self.view.register_field(w, $elem.attr("name")); - res.to_replace.push([w, $elem]); + self.to_replace.push([w, $elem]); }); _.each(this.tags_to_init, function($elem) { var tag_name = $elem[0].tagName.toLowerCase(); var obj = self.tags_registry.get_object(tag_name); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - res.to_replace.push([w, $elem]); + self.to_replace.push([w, $elem]); }); _.each(this.widgets_to_init, function($elem) { var widget_type = $elem.attr("type"); var obj = self.widgets_registry.get_object(widget_type); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - res.to_replace.push([w, $elem]); + self.to_replace.push([w, $elem]); }); - return res; + }, + init_fields: function() { + var defs = []; + _.each(this.to_replace, function(el) { + defs.push(el[0].replace(el[1])); + }); + return $.when.apply($, defs); }, render_element: function(template /* dictionaries */) { var dicts = [].slice.call(arguments).slice(1); From 4757e5287e1ebca9508730413d94c63059531907 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 17:21:40 +0200 Subject: [PATCH 034/197] Modified fields up to m2o bzr revid: nicolas.vanhoren@openerp.com-20121011152140-c4edgpmamqgiwx9s --- addons/web/static/src/js/view_form.js | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index ea2e9fa289d..6381cf5fe6c 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -159,7 +159,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.rendering_engine.set_fields_view(data); var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); this.rendering_engine.render_to($dest); - this.rendering_engine.init_fields(); this.$el.on('mousedown.formBlur', function () { self.__clicked_inside = true; @@ -335,6 +334,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); } self.on_form_changed(); + this.rendering_engine.init_fields(); self.is_initialized.resolve(); self.do_update_pager(record.id == null); if (self.sidebar) { @@ -1204,6 +1204,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt _.each(this.to_replace, function(el) { defs.push(el[0].replace(el[1])); }); + this.to_replace = []; return $.when.apply($, defs); }, render_element: function(template /* dictionaries */) { @@ -2066,6 +2067,14 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.field_manager.on("change:display_invalid_fields", this, this._check_css_flags); this._check_css_flags(); }, + start: function() { + var tmp = this._super(); + this.on("change:value", this, function() { + if (! this.no_rerender) + this.render(); + }); + this.render(); + }, /** * Private. Do not use. */ @@ -2078,6 +2087,20 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w get_value: function() { return this.get('value'); }, + /** + Utility method that all implementations should use to change the + value without triggering a re-rendering. + */ + internal_set_value: function(value_) { + var tmp = this.no_render; + this.no_rerender = true; + this.set({'value': value_}); + this.no_rerender = tmp; + }, + /** + This method is called each time the value is modified. + */ + render_value: function() {}, is_valid: function() { return this.is_syntax_valid() && !(this.get('required') && this.is_false()); }, @@ -2161,10 +2184,6 @@ instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.Reini instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this); this.render_value(); }, - /** - * Called to render the value. Should also be explicitly called at the end of a set_value(). - */ - render_value: function() {}, }); instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { @@ -2178,14 +2197,10 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we var self = this; var $input = this.$el.find('input'); $input.change(function() { - self.set({'value': self.parse_value($input.val())}); + self.internal_set_value(self.parse_value($input.val())); }); this.setupFocus($input); }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { var show_value = this.format_value(this.get('value'), ''); if (!this.get("effective_readonly")) { @@ -2289,7 +2304,7 @@ instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({ widget_class: 'oe_form_field_float', init: function (field_manager, node) { this._super(field_manager, node); - this.set({'value': 0}); + this.internal_set_value(0); if (this.node.attrs.digits) { this.digits = this.node.attrs.digits; } else { @@ -2415,16 +2430,12 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc if (!this.get("effective_readonly")) { this.datewidget = this.build_widget(); this.datewidget.on_change.add_last(_.bind(function() { - this.set({'value': this.datewidget.get_value()}); + this.internal_set_value(this.datewidget.get_value()); }, this)); this.datewidget.appendTo(this.$el); this.setupFocus(this.datewidget.$input); } }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { if (!this.get("effective_readonly")) { this.datewidget.set_value(this.get('value')); @@ -2466,7 +2477,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we this.default_height = this.$textarea.css('height'); if (!this.get("effective_readonly")) { this.$textarea.change(_.bind(function() { - self.set({'value': instance.web.parse_value(self.$textarea.val(), self)}); + self.internal_set_value(instance.web.parse_value(self.$textarea.val(), self)); }, this)); } else { this.$textarea.attr('disabled', 'disabled'); @@ -2478,12 +2489,8 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we }); this.setupFocus(this.$textarea); }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - $(window).resize(); - }, render_value: function() { + $(window).resize(); var show_value = instance.web.format_value(this.get('value'), this, ''); if (show_value === '') { this.$textarea.css('height', parseInt(this.default_height)+"px"); @@ -2543,15 +2550,11 @@ instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instanc this.$cleditor.change(function() { if (! self._updating_editor) { self.$cleditor.updateTextArea(); - self.set({'value': self.$textarea.val()}); + self.internal_set_value(self.$textarea.val()); } }); } }, - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { if (! this.get("effective_readonly")) { this.$textarea.val(this.get('value') || ''); @@ -2572,7 +2575,7 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ this.$checkbox = $("input", this.$el); this.setupFocus(this.$checkbox); this.$el.click(_.bind(function() { - this.set({'value': this.$checkbox.is(':checked')}); + this.internal_set_value(this.$checkbox.is(':checked')); }, this)); var check_readonly = function() { self.$checkbox.prop('disabled', self.get("effective_readonly")); @@ -2580,10 +2583,9 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ this.on("change:effective_readonly", this, check_readonly); check_readonly.call(this); }, - set_value: function(value_) { - this._super.apply(this, arguments); - this.$checkbox[0].checked = value_; - }, + render_value: function() { + this.$checkbox[0].checked = this.get('value'); + } focus: function() { this.$checkbox.focus(); } @@ -2598,9 +2600,8 @@ instance.web.form.FieldProgressBar = instance.web.form.AbstractField.extend({ disabled: this.get("effective_readonly") }); }, - set_value: function(value_) { - this._super.apply(this, arguments); - var show_value = Number(value_); + render_value: function() { + var show_value = Number(this.get('value')); if (isNaN(show_value)) { show_value = 0; } @@ -2638,7 +2639,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan var ischanging = false; var $select = this.$el.find('select') .change(_.bind(function() { - this.set({'value': this.values[this.$el.find('select')[0].selectedIndex][0]}); + this.internal_set_value(this.values[this.$el.find('select')[0].selectedIndex][0]); }, this)) .change(function () { ischanging = true; }) .click(function () { ischanging = false; }) @@ -2653,7 +2654,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan value_ = value_ === null ? false : value_; value_ = value_ instanceof Array ? value_[0] : value_; this._super(value_); - this.render_value(); }, render_value: function() { if (!this.get("effective_readonly")) { From 7cd873f86fb38996bab4ec3b9b8640669171095f Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 17:23:08 +0200 Subject: [PATCH 035/197] fix typo bzr revid: nicolas.vanhoren@openerp.com-20121011152308-exmq8zruqba7u4fw --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 6381cf5fe6c..e599256de00 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2585,7 +2585,7 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ }, render_value: function() { this.$checkbox[0].checked = this.get('value'); - } + }, focus: function() { this.$checkbox.focus(); } From 2fadf797e56a15e7b3a6b19422876e1ce3752d03 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 17:35:06 +0200 Subject: [PATCH 036/197] Ported the m2o bzr revid: nicolas.vanhoren@openerp.com-20121011153506-b91c4xm2jsf6a6t7 --- addons/web/static/src/js/view_form.js | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e599256de00..dad787374a1 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2873,26 +2873,28 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.display_value = {}; this.last_search = []; this.floating = false; - this.inhibit_on_change = false; this.current_display = null; + this.is_started = false; }, start: function() { this._super(); instance.web.form.ReinitializeFieldMixin.start.call(this); - this.on("change:value", this, function() { - this.floating = false; - this.render_value(); - }); + this.is_started = true; instance.web.bus.on('click', this, function() { if (!this.get("effective_readonly") && this.$input && this.$input.autocomplete('widget').is(':visible')) { this.$input.autocomplete("close"); } }); }, + reinit_value: function(val) { + this.internal_set_value(val); + this.floating = false; + if (this.is_started) + this.render_value(); + }, initialize_content: function() { if (!this.get("effective_readonly")) this.render_editable(); - this.render_value(); }, init_error_displayer: function() { // nothing @@ -2943,7 +2945,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (self.current_display !== self.$input.val()) { self.current_display = self.$input.val(); if (self.$input.val() === "") { - self.set({value: false}); + self.internal_set_value(false); self.floating = false; } else { self.floating = true; @@ -2975,15 +2977,14 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (self.last_search[0][0] != self.get("value")) { self.display_value = {}; self.display_value["" + self.last_search[0][0]] = self.last_search[0][1]; - self.set({value: self.last_search[0][0]}); + self.reinit_value(self.last_search[0][0]); } else { used = true; self.render_value(); } } else { used = true; - self.set({value: false}); - self.render_value(); + self.reinit_value(false); } self.floating = false; } @@ -3038,7 +3039,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (item.id) { self.display_value = {}; self.display_value["" + item.id] = item.name; - self.set({value: item.id}); + self.reinit_value(item.id); } else if (item.action) { item.action(); // Cancel widget blurring, to avoid form blur event @@ -3129,16 +3130,14 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc value_ = value_[0]; } value_ = value_ || false; - this.inhibit_on_change = true; - this._super(value_); - this.inhibit_on_change = false; + this.reinit_value(value_); }, get_displayed: function() { return this.display_value["" + this.get("value")]; }, add_id: function(id) { this.display_value = {}; - this.set({value: id}); + this.reinit_value(id); }, is_false: function() { return ! this.get("value"); From b164a96535e66313ed6502e17d1f8bee45a9a9c6 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 17:47:00 +0200 Subject: [PATCH 037/197] Ported m2mtags, reference and binary, still need to port o2m & m2m bzr revid: nicolas.vanhoren@openerp.com-20121011154700-nm1j0nibq3xazaix --- addons/web/static/src/js/view_form.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index dad787374a1..add396df790 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3830,7 +3830,6 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in start: function() { this._super(); instance.web.form.ReinitializeFieldMixin.start.call(this); - this.on("change:value", this, this.render_value); }, initialize_content: function() { if (this.get("effective_readonly")) @@ -4624,10 +4623,6 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan is_false: function() { return typeof(this.get_value()) !== 'string'; }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { this.reference_ready = false; var vals = [], sel_val, m2o_val; @@ -4647,9 +4642,9 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan var model = this.selection.get_value(), id = this.m2o.get_value(); if (typeof(model) === 'string' && typeof(id) === 'number') { - this.set({'value': model + ',' + id}); + this.internal_set_value(model + ',' + id); } else { - this.set({'value': false}); + this.internal_set_value(false); } }, }); @@ -4748,7 +4743,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. on_clear: function() { if (this.get('value') !== false) { this.binary_value = false; - this.set({'value': false}); + this.internal_set_value(false); } return false; } @@ -4768,10 +4763,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ }); } }, - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { if (!this.get("effective_readonly")) { var show_value; @@ -4793,7 +4784,7 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { this.binary_value = true; - this.set({'value': file_base64}); + this.internal_set_value(file_base64); var show_value = name + " (" + this.human_filesize(size) + ")"; this.$el.find('input').eq(0).val(show_value); this.set_filename(name); @@ -4807,10 +4798,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ template: 'FieldBinaryImage', - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { var self = this; var url; @@ -4843,7 +4830,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ this._super.apply(this, arguments); }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { - this.set({'value': file_base64}); + this.internal_set_value(file_base64); this.binary_value = true; this.render_value(); this.set_filename(name); From f5b1729758010c319aba4381c5231203f486f828 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 18:09:02 +0200 Subject: [PATCH 038/197] Fixed lot of stuff and rewritten partially field status bzr revid: nicolas.vanhoren@openerp.com-20121011160902-llwsclos30nju80s --- addons/web/static/src/js/view_form.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index add396df790..3d8f4a96ae1 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -334,7 +334,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); } self.on_form_changed(); - this.rendering_engine.init_fields(); + self.rendering_engine.init_fields(); self.is_initialized.resolve(); self.do_update_pager(record.id == null); if (self.sidebar) { @@ -2071,9 +2071,9 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w var tmp = this._super(); this.on("change:value", this, function() { if (! this.no_rerender) - this.render(); + this.render_value(); }); - this.render(); + this.render_value(); }, /** * Private. Do not use. @@ -2148,8 +2148,8 @@ instance.web.form.ReinitializeWidgetMixin = { * Default implementation of start(), use it or call explicitly initialize_field(). */ start: function() { - this._super(); this.initialize_field(); + this._super(); }, initialize_field: function() { this.on("change:effective_readonly", this, this.reinitialize); @@ -2571,7 +2571,6 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ template: 'FieldBoolean', start: function() { var self = this; - this._super.apply(this, arguments); this.$checkbox = $("input", this.$el); this.setupFocus(this.$checkbox); this.$el.click(_.bind(function() { @@ -2582,6 +2581,7 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ }; this.on("change:effective_readonly", this, check_readonly); check_readonly.call(this); + this._super.apply(this, arguments); }, render_value: function() { this.$checkbox[0].checked = this.get('value'); @@ -4851,7 +4851,6 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ this.selected_value = null; }, start: function() { - this._super(); // backward compatibility this.loaded = new $.Deferred(); if (this.options.clickable) { @@ -4861,18 +4860,13 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ if (this.$el.parent().is('header')) { this.$el.after('
'); } + this._super(); }, set_value: function(value_) { - var self = this; - this._super(value_); - // find selected value: - // - many2one: [2, "New"] -> 2 - // - selection: new -> new - if (this.field.type == "many2one") { - this.selected_value = value_[0]; - } else { - this.selected_value = value_; + if (value_ instanceof Array) { + value_ = value_[0]; } + this._super(value_); // trick to be sure all values are loaded in the form, therefore // enabling the evaluation of dynamic domains self.selection = []; @@ -4881,6 +4875,9 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ }); return this.loaded; }, + render_value: function() { + this.get_selection(); + }, /** Get the selection and render it * selection: [[identifier, value_to_display], ...] * For selection fields: this is directly given by this.field.selection From 4a77345f634b6f419f4d2da919b091ab92abb980 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 11 Oct 2012 18:16:14 +0200 Subject: [PATCH 039/197] [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 fb944a77faff92a79d25957a89af47212e005afb Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 18:18:16 +0200 Subject: [PATCH 040/197] Ported field status bzr revid: nicolas.vanhoren@openerp.com-20121011161816-lnz7prb3ag6nrbi3 --- addons/web/static/src/js/view_form.js | 53 +++++++++------------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 3d8f4a96ae1..c708d56a7ef 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4848,15 +4848,12 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ this._super(field_manager, node); this.options.clickable = this.options.clickable || (this.node.attrs || {}).clickable || false; this.options.visible = this.options.visible || (this.node.attrs || {}).statusbar_visible || false; - this.selected_value = null; + this.set({value: false}); }, start: function() { - // backward compatibility - this.loaded = new $.Deferred(); if (this.options.clickable) { this.$el.on('click','li',this.on_click_stage); } - // TODO move the following into css :after if (this.$el.parent().is('header')) { this.$el.after('
'); } @@ -4867,16 +4864,18 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ value_ = value_[0]; } this._super(value_); - // trick to be sure all values are loaded in the form, therefore - // enabling the evaluation of dynamic domains - self.selection = []; - $.async_when().then(function() { - self.get_selection(); - }); - return this.loaded; }, render_value: function() { - this.get_selection(); + var self = this; + self.get_selection().then(function() { + var content = QWeb.render("FieldStatus.content", {widget: self}); + self.$el.html(content); + var colors = JSON.parse((self.node.attrs || {}).statusbar_colors || "{}"); + var color = colors[self.get('value')]; + if (color) { + self.$("oe_active").css("color", color); + } + }); }, /** Get the selection and render it * selection: [[identifier, value_to_display], ...] @@ -4885,53 +4884,37 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ */ get_selection: function() { var self = this; + self.selection = []; if (this.field.type == "many2one") { var domain = []; if(!_.isEmpty(this.field.domain) || !_.isEmpty(this.node.attrs.domain)) { - domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.selected_value]]); + domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.get('value')]]); } var ds = new instance.web.DataSetSearch(this, this.field.relation, self.build_context(), domain); - ds.read_slice(['name'], {}).done( function (records) { + return ds.read_slice(['name'], {}).pipe(function (records) { for(var i = 0; i < records.length; i++) { self.selection.push([records[i].id, records[i].name]); } - self.render_elements(); - self.loaded.resolve(); }); } else { - this.loaded.resolve(); // For field type selection filter values according to // statusbar_visible attribute of the field. For example: // statusbar_visible="draft,open". var selection = this.field.selection; - for(var i=0; i< selection.length; i++) { + for(var i=0; i < selection.length; i++) { var key = selection[i][0]; - if(key == this.selected_value || !this.options.visible || this.options.visible.indexOf(key) != -1) { + if(key == this.get('value') || !this.options.visible || this.options.visible.indexOf(key) != -1) { this.selection.push(selection[i]); } } - this.render_elements(); - } - }, - /** Renders the widget. This function also checks for statusbar_colors='{"pending": "blue"}' - * attribute in the widget. This allows to set a given color to a given - * state (given by the key of (key, label)). - */ - render_elements: function () { - var self = this; - var content = QWeb.render("FieldStatus.content", {widget: this}); - this.$el.html(content); - var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); - var color = colors[this.selected_value]; - if (color) { - this.$("oe_active").css("color", color); + return $.when(); } }, on_click_stage: function (ev) { var self = this; var $li = $(ev.currentTarget); var val = parseInt($li.data("id")); - if (val != self.selected_value) { + if (val != self.get('value')) { this.view.recursive_save().then(function() { var change = {}; change[self.name] = val; From 55a5f51aebe7fd4dc08759654d3649952ce8cb0e Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 11 Oct 2012 18:29:18 +0200 Subject: [PATCH 041/197] Ported o2m bzr revid: nicolas.vanhoren@openerp.com-20121011162918-d15ip9ci4o24axzy --- addons/web/static/src/js/view_form.js | 28 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c708d56a7ef..3905501e6cd 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2877,7 +2877,6 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.is_started = false; }, start: function() { - this._super(); instance.web.form.ReinitializeFieldMixin.start.call(this); this.is_started = true; instance.web.bus.on('click', this, function() { @@ -2885,6 +2884,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.$input.autocomplete("close"); } }); + this._super(); }, reinit_value: function(val) { this.internal_set_value(val); @@ -3213,6 +3213,16 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ this.is_setted = $.Deferred(); this.form_last_update = $.Deferred(); this.init_form_last_update = this.form_last_update; + this.is_started = false; + this.dataset = new instance.web.form.One2ManyDataSet(this, this.field.relation); + this.dataset.o2m = this; + this.dataset.parent_view = this.view; + this.dataset.child_name = this.name; + var self = this; + this.dataset.on_change.add_last(function() { + self.trigger_on_change(); + }); + this.set_value([]); }, start: function() { this._super.apply(this, arguments); @@ -3220,14 +3230,6 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var self = this; - this.dataset = new instance.web.form.One2ManyDataSet(this, this.field.relation); - this.dataset.o2m = this; - this.dataset.parent_view = this.view; - this.dataset.child_name = this.name; - this.dataset.on_change.add_last(function() { - self.trigger_on_change(); - }); - this.is_setted.then(function() { self.load_views(); }); @@ -3241,6 +3243,8 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ }); }); }); + this.is_started = true; + this.reload_current_view(); }, trigger_on_change: function() { var tmp = this.doing_on_change; @@ -3429,7 +3433,11 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ } self.is_setted.resolve(); this.trigger_on_change(); - return self.reload_current_view(); + if (this.is_started) { + return self.reload_current_view(); + } else { + return $.when(); + } }, get_value: function() { var self = this; From 87e89592056f5290f64c28fdfe72dc9b1aa93fb6 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 23:11:26 +0530 Subject: [PATCH 042/197] [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 7314375acacbd6561a3baaf045fb86974a4a165d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 10:43:37 +0200 Subject: [PATCH 043/197] Ported m2m, still has to port m2mtags bzr revid: nicolas.vanhoren@openerp.com-20121012084337-7etwh54ugl4k01mu --- addons/web/static/src/js/view_form.js | 47 ++++++++++----------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 3905501e6cd..eda2c8a64f4 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3210,7 +3210,6 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ lazy_build_o2m_kanban_view(); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); this.form_last_update = $.Deferred(); this.init_form_last_update = this.form_last_update; this.is_started = false; @@ -3230,9 +3229,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var self = this; - this.is_setted.then(function() { - self.load_views(); - }); + self.load_views(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { @@ -3348,10 +3345,8 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ } }); }); - this.is_setted.then(function() { - $.async_when().then(function () { - self.viewmanager.appendTo(self.$el); - }); + $.async_when().then(function () { + self.viewmanager.appendTo(self.$el); }); return def; }, @@ -3431,7 +3426,6 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ if (this.dataset.index === null && this.dataset.ids.length > 0) { this.dataset.index = 0; } - self.is_setted.resolve(); this.trigger_on_change(); if (this.is_started) { return self.reload_current_view(); @@ -3960,36 +3954,33 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ disable_utility_classes: true, init: function(field_manager, node) { this._super(field_manager, node); - this.set({"value": []}); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); + this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); + this.dataset.m2m = this; + var self = this; + this.dataset.on('unlink', self, function(ids) { + self.dataset_changed(); + }); + this.set_value([]); }, start: function() { - this._super.apply(this, arguments); this.$el.addClass('oe_form_field oe_form_field_many2many'); var self = this; - this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); - this.dataset.m2m = this; - this.dataset.on('unlink', self, function(ids) { - self.dataset_changed(); - }); - - this.is_setted.then(function() { - self.load_view(); - }); + self.load_view(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { self.list_view.destroy(); return $.when(self.load_view()).then(function() { - self.reload_content(); + self.render_value(); }); }); }); }); + this._super.apply(this, arguments); }, set_value: function(value_) { value_ = value_ || []; @@ -3997,17 +3988,12 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ value_ = value_[0][2]; } this._super(value_); - this.dataset.set_ids(value_); - var self = this; - self.reload_content(); - this.is_setted.resolve(); }, get_value: function() { return [commands.replace_with(this.get('value'))]; }, - is_false: function () { - return _(this.dataset.ids).isEmpty(); + return _(this.get("value")).isEmpty(); }, load_view: function() { var self = this; @@ -4034,14 +4020,15 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ }); return loaded; }, - reload_content: function() { + render_value: function() { var self = this; + this.dataset.set_ids(this.get("value")); this.is_loaded = this.is_loaded.pipe(function() { return self.list_view.reload_content(); }); }, dataset_changed: function() { - this.set({'value': this.dataset.ids}); + this.internal_set_value(this.dataset.ids); }, }); From dbe370f5851182427fcafb0484354a5672a89189 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 11:18:20 +0200 Subject: [PATCH 044/197] Ported m2mkanban and corrected bug in selection bzr revid: nicolas.vanhoren@openerp.com-20121012091820-u712bie1h2a84l8a --- addons/web/static/src/js/view_form.js | 38 +++++++++------------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a3a61168f17..69cb549203b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2671,13 +2671,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan this.$el.text(option ? option[1] : this.values[0][1]); } }, - is_syntax_valid: function() { - if (this.get("effective_readonly")) { - return true; - } - var value_ = this.values[this.$el.find('select')[0].selectedIndex]; - return !! value_; - }, focus: function() { this.$el.find('select:first').focus(); } @@ -4086,28 +4079,26 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( m2m_kanban_lazy_init(); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); + + var self = this; + this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); + this.dataset.m2m = this; + this.dataset.on('unlink', self, function(ids) { + self.dataset_changed(); + }); }, start: function() { this._super.apply(this, arguments); var self = this; - this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); - this.dataset.m2m = this; - this.dataset.on('unlink', self, function(ids) { - self.dataset_changed(); - }); - - this.is_setted.then(function() { - self.load_view(); - }); + self.load_view(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { self.kanban_view.destroy(); return $.when(self.load_view()).then(function() { - self.reload_content(); + self.render_value(); }); }); }); @@ -4119,10 +4110,6 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( value_ = value_[0][2]; } this._super(value_); - this.dataset.set_ids(value_); - var self = this; - self.reload_content(); - this.is_setted.resolve(); }, load_view: function() { var self = this; @@ -4149,8 +4136,9 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( }); return loaded; }, - reload_content: function() { + render_value: function() { var self = this; + this.dataset.set_ids(this.get("value")); this.is_loaded = this.is_loaded.pipe(function() { return self.kanban_view.do_search(self.build_domain(), self.dataset.get_context(), []); }); @@ -4177,7 +4165,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); self.dataset_changed(); - self.reload_content(); + self.render_value(); } }); }); @@ -4188,7 +4176,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( title: _t("Open: ") + self.string, write_function: function(id, data, options) { return self.dataset.write(id, data, {}).then(function() { - self.reload_content(); + self.render_value(); }); }, alternative_form_view: self.field.views ? self.field.views["form"] : undefined, From c82642a2dfda36a78677b23b296449782c713fdb Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 13:09:43 +0200 Subject: [PATCH 045/197] fixed problem with mail bzr revid: nicolas.vanhoren@openerp.com-20121012110943-b1fhnutsokyazh22 --- addons/mail/static/src/js/mail.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e0c9ac9b7fc..25d32f2a32e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1017,9 +1017,7 @@ openerp.mail = function(session) { this.$el.toggle(this.view.get("actual_mode") !== "create"); }, - set_value: function() { - var self = this; - this._super.apply(this, arguments); + render_value: function() { if (! this.view.datarecord.id || session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) { this.$('oe_mail_thread').hide(); return; From 36fa302c351846b09cd530a7e7674e489346f2d3 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 13:14:40 +0200 Subject: [PATCH 046/197] Fixed bug in m2m tags bzr revid: nicolas.vanhoren@openerp.com-20121012111440-2y1q0745nv7nouiy --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 69cb549203b..3297b60e60d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3825,8 +3825,8 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in this._drop_shown = false; }, start: function() { - this._super(); instance.web.form.ReinitializeFieldMixin.start.call(this); + this._super(); }, initialize_content: function() { if (this.get("effective_readonly")) From 15974eb2e095238cb1016d832e97110fb7a6794d Mon Sep 17 00:00:00 2001 From: Vishmita Date: Fri, 12 Oct 2012 17:15:34 +0530 Subject: [PATCH 047/197] [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 802eda5ad7169aa927029574007b1f868b72fae1 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 14:11:26 +0200 Subject: [PATCH 048/197] Ported field pad bzr revid: nicolas.vanhoren@openerp.com-20121012121126-atu1vf14rc4fxu0g --- addons/pad/static/src/js/pad.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index 1e45b535867..cba2086b772 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -4,16 +4,13 @@ openerp.pad = function(instance) { template: 'FieldPad', configured: false, content: "", - set_value: function(val) { + render_value: function() { var self = this; - var _super = self._super; - _super.apply(self,[val]); - - if (val === false || val === "") { - self.field_manager.dataset.call('pad_generate_url',{context:{ - model: self.field_manager.model, + if (this.get("value") === false || this.get("value") === "") { + self.view.dataset.call('pad_generate_url',{context:{ + model: self.view.model, field_name: self.name, - object_id: self.field_manager.datarecord.id + object_id: self.view.datarecord.id }}).then(function(data) { if(data&&data.url){ _super.apply(self,[data.url]); From e4e1803fb30bf09ee8cbcb6bf80905fa7261ad6d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 14:18:03 +0200 Subject: [PATCH 049/197] Ported field mail followers bzr revid: nicolas.vanhoren@openerp.com-20121012121803-imyqenc1jxipdra5 --- addons/mail/static/src/js/mail_followers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 6c016c6c679..dd1db686efc 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -103,9 +103,9 @@ openerp_mail_followers = function(session, mail) { }); }, - set_value: function(value_) { + render_value: function() { this.reinit(); - return this.fetch_followers(value_ || this.get_value()); + return this.fetch_followers(this.get("value")); }, set_is_follower: function(value_) { From ccfa2e83d4784b4ea165ae12b5befbdae3ef1a67 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 12 Oct 2012 14:37:13 +0200 Subject: [PATCH 050/197] Modified documentation. bzr revid: nicolas.vanhoren@openerp.com-20121012123713-6cmnayk7pr3mgs4p --- addons/web/static/src/js/view_form.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 3297b60e60d..20c796a1d8b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1954,12 +1954,9 @@ instance.web.form.FieldInterface = { /** * Called by the form view to indicate the value of the field. * - * set_value() may return an object that can be passed to $.when() that represents the moment when - * the field has finished all operations necessary before the user can effectively use the widget. - * * Multiple calls to set_value() can occur at any time and must be handled correctly by the implementation, - * regardless of any asynchronous operation currently running and the status of any promise that a - * previous call to set_value() could have returned. + * regardless of any asynchronous operation currently running. Calls to set_value() can and will also occur + * before the widget is inserted into the DOM. * * set_value() must be able, at any moment, to handle the syntax returned by the "read" method of the * osv class in the OpenERP server as well as the syntax used by the set_value() (see below). It must From adc318837a86c72c1a9f490f56305a941c638e88 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 12 Oct 2012 14:40:03 +0200 Subject: [PATCH 051/197] [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 052/197] [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=$('