def set_status(self, new_status): if new_status == self.status: return if new_status not in self.available_statuses(): raise InvalidOrderStatus("'%s' is not a valid status for order %s (currency status: '%s')" % (new_status, self.number, self.status)) self.status = new_status if new_status in self.cascade: for line in self.lines.all(): line.status = self.cascade[self.status] line.save() self.save()
def set_status(self, new_status): if new_status == self.status: return if new_status not in self.available_statuses(): raise InvalidOrderStatus( _("'%(new_status)s' is not a valid status for order %(number)s " "(current status: '%(status)s')") % { 'new_status': new_status, 'number': self.number, 'status': self.status }) self.status = new_status if new_status in self.cascade: for line in self.lines.all(): line.status = self.cascade[self.status] line.save() self.save()