From b03b10a5598acecfa9242cf6fc7e798708a9bdb0 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 12 May 2010 18:46:01 +0530 Subject: [PATCH] [IMP]: Minor Code improvements (For tooptips) in crm modules bzr revid: rpa@tinyerp.com-20100512131601-b1vkwfe2f6ker8eq --- addons/base_calendar/base_calendar.py | 8 +-- .../wizard/base_calendar_invite_attendee.py | 2 +- addons/crm/crm_segmentation.py | 41 +++++---------- addons/crm/wizard/crm_forward_to_partner.py | 52 +++++++++++++++---- addons/crm_claim/crm_claim.py | 26 +++++----- addons/crm_fundraising/crm_fundraising.py | 11 ++-- addons/crm_helpdesk/crm_helpdesk.py | 4 +- 7 files changed, 79 insertions(+), 65 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index b2e57662cea..e97ee3bd547 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -580,7 +580,7 @@ class res_alarm(osv.osv): are both optional, but if one occurs, so MUST the other"""), 'repeat': fields.integer('Repeat'), 'active': fields.boolean('Active', help="If the active field is set to \ - true, it will allow you to hide the event alarm information without removing it.") +true, it will allow you to hide the event alarm information without removing it.") } _defaults = { 'trigger_interval': lambda *x: 'minutes', @@ -992,9 +992,9 @@ class calendar_event(osv.osv): 'Show as'), 'base_calendar_url': fields.char('Caldav URL', size=264), 'exdate': fields.text('Exception Date/Times', help="This property \ - defines the list of date/time exceptions for arecurring calendar component."), +defines the list of date/time exceptions for arecurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="defines a \ - rule or repeating pattern for anexception to a recurrence set"), +rule or repeating pattern for an exception to a recurrence set"), 'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \ string='Recurrent Rule', store=True, \ fnct_inv=_set_rrulestring, help='Defines a\ @@ -1044,7 +1044,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'event_id', 'attendee_id', 'Attendees'), 'allday': fields.boolean('All Day'), 'active': fields.boolean('Active', help="If the active field is set to \ - true, it will allow you to hide the event alarm information without removing it.") +true, it will allow you to hide the event alarm information without removing it.") } _defaults = { diff --git a/addons/base_calendar/wizard/base_calendar_invite_attendee.py b/addons/base_calendar/wizard/base_calendar_invite_attendee.py index 0e91447eebf..83cf7c8cbe0 100644 --- a/addons/base_calendar/wizard/base_calendar_invite_attendee.py +++ b/addons/base_calendar/wizard/base_calendar_invite_attendee.py @@ -44,7 +44,7 @@ class base_calendar_invite_attendee(osv.osv_memory): 'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel', 'invite_id', 'contact_id', 'Contacts'), 'send_mail': fields.boolean('Send mail?', help='Check this if you want to \ - send an Email to Invited Person') +send an Email to Invited Person') } _defaults = { diff --git a/addons/crm/crm_segmentation.py b/addons/crm/crm_segmentation.py index f435f41b10d..41ec59bff2f 100644 --- a/addons/crm/crm_segmentation.py +++ b/addons/crm/crm_segmentation.py @@ -37,39 +37,26 @@ class crm_segmentation(osv.osv): 'description': fields.text('Description'), 'categ_id': fields.many2one('res.partner.category', 'Partner Category',\ required=True, help='The partner category that will be \ - added to partners that match the segmentation criterions after computation.'), - 'exclusif': fields.boolean('Exclusive', help='Check if the category is \ - limited to partners that match the segmentation criterions.\ - If checked, remove the category from partners that doesn\'t \ - match segmentation criterions'), +added to partners that match the segmentation criterions after computation.'), + 'exclusif': fields.boolean('Exclusive', help='Check if the category is limited to partners that match the segmentation criterions.\ + \nIf checked, remove the category from partners that doesn\'t match segmentation criterions'), 'state': fields.selection([('not running','Not Running'),\ ('running','Running')], 'Execution Status', readonly=True), 'partner_id': fields.integer('Max Partner ID processed'), 'segmentation_line': fields.one2many('crm.segmentation.line', \ 'segmentation_id', 'Criteria', required=True), - 'som_interval': fields.integer('Days per Periode', help="A period is the \ - average number of days between two cycle of sale or\ - purchase for this segmentation. It's mainly used to\ - detect if a partner has not purchased or buy for a too \ - long time, so we suppose that his state of mind has \ - decreased because he probably bought goods to another \ - supplier. Use this functionality for recurring businesses."), - 'som_interval_max': fields.integer('Max Interval', help="The computation \ - is made on all events that occured during this \ - interval, the past X periods."), - 'som_interval_decrease': fields.float('Decrease (0>1)', help="If the \ - partner has not purchased (or bought) \ - during a period, decrease the state of \ - mind by this factor. It\'s a multiplication"), + 'som_interval': fields.integer('Days per Periode', help="A period is the average number of days between two cycle of sale or purchase for this segmentation.\ + \nIt's mainly used to detect if a partner has not purchased or buy for a too long time, \ + \nso we suppose that his state of mind has decreased because he probably bought goods to another supplier. \ + \nUse this functionality for recurring businesses."), + 'som_interval_max': fields.integer('Max Interval', help="The computation is made on all events that occured during this interval, the past X periods."), + 'som_interval_decrease': fields.float('Decrease (0>1)', help="If the "\ + "partner has not purchased (or bought) during a "\ + "period, decrease the state of mind by this factor. It\'s a multiplication"), 'som_interval_default': fields.float('Default (0=None)', help="Default \ - state of mind for period preceeding the \ - 'Max Interval' computation. This is the \ - starting state of mind by default if the \ - partner has no event."), - 'sales_purchase_active': fields.boolean('Use The Sales Purchase Rules',\ - help='Check if you want to use this tab as\ - part of the segmentation rule. If not \ - checked, the criteria beneath will be ignored') +state of mind for period preceeding the 'Max Interval' computation. \ +This is the starting state of mind by default if the partner has no event."), + 'sales_purchase_active': fields.boolean('Use The Sales Purchase Rules', help='Check if you want to use this tab as part of the segmentation rule. If not checked, the criteria beneath will be ignored') } _defaults = { 'partner_id': lambda *a: 0, diff --git a/addons/crm/wizard/crm_forward_to_partner.py b/addons/crm/wizard/crm_forward_to_partner.py index a9af0f2816b..98d5392faa3 100644 --- a/addons/crm/wizard/crm_forward_to_partner.py +++ b/addons/crm/wizard/crm_forward_to_partner.py @@ -26,6 +26,7 @@ from tools.translate import _ import tools class crm_lead_forward_to_partner(osv.osv_memory): + """Forwards lead history""" _name = 'crm.lead.forward.to.partner' _columns = { @@ -43,6 +44,13 @@ class crm_lead_forward_to_partner(osv.osv_memory): } def get_whole_history(self, cr, uid, ids, context=None): + """This function gets whole communication history and returns as top posting style + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of history IDs + @param context: A standard dictionary for contextual values + """ whole = [] for hist_id in ids: whole.append(self.get_latest_history(cr, uid, hist_id, context=context)) @@ -50,6 +58,13 @@ class crm_lead_forward_to_partner(osv.osv_memory): return whole or '' def get_latest_history(self, cr, uid, hist_id, context=None): + """This function gets latest communication and returns as top posting style + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param hist_id: Id of latest history + @param context: A standard dictionary for contextual values + """ log_pool = self.pool.get('mailgate.message') hist = log_pool.browse(cr, uid, hist_id, context=context) header = '-------- Original Message --------' @@ -61,27 +76,34 @@ class crm_lead_forward_to_partner(osv.osv_memory): original = '\n'.join(original) return original - def on_change_email(self, cr, uid, ids, user, partner): - """ + def on_change_email(self, cr, uid, ids, user): + """This function fills email information based on user selected @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Mail’s IDs + @param user: Changed User id + @param partner: Changed Partner id """ - if (not partner and not user): + if not user: return {'value': {'email_to': False}} email = False - if partner: - addr = self.pool.get('res.partner').address_get(cr, uid, [partner], ['contact']) - if addr and addr['contact']: - email = self.pool.get('res.partner.address').read(cr, uid, addr['contact'] , ['email'])['email'] - elif user: - addr = self.pool.get('res.users').read(cr, uid, user, ['address_id'])['address_id'] - if addr: - email = self.pool.get('res.partner.address').read(cr, uid, addr[0] , ['email'])['email'] + addr = self.pool.get('res.users').read(cr, uid, user, ['address_id'])['address_id'] + if addr: + email = self.pool.get('res.partner.address').read(cr, uid, addr[0] , ['email'])['email'] return {'value': {'email_to': email}} def on_change_history(self, cr, uid, ids, history, context=None): + """Gives message body according to type of history selected + * info: Forward the case information + * whole: Send the whole history + * latest: Send the latest histoy + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of history IDs + @param context: A standard dictionary for contextual values + """ #TODO: ids and context are not comming res = False msg_val = '' @@ -111,6 +133,14 @@ class crm_lead_forward_to_partner(osv.osv_memory): return res def on_change_partner(self, cr, uid, ids, partner_id): + """This function fills address information based on partner/user selected + @param self: The object pointer + @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, + @param ids: List of Mail’s IDs + @param user: Changed User id + @param partner: Changed Partner id + """ if not partner_id: return {'value' : {'email_to' : False, 'address_id': False}} diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index 63e785978a9..a535efbdb81 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -42,17 +42,18 @@ class crm_claim(osv.osv, crm.crm_case): 'ref' : fields.reference('Reference', selection=crm._links_get, size=128), 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel', \ - help="The channels represent the different communication\ - modes available with the customer." \ - " With each commercial opportunity, you can indicate the\ - canall which is this opportunity source."), + help="The channels represent the different communication"\ + "modes available with the customer." \ + " With each commercial opportunity, you can indicate the"\ + "canall which is this opportunity source."), 'planned_revenue': fields.float('Planned Revenue'), 'planned_cost': fields.float('Planned Costs'), 'som': fields.many2one('res.partner.som', 'State of Mind', \ - help="The minds states allow to define a value scale which represents" \ - "the partner mentality in relation to our services.The scale has" \ - "to be created with a factor for each level from 0 (Very dissatisfied) \ - to 10 (Extremely satisfied)."), + help="The minds states allow to define a value scale "\ + "which represents the partner mentality in "\ + "relation to our services.The scale has to be "\ + "created with a factor for each level from 0 "\ + "(Very dissatisfied) to 10 (Extremely satisfied)"), 'categ_id': fields.many2one('crm.case.categ', 'Category', \ domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.claim')]"), @@ -62,15 +63,14 @@ class crm_claim(osv.osv, crm.crm_case): ('object_id.model', '=', 'crm.claim')]"), 'user_id': fields.many2one('res.users', 'Responsible'), 'section_id': fields.many2one('crm.case.section', 'Sales Team', \ - select=True, help='Sales team to which Case belongs to.\ - Define Responsible user and Email account for mail gateway.'), + select=True, help="Sales team to which Case belongs to."\ + "Define Responsible user and Email account for"\ + " mail gateway."), 'company_id': fields.many2one('res.company', 'Company'), 'partner_id': fields.many2one('res.partner', 'Partner'), 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \ domain="[('partner_id','=',partner_id)]"), - 'email_cc': fields.text('Watchers Emails', size=252 , help="These people\ - will receive a copy of the future" \ -" communication between partner and users by email"), + 'email_cc': fields.text('Watchers Emails', size=252, help="These people will receive a copy of the future communication between partner and users by email"), 'email_from': fields.char('Email', size=128, help="These people will receive email."), 'partner_name': fields.char("Employee's Name", size=64), 'partner_mobile': fields.char('Mobile', size=32), diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py index 98bd7446068..4650528fa72 100644 --- a/addons/crm_fundraising/crm_fundraising.py +++ b/addons/crm_fundraising/crm_fundraising.py @@ -39,15 +39,12 @@ class crm_fundraising(osv.osv, crm.crm_case): 'date_deadline': fields.date('Deadline'), 'user_id': fields.many2one('res.users', 'Responsible'), 'section_id': fields.many2one('crm.case.section', 'Sales Team', \ - select=True, help='Sales team to which Case belongs to.\ - Define Responsible user and Email account for mail gateway.'), + select=True, help='Sales team to which Case belongs to. Define Responsible user and Email account for mail gateway.'), 'company_id': fields.many2one('res.company', 'Company'), 'partner_id': fields.many2one('res.partner', 'Partner'), 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \ domain="[('partner_id','=',partner_id)]"), - 'email_cc': fields.text('Watchers Emails', size=252 , help="These people\ - will receive a copy of the future" \ -" communication between partner and users by email"), + 'email_cc': fields.text('Watchers Emails', size=252 , help="These people will receive a copy of the future communication between partner and users by email"), 'email_from': fields.char('Email', size=128, help="These people will receive email."), 'date_closed': fields.datetime('Closed', readonly=True), 'date': fields.datetime('Date'), @@ -72,8 +69,8 @@ class crm_fundraising(osv.osv, crm.crm_case): 'ref': fields.reference('Reference', selection=crm._links_get, size=128), 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), 'canal_id': fields.many2one('res.partner.canal', 'Channel', \ - help="The channels represent the different communication \ - modes available with the customer." \ + help="The channels represent the different communication "\ + "modes available with the customer." \ " With each commercial opportunity, you can indicate\ the canall which is this opportunity source."), 'som': fields.many2one('res.partner.som', 'State of Mind', \ diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index ad2c6cbe858..4329ef7d73b 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -63,8 +63,8 @@ class crm_helpdesk(osv.osv, crm.crm_case): 'som': fields.many2one('res.partner.som', 'State of Mind', \ help="The minds states allow to define a value scale which represents" \ "the partner mentality in relation to our services.The scale has" \ - "to be created with a factor for each level from 0 \ - (Very dissatisfied) to 10 (Extremely satisfied)."), + "to be created with a factor for each level from 0" \ + "(Very dissatisfied) to 10 (Extremely satisfied)."), 'categ_id': fields.many2one('crm.case.categ', 'Category', \ domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.helpdesk')]"),