From 49b843d65f5f1fb8b0162b5e496bc54c9c2c312f Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 21 Dec 2012 11:21:51 +0100 Subject: [PATCH] [IMP] crm: remove inheritance on base.action.rule, and change demo action rules to use standard stuff bzr revid: rco@openerp.com-20121221102151-fxepq652rkeba62z --- addons/crm/__init__.py | 1 - addons/crm/__openerp__.py | 1 - addons/crm/crm_action_rule.py | 63 ------------------------- addons/crm/crm_action_rule_demo.xml | 12 ++++- addons/crm/crm_action_rule_view.xml | 17 ------- addons/crm/security/ir.model.access.csv | 2 +- 6 files changed, 12 insertions(+), 84 deletions(-) delete mode 100644 addons/crm/crm_action_rule.py delete mode 100644 addons/crm/crm_action_rule_view.xml diff --git a/addons/crm/__init__.py b/addons/crm/__init__.py index 729d54e0fc6..d78fb09eae7 100644 --- a/addons/crm/__init__.py +++ b/addons/crm/__init__.py @@ -20,7 +20,6 @@ ############################################################################## import crm -import crm_action_rule import crm_segmentation import crm_lead import crm_meeting diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 674fb489311..4a792abc9ee 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -77,7 +77,6 @@ Dashboard for CRM will include: 'crm_view.xml', - 'crm_action_rule_view.xml', 'crm_lead_view.xml', 'crm_lead_menu.xml', diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py deleted file mode 100644 index 1ea3d34494e..00000000000 --- a/addons/crm/crm_action_rule.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import re -from openerp import tools - -from openerp.tools.translate import _ -from openerp.tools import ustr -from openerp.osv import fields -from openerp.osv import osv - -import crm - -class base_action_rule(osv.osv): - """ Base Action Rule """ - _inherit = 'base.action.rule' - _description = 'Action Rules' - - _columns = { - 'act_section_id': fields.many2one('crm.case.section', 'Set Team to'), - 'act_categ_id': fields.many2one('crm.case.categ', 'Set Category to'), - } - - def _process(self, cr, uid, action, record_ids, context=None): - """ process the given action on the records """ - res = super(base_action_rule, self)._process(cr, uid, action, record_ids, context=context) - - # add record modifications - context = dict(context or {}, action=True) - model = self.pool.get(action.model_id.model) - values = {} - if action.act_section_id and 'section_id' in model._all_columns: - values['section_id'] = action.act_section_id.id - if action.act_categ_id and 'categ_ids' in model._all_columns: - values['categ_ids'] = [(4, action.act_categ_id.id)] - model.write(cr, uid, record_ids, values, context=context) - - return res - - def state_get(self, cr, uid, context=None): - """Gets available states for crm""" - res = super(base_action_rule, self).state_get(cr, uid, context=context) - return res + crm.AVAILABLE_STATES - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_action_rule_demo.xml b/addons/crm/crm_action_rule_demo.xml index b861909eb0c..0ace3bb0f25 100644 --- a/addons/crm/crm_action_rule_demo.xml +++ b/addons/crm/crm_action_rule_demo.xml @@ -40,6 +40,16 @@ Description: [[object.description]] [('country_id','=','United States')] + + Set team to Sales Department + + True + ir.actions.server + code + sales_team = self.pool.get('ir.model.data').get_object(cr, uid, 'crm', 'section_sales_department') +object.write({'section_id': sales_team.id}) + + Set Auto Followers on leads which are urgent and come from USA. @@ -47,10 +57,10 @@ Description: [[object.description]] - create 0 minutes + diff --git a/addons/crm/crm_action_rule_view.xml b/addons/crm/crm_action_rule_view.xml deleted file mode 100644 index 347e54c46ac..00000000000 --- a/addons/crm/crm_action_rule_view.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - base.action.rule.form.inherit - base.action.rule - - - - - - - - - - diff --git a/addons/crm/security/ir.model.access.csv b/addons/crm/security/ir.model.access.csv index 17bef812e4b..74394d3c5ce 100644 --- a/addons/crm/security/ir.model.access.csv +++ b/addons/crm/security/ir.model.access.csv @@ -30,7 +30,7 @@ access_res_partner,res.partner.crm.user,base.model_res_partner,base.group_sale_s access_res_partner_category,res.partner.category.crm.user,base.model_res_partner_category,base.group_sale_salesman,1,1,1,0 mail_mailgate_thread,mail.thread,mail.model_mail_thread,base.group_sale_salesman,1,1,1,1 access_crm_case_categ_manager,crm.case.categ manager,model_crm_case_categ,base.group_sale_manager,1,1,1,1 -access_base_action_rule_manager,base.action.rule manager,model_base_action_rule,base.group_sale_manager,1,1,1,1 +access_base_action_rule_manager,base.action.rule manager,base_action_rule.model_base_action_rule,base.group_sale_manager,1,1,1,1 access_crm_lead_report_user,crm.lead.report user,model_crm_lead_report,base.group_sale_salesman,1,1,1,1 access_res_partner_bank_type_crm_user,res.partner.bank.type.crm.user,base.model_res_partner_bank_type,base.group_sale_salesman,1,0,0,0 access_crm_lead_partner_manager,crm.lead.partner.manager,model_crm_lead,base.group_partner_manager,1,0,0,0