From 3b06f1f5be5475892d52d4ca97e7ba61152eecd2 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Thu, 10 Jun 2010 18:34:07 +0530 Subject: [PATCH] [MOD/IMP] crm : In lead,opportunity views type field added. sales : advance invoice wizard, when user create advance invoice form view open bzr revid: vir@tinyerp.com-20100610130407-42ibe5pxl2n8k42u --- addons/crm/crm.py | 90 +++++++++---------- addons/crm/crm_lead_view.xml | 3 +- addons/crm/crm_opportunity_menu.xml | 6 +- addons/crm/crm_opportunity_view.xml | 1 + .../sale/wizard/sale_make_invoice_advance.py | 66 ++++++++------ 5 files changed, 90 insertions(+), 76 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 7f7ab94616f..618dd55cc21 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -30,19 +30,19 @@ from tools.translate import _ MAX_LEVEL = 15 AVAILABLE_STATES = [ - ('draft', 'Draft'), - ('open', 'Open'), - ('cancel', 'Cancelled'), - ('done', 'Closed'), + ('draft', 'Draft'), + ('open', 'Open'), + ('cancel', 'Cancelled'), + ('done', 'Closed'), ('pending', 'Pending'), ] AVAILABLE_PRIORITIES = [ ('1', 'Highest'), - ('2', 'High'), - ('3', 'Normal'), - ('4', 'Low'), - ('5', 'Lowest'), + ('2', 'High'), + ('3', 'Normal'), + ('4', 'Low'), + ('5', 'Lowest'), ] class crm_case(object): @@ -107,10 +107,10 @@ class crm_case(object): """ user = self.pool.get('res.users').browse(cr, uid, uid, context=context) return user.context_section_id.id or False - + def stage_next(self, cr, uid, ids, context=None): """This function computes next stage for case from its current stage - using available stage for that case type + using available stage for that case type @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -151,7 +151,7 @@ class crm_case(object): def stage_previous(self, cr, uid, ids, context=None): """This function computes previous stage for case from its current stage - using available stage for that case type + using available stage for that case type @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -177,11 +177,11 @@ class crm_case(object): @param uid: the current user’s ID for security checks, @param ids: List of case IDs @param part: Partner's id - @email: Partner's email ID + @email: Partner's email ID """ if not part: - return {'value': {'partner_address_id': False, - 'email_from': False, + return {'value': {'partner_address_id': False, + 'email_from': False, }} addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['contact']) data = {'partner_address_id': addr['contact']} @@ -195,13 +195,13 @@ class crm_case(object): @param uid: the current user’s ID for security checks, @param ids: List of case IDs @param add: Id of Partner's address - @email: Partner's email ID + @email: Partner's email ID """ if not add: return {'value': {'email_from': False}} address = self.pool.get('res.partner.address').browse(cr, uid, add) return {'value': {'email_from': address.email}} - + def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}): mailgate_pool = self.pool.get('mailgate.thread') return mailgate_pool._history(cr, uid, cases, keyword, history=history,\ @@ -209,7 +209,7 @@ class crm_case(object): details=details, email_from=email_from,\ message_id=message_id, attach=attach, \ context=context) - + def case_open(self, cr, uid, ids, *args): """Opens Case @param self: The object pointer @@ -265,7 +265,7 @@ class crm_case(object): if case.section_id.parent_id.user_id: data['user_id'] = case.section_id.parent_id.user_id.id else: - raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.')) + raise osv.except_osv(_('Error !'), _('You can not escalate, You are already at the top level regarding your sales-team category.')) self.write(cr, uid, [case.id], data) cases = self.browse(cr, uid, ids) self._history(cr, uid, cases, _('Escalate')) @@ -317,7 +317,7 @@ class crm_case(object): self.write(cr, uid, ids, {'state': 'draft', 'active': True}) self._action(cr, uid, cases, 'draft') return True - + def remind_partner(self, cr, uid, ids, context={}, attach=False): """ @@ -350,7 +350,7 @@ class crm_case(object): src = case.email_from dest = case.section_id.reply_to body = "" - body = case.email_last or case.description + body = case.email_last or case.description if not destination: src, dest = dest, src if body and case.user_id.signature: @@ -381,7 +381,7 @@ class crm_case(object): # raise osv.except_osv(_('Email!'),("Email Successfully Sent")) #else: # raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully")) - return True + return True def _check(self, cr, uid, ids=False, context={}): """ @@ -428,12 +428,12 @@ class crm_case_section(osv.osv): _order = "name" _columns = { - 'name': fields.char('Sales Team', size=64, required=True, translate=True), - 'code': fields.char('Code', size=8), + 'name': fields.char('Sales Team', size=64, required=True, translate=True), + 'code': fields.char('Code', size=8), 'active': fields.boolean('Active', help="If the active field is set to \ - true, it will allow you to hide the sales team without removing it."), - 'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"), - 'user_id': fields.many2one('res.users', 'Responsible User'), + true, it will allow you to hide the sales team without removing it."), + 'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"), + 'user_id': fields.many2one('res.users', 'Responsible User'), 'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'), '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 sales team"), @@ -445,8 +445,8 @@ class crm_case_section(osv.osv): } _defaults = { - 'active': lambda *a: 1, - 'allow_unlink': lambda *a: 1, + 'active': lambda *a: 1, + 'allow_unlink': lambda *a: 1, } _sql_constraints = [ @@ -463,7 +463,7 @@ class crm_case_section(osv.osv): @param ids: List of Sales team ids """ level = 100 - + while len(ids): cr.execute('select distinct parent_id from crm_case_section where id =ANY(%s)', (ids,)) ids = filter(None, map(lambda x: x[0], cr.fetchall())) @@ -509,9 +509,9 @@ class crm_case_categ(osv.osv): _description = "Category of case" _columns = { - 'name': fields.char('Case Category Name', size=64, required=True, translate=True), - 'section_id': fields.many2one('crm.case.section', 'Sales Team'), - 'object_id': fields.many2one('ir.model', 'Object Name'), + 'name': fields.char('Case Category Name', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'object_id': fields.many2one('ir.model', 'Object Name'), } def _find_object_id(self, cr, uid, context=None): @@ -541,9 +541,9 @@ class crm_case_resource_type(osv.osv): _rec_name = "name" _columns = { - 'name': fields.char('Case Resource Type', size=64, required=True, translate=True), - 'section_id': fields.many2one('crm.case.section', 'Sales Team'), - 'object_id': fields.many2one('ir.model', 'Object Name'), + 'name': fields.char('Case Resource Type', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'object_id': fields.many2one('ir.model', 'Object Name'), } def _find_object_id(self, cr, uid, context=None): """Finds id for case object @@ -572,14 +572,14 @@ class crm_case_stage(osv.osv): _order = "sequence" _columns = { - 'name': fields.char('Stage Name', size=64, required=True, translate=True), - 'section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'name': fields.char('Stage Name', size=64, required=True, translate=True), + 'section_id': fields.many2one('crm.case.section', 'Sales Team'), 'sequence': fields.integer('Sequence', help="Gives the sequence order \ - when displaying a list of case stages."), - 'object_id': fields.many2one('ir.model', 'Object Name'), - 'probability': fields.float('Probability (%)', required=True), + when displaying a list of case stages."), + 'object_id': fields.many2one('ir.model', 'Object Name'), + 'probability': fields.float('Probability (%)', required=True), 'on_change': fields.boolean('Change Probability Automatically', \ - help="Change Probability on next and previous stages."), + help="Change Probability on next and previous stages."), 'requirements': fields.text('Requirements') } def _find_object_id(self, cr, uid, context=None): @@ -594,8 +594,8 @@ class crm_case_stage(osv.osv): return ids and ids[0] _defaults = { - 'sequence': lambda *args: 1, - 'probability': lambda *args: 0.0, + 'sequence': lambda *args: 1, + 'probability': lambda *args: 0.0, 'object_id' : _find_object_id } @@ -619,7 +619,7 @@ class users(osv.osv): _inherit = 'res.users' _description = "Users" _columns = { - 'context_section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'context_section_id': fields.many2one('crm.case.section', 'Sales Team'), } users() @@ -627,7 +627,7 @@ users() class res_partner(osv.osv): _inherit = 'res.partner' _columns = { - 'section_id': fields.many2one('crm.case.section', 'Sales Team'), + 'section_id': fields.many2one('crm.case.section', 'Sales Team'), } res_partner() diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 465c63ae626..a3d7639076f 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -48,7 +48,7 @@