itpp-labs / misc-addons

Odoo Addons
https://itpp.dev
318 stars 584 forks source link

Add Lead/Opportunity Name to PhoneCall Event #29

Closed miscs closed 9 years ago

miscs commented 9 years ago

It would be great to include the Lead/Opportunity Name in Phonecall events:

Phonecall (Lead/Opp Name): Example

when Phonecall is not associated to a Lead/Opportunity stay with the current Name:

Phonecall: Example

What do you think?

Thanks! Steve

yelizariev commented 9 years ago

You could overwrite function.

def _get_reminder_event_name(self):
    return '%s: %s' % (self._description, self.display_name)

I will think about adding it to my modules

miscs commented 9 years ago

Thank you for your feedback! I´ll try overwriting the function. For us it´s very useful because we use Standard-Names for Phonecalls e.g. "Qualification Call" and without this enhancement you´ll end up having many "Qualification Calls" in your calendar but missing the information for which lead.

miscs commented 9 years ago

Hi again,

I tried to overwrite the function with in a new class

    @api.one
    def _get_reminder_event_name(self):
        if (self.opportunity_id.name != False):
                return '%s %s: %s' % (self._description, self.opportunity_id.name, self.display_name)
        return '%s: %s' % (self._description, self.display_name)

But now I end up with calendar events with name "P" I think it might be beacause of line 59 in reminder_base_models.py

 @api.one
    def _do_update_reminder(self, update_date=True):
        vals = {'name': self._get_reminder_event_name()[0]}

I would be very happy if you could give me a small hint to push me in the right direction....

Thanks! Steve

yelizariev commented 9 years ago

Try this:

@api.one
def _get_reminder_event_name(self):
    if (self.opportunity_id):
            return '%s %s: %s' % (self._description, self.opportunity_id.name, self.display_name)
    return '%s: %s' % (self._description, self.display_name)
miscs commented 9 years ago

Thank you very much! Got it working now :)