'Automatically set order reference'

def save(self, *args, **kwargs):

    super(SaleOrder, self).save(*args, **kwargs)
    try:
        conf = ModuleSetting.get_for_module('treeio.sales', 'order_fulfil_status')[0]
        fulfil_status = long(conf.value)
        if (self.status.id == fulfil_status):
            self.fulfil()
    except Exception:
        pass
