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
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
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
def save(self, commit=True): instance = super(BankAccount, self).save(commit) billing_data_changed.send(self, user_id=instance.user_id) return instance
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
def save(self, commit=True): instance = super(BankAccount, self).save(commit) billing_data_changed.send(self, user_id=instance.user_id) return instance