Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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