def trigger_order_created(sender, instance, created, **kwargs): if created: instance.url_code = encode_url(instance.id).upper() instance.code = settings.INSTALL_ID + str(instance.id).rjust(6, "0") description = _("Order %s created") % instance.code instance.notify("created", description, instance.created_by) instance.save()
def save(self, *args, **kwargs): location = self.created_by.location if self.location_id is None: self.location = location if self.checkin_location is None: self.checkin_location = location if self.checkout_location is None: self.checkout_location = location if self.customer and self.customer_name == '': self.customer_name = self.customer.fullname super(Order, self).save(*args, **kwargs) if self.code is None: self.url_code = encode_url(self.id).upper() self.code = settings.INSTALL_ID + str(self.id).rjust(6, '0') event = _('Order %s created') % self.code self.notify('created', event, self.created_by) self.save()
def trigger_event(sender, instance, created, **kwargs): if created: instance.code = encode_url(instance.id).upper() description = _('Tilaus %s luotu' % instance.code) #instance.notify('created', description, instance.created_by) instance.save()