Ejemplo n.º 1
0
    def save(self, **kwargs):
        from fetchmyguest.utils.notifications import notify

        if not self.agency:
            self.agency = get_agency()
        obj = super(Note, self).save(**kwargs)
        #from fetchmyguest.utils.notifications import notify
        notify(self.lead, 'Note for lead: {0}'.format(self.lead.customer), alert=True)
        return obj
Ejemplo n.º 2
0
    def save(self, **kwargs):

        if not self.agency:
            self.agency = get_agency()

        if self.booked:  # When a Lead is booked cannot be hot anymore
            self.hot = False
            if not self.booked_date:
                self.booked_date = timezone.now()
        obj = super(Lead, self).save(**kwargs)
        return obj
Ejemplo n.º 3
0
    def save(self, **kwargs):

        if not self.agency:
            self.agency = get_agency()
        if not self.property_ids:
            self.property_ids = {}
        else:
            lower_dict = {}
            for k, v in self.property_ids.iteritems():
                lower_dict[k.lower().strip()] = v.lower().strip()
            self.property_ids = lower_dict
        obj = super(Property, self).save(**kwargs)
        return obj
Ejemplo n.º 4
0
    def save(self, **kwargs):
        """
        When it is saved a new Customer we update the cache
        :param kwargs:
        :return:
        """
        from fetchmyguest.utils.parse_email import update_customers_cache

        if not self.agency:
            self.agency = get_agency()
        if not self.first_name:
            if self.email:
                self.first_name = self.email
            else:
                raise ValidationError('Missing Field, either first_name or email')

        if (self.email and not Customer.objects.filter(agency=self.agency, email__iexact=self.email).exists()) \
            or not self.email \
            or self.id:
            self.email = self.email.lower()
            super(Customer, self).save(**kwargs)
            update_customers_cache()
        else:
            raise ValidationError('Cannot save a email address twice')
Ejemplo n.º 5
0
    def save(self, **kwargs):
        if not self.agency:
            self.agency = get_agency()
        obj = super(LeadProperty, self).save(**kwargs)

        return obj