diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index a490a800beb..f23b61df5ea 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -85,6 +85,8 @@ Create dashboard for CRM that includes: 'wizard/crm_forward_to_partner_view.xml', 'wizard/crm_send_email_view.xml', + 'wizard/crm_custom_create_menu_view.xml', + 'crm_view.xml', 'crm_action_rule_view.xml', diff --git a/addons/crm/board_crm_statistical_view.xml b/addons/crm/board_crm_statistical_view.xml index b23fdeac1cd..01d0472c21e 100644 --- a/addons/crm/board_crm_statistical_view.xml +++ b/addons/crm/board_crm_statistical_view.xml @@ -36,7 +36,7 @@ - + @@ -60,7 +60,7 @@ - Number of Opportunities by stage + Planned revenue by user and stage crm.lead.report form graph,tree,form @@ -93,7 +93,7 @@ diff --git a/addons/crm/board_crm_view.xml b/addons/crm/board_crm_view.xml index ed6044a6fd6..ccaf0f7e35c 100644 --- a/addons/crm/board_crm_view.xml +++ b/addons/crm/board_crm_view.xml @@ -51,7 +51,7 @@ form graph,tree,form - ['&', ('user_id','=',uid), '!' , '&', ('state', '=', 'done'), ('date_closed','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))] + ['&', '&', ('user_id','=',uid), ('type', '=', 'opportunity'), '!' , '&', ('state', '=', 'done'), ('date_closed','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))] @@ -84,11 +84,11 @@ diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 575c2a8a3e3..9dd021183f4 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -639,4 +639,86 @@ class res_partner(osv.osv): } res_partner() + +class crm_case_section_custom(osv.osv): + _name = "crm.case.section.custom" + _description = 'Custom CRM Case Section' + + _columns = { + 'name': fields.char('Case Section',size=64, required=True, translate=True), + 'code': fields.char('Section Code',size=8), + 'active': fields.boolean('Active'), + 'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"), + 'sequence': fields.integer('Sequence'), + 'user_id': fields.many2one('res.users', 'Responsible User'), + 'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by Open ERP about cases in this section"), + 'parent_id': fields.many2one('crm.case.section', 'Parent Section'), + 'note': fields.text('Notes'), + } + + _defaults = { + 'active': 1, + 'allow_unlink': 1, + } + + _sql_constraints = [ + ('code_uniq', 'unique (code)', 'The code of the section must be unique !') + ] + + def _check_recursion(self, cr, uid, ids): + level = 100 + while len(ids): + cr.execute('SELECT DISTINCT parent_id FROM crm_case_section '\ + 'WHERE id IN %s', + (tuple(ids),)) + ids = filter(None, map(lambda x:x[0], cr.fetchall())) + if not level: + return False + level -= 1 + return True + _constraints = [ + (_check_recursion, 'Error ! You cannot create recursive sections.', ['parent_id']) + ] + +crm_case_section_custom() + + +class crm_case_custom(osv.osv, crm_case): + _name = 'crm.case.custom' + _inherit = 'mailgate.thread' + _description = "Custom CRM Case" + + _columns = { + 'id': fields.integer('ID', readonly=True), + 'name': fields.char('Name',size=64,required=True), + 'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'), + 'active': fields.boolean('Active'), + 'description': fields.text('Description'), + 'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True, select=True), + 'probability': fields.float('Probability (%)'), + 'email_from': fields.char('Partner Email', size=128), + 'email_cc': fields.char('CC', size=252), + 'partner_id': fields.many2one('res.partner', 'Partner'), + 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', domain="[('partner_id','=',partner_id)]"), + 'date': fields.datetime('Date'), + 'create_date': fields.datetime('Created' ,readonly=True), + 'date_deadline': fields.datetime('Deadline'), + 'date_closed': fields.datetime('Closed', readonly=True), + 'user_id': fields.many2one('res.users', 'Responsible'), + 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), + 'ref' : fields.reference('Reference', selection=_links_get, size=128), + 'date_action_last': fields.datetime('Last Action', readonly=1), + 'date_action_next': fields.datetime('Next Action', readonly=1), + } + + _defaults = { + 'active': 1, + 'state': 'draft', + 'priority': AVAILABLE_PRIORITIES[2][0], + 'date': time.strftime('%Y-%m-%d %H:%M:%S'), + } + +crm_case_custom() + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 74786ad91f6..e42a3db0584 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -428,5 +428,262 @@ + + + + + crm.case.section.custom.form + crm.case.section.custom + form + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + crm.case.section.custom.tree + crm.case.section.custom + tree + + + + + + + + + + + + + Custom Cases - Tree + crm.case.custom + tree + + + + + + + + + + + + + + + + + Custom Cases - Form + crm.case.custom + form + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +