From 3666ed98289408b1d2a4f914dbc7ef395ff27b19 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 13 Jun 2012 11:02:22 +0200 Subject: [PATCH 001/223] [FIX] (safe_eval) opcode STORE_MAP belongs into _CONST_OPCODES otherwise, const_eval("{'hello':'world'}") won't work bzr revid: hbrunn@therp.nl-20120613090222-gt33zwz1aymcmxqo --- openerp/tools/safe_eval.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/tools/safe_eval.py b/openerp/tools/safe_eval.py index 601fd95200a..1c3870004a7 100644 --- a/openerp/tools/safe_eval.py +++ b/openerp/tools/safe_eval.py @@ -46,7 +46,7 @@ _ALLOWED_MODULES = ['_strptime', 'time'] _CONST_OPCODES = set(opmap[x] for x in [ 'POP_TOP', 'ROT_TWO', 'ROT_THREE', 'ROT_FOUR', 'DUP_TOP', 'DUP_TOPX', 'POP_BLOCK','SETUP_LOOP', 'BUILD_LIST', 'BUILD_MAP', 'BUILD_TUPLE', - 'LOAD_CONST', 'RETURN_VALUE', 'STORE_SUBSCR'] if x in opmap) + 'LOAD_CONST', 'RETURN_VALUE', 'STORE_SUBSCR', 'STORE_MAP'] if x in opmap) _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [ 'UNARY_POSITIVE', 'UNARY_NEGATIVE', 'UNARY_NOT', @@ -61,7 +61,7 @@ _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [ ] if x in opmap)) _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [ - 'STORE_MAP', 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', + 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', 'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'DELETE_NAME', 'JUMP_FORWARD', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_ABSOLUTE', 'MAKE_FUNCTION', 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3', From df107e19ec3e51827721f96557dd97927c23126d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 3 Sep 2012 14:16:25 +0530 Subject: [PATCH 002/223] [FIX] pass context in search and name_get method inside name_search. bzr revid: tpa@tinyerp.com-20120903084625-nnkl9k2ljaauv4bh --- openerp/addons/base/res/res_users.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index ca45f03258c..012ab8a116a 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -310,10 +310,10 @@ class res_users(osv.osv): context={} ids = [] if name: - ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit) + ids = self.search(cr, user, [('login','=',name)]+ args, limit=limit, context=context) if not ids: - ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit) - return self.name_get(cr, user, ids) + ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) + return self.name_get(cr, user, ids, context=context) def copy(self, cr, uid, id, default=None, context=None): user2copy = self.read(cr, uid, [id], ['login','name'])[0] From e6178297dfea0f56c887467f0c5486c06243719f Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 18 Sep 2012 10:40:18 +0530 Subject: [PATCH 003/223] [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 bb4b253dfda091393289c08ddd9822be46b2fb4f Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Wed, 3 Oct 2012 16:06:08 +0530 Subject: [PATCH 004/223] [IMP] mrp: added onchange method for product_uom field bzr revid: cha@tinyerp.com-20121003103608-1uuh3t9mw7i2scif --- addons/mrp/mrp.py | 11 +++++++++++ addons/mrp/mrp_view.xml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index cf203a60c7f..a570842a36e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -274,6 +274,17 @@ class mrp_bom(osv.osv): return {'value': {'name': prod.name, 'product_uom': prod.uom_id.id}} return {} + def onchange_uom(self, cr, uid, ids, product_id, product_uom, context=None): + res = {'value':{}} + if not product_uom or not product_id: + return res + product = self.pool.get('product.product').browse(cr, uid, product_id, context=context) + uom = self.pool.get('product.uom').browse(cr, uid, product_uom, context=context) + if uom.category_id.id != product.uom_id.category_id.id: + res['warning'] = {'title': _('Warning'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')} + res['value'].update({'product_uom': product.uom_id.id}) + return res + def _bom_find(self, cr, uid, product_id, product_uom, properties=None): """ Finds BoM for particular product and product uom. @param product_id: Selected product. diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index abf0f823e5c..dca41050430 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -351,7 +351,7 @@