예제 #1
0
    def set_address(self, addr_type, value):
        """
        :param addr_type: Either `billing` or `delivery` to describe type the
                          address will be used for
        :param value:     Instance of the Address model
        """
        if value.id not in self.__addresses_ids:
            self.addresses.append(value)

        setattr(self, "{}_address_id".format(addr_type), value.id)
        db.session.commit()
        if addr_type == 'billing':
            billing_data_changed.send(self, user_id=self.user_id)
        return self
예제 #2
0
    def set_address(self, addr_type, value):
        """
        :param addr_type: Either `billing` or `delivery` to describe type the
                          address will be used for
        :param value:     Instance of the Address model
        """
        if value.id not in self.__addresses_ids:
            self.addresses.append(value)

        setattr(self, "{}_address_id".format(addr_type), value.id)
        db.session.commit()
        if addr_type == 'billing':
            billing_data_changed.send(self, user_id=self.user_id)
        return self
예제 #3
0
 def save(self, commit=True):
     instance = super(Address, self).save(commit)
     if (instance.customer_id is not None and
                 instance.id == instance.customer.billing_address_id):
         billing_data_changed.send(self, user_id=instance.customer.user_id)
     return instance
예제 #4
0
 def save(self, commit=True):
     instance = super(BankAccount, self).save(commit)
     billing_data_changed.send(self, user_id=instance.user_id)
     return instance
예제 #5
0
 def save(self, commit=True):
     instance = super(Address, self).save(commit)
     if (instance.customer_id is not None and
                 instance.id == instance.customer.billing_address_id):
         billing_data_changed.send(self, user_id=instance.customer.user_id)
     return instance
예제 #6
0
 def save(self, commit=True):
     instance = super(BankAccount, self).save(commit)
     billing_data_changed.send(self, user_id=instance.user_id)
     return instance