Commit b9304d65 authored by Patrick's avatar Patrick

Code cleanup

parent 4e83d831
...@@ -83,8 +83,6 @@ class RepanierSettings(AppConfig): ...@@ -83,8 +83,6 @@ class RepanierSettings(AppConfig):
group_name=group_name, group_name=group_name,
name=PERMANENCE_NAME_PERMANENCE, name=PERMANENCE_NAME_PERMANENCE,
bank_account="BE99 9999 9999 9999", bank_account="BE99 9999 9999 9999",
vat_id=EMPTY_STRING,
sms_gateway_mail=EMPTY_STRING,
currency=CURRENCY_EUR currency=CURRENCY_EUR
) )
config.save() config.save()
......
...@@ -434,7 +434,6 @@ def close_order(permanence, all_producers, producers_id=None): ...@@ -434,7 +434,6 @@ def close_order(permanence, all_producers, producers_id=None):
if customer_invoice_id_save != purchase.customer_invoice_id: if customer_invoice_id_save != purchase.customer_invoice_id:
customer_invoice_id_save = purchase.customer_invoice_id customer_invoice_id_save = purchase.customer_invoice_id
# This order has been cancelled # This order has been cancelled
# filename = force_filename("%s - %s.xlsx" % (_("Canceled order"), permanence))
filename = "{0}-{1}.xlsx".format( filename = "{0}-{1}.xlsx".format(
slugify(_("Canceled order")), slugify(_("Canceled order")),
slugify(permanence) slugify(permanence)
......
...@@ -1057,7 +1057,9 @@ def update_or_create_purchase(customer=None, offer_item_id=None, q_order=None, v ...@@ -1057,7 +1057,9 @@ def update_or_create_purchase(customer=None, offer_item_id=None, q_order=None, v
).order_by('?').first() ).order_by('?').first()
permanence = models.Permanence.objects.filter( permanence = models.Permanence.objects.filter(
id=permanence_id id=permanence_id
).only("id", "with_delivery_point", "status").order_by('?').first() ).only(
"id", "with_delivery_point", "status"
).order_by('?').first()
if customer_invoice is not None and permanence is not None: if customer_invoice is not None and permanence is not None:
order_amount = customer_invoice.get_total_price_with_tax() order_amount = customer_invoice.get_total_price_with_tax()
status_changed = customer_invoice.cancel_confirm_order() status_changed = customer_invoice.cancel_confirm_order()
......
...@@ -37,8 +37,9 @@ class OrderView(ListView): ...@@ -37,8 +37,9 @@ class OrderView(ListView):
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
permanence_id = sint(kwargs.get('permanence_id', 0)) permanence_id = sint(kwargs.get('permanence_id', 0))
self.permanence = Permanence.objects.filter(id=permanence_id).only("id", "status", "permanence_date", self.permanence = Permanence.objects.filter(id=permanence_id).only(
"with_delivery_point").order_by('?').first() "id", "status", "permanence_date", "with_delivery_point"
).order_by('?').first()
permanence_ok_or_404(self.permanence) permanence_ok_or_404(self.permanence)
self.user = request.user self.user = request.user
self.basket = kwargs.get('basket', False) self.basket = kwargs.get('basket', False)
......
...@@ -29,8 +29,9 @@ def order_init_ajax(request): ...@@ -29,8 +29,9 @@ def order_init_ajax(request):
if request.is_ajax(): if request.is_ajax():
# construct a list which will contain all of the data for the response # construct a list which will contain all of the data for the response
permanence_id = sint(request.GET.get('pe', 0)) permanence_id = sint(request.GET.get('pe', 0))
permanence_qs = Permanence.objects.filter(id=permanence_id) \ permanence_qs = Permanence.objects.filter(id=permanence_id).only(
.only("id", "status", "with_delivery_point").order_by('?') "id", "status", "with_delivery_point"
).order_by('?')
if not permanence_qs.exists(): if not permanence_qs.exists():
raise Http404 raise Http404
user = request.user user = request.user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment