diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-09-03 11:17:54 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-09-03 11:17:54 +0300 |
commit | bb0ffafe4f040f4e69ecff6624ca73cb3db61bd0 (patch) | |
tree | 62ba732893e59d27fc5734336ffe6b5086dd9dc1 /servo | |
parent | b3e3941e811b23cc681945da1b1e26c818f9ace4 (diff) | |
download | Servo-bb0ffafe4f040f4e69ecff6624ca73cb3db61bd0.tar.gz Servo-bb0ffafe4f040f4e69ecff6624ca73cb3db61bd0.tar.bz2 Servo-bb0ffafe4f040f4e69ecff6624ca73cb3db61bd0.zip |
Fix issue with purchase orders
Diffstat (limited to 'servo')
-rw-r--r-- | servo/templates/admin/locations/form.html | 1 | ||||
-rwxr-xr-x | servo/templates/products/list_rows.html | 6 | ||||
-rw-r--r-- | servo/views/purchases.py | 13 |
3 files changed, 10 insertions, 10 deletions
diff --git a/servo/templates/admin/locations/form.html b/servo/templates/admin/locations/form.html index 777c9ab..0fad2bc 100644 --- a/servo/templates/admin/locations/form.html +++ b/servo/templates/admin/locations/form.html @@ -19,7 +19,6 @@ {% include "form_field_snippet.html" with field=form.city %} {% include "form_field_snippet.html" with field=form.timezone %} {% include "form_field_snippet.html" with field=form.notes %} - {% include "form_field_snippet.html" with field=form.logo %} {% include "form_field_snippet.html" with field=form.enabled %} </div> <div class="tab-pane" id="tab3"> diff --git a/servo/templates/products/list_rows.html b/servo/templates/products/list_rows.html index a753687..c8cf5bb 100755 --- a/servo/templates/products/list_rows.html +++ b/servo/templates/products/list_rows.html @@ -34,9 +34,9 @@ {% endwith %} <li><a href="{% url 'orders-create_with_product' product_id %}">{% trans "Create Sales Order" %}</a></li> <li><a href="{% url 'purchases-create_po' product_id=product_id %}">{% trans "Create Purchase Order" %}</a></li> - {% with request.session.current_po as po %} - {% if po %} - <li><a href="{% url 'purchases-add_to_po' pk=po.id product_id=product_id %}">{% trans "Use in Purchase Order" %}</a></li> + {% with request.session.current_po as po_pk %} + {% if po_pk %} + <li><a href="{% url 'purchases-add_to_po' pk=po_pk product_id=product_id %}">{% trans "Use in Purchase Order" %}</a></li> {% endif %} {% endwith %} <li class="divider"></li> diff --git a/servo/views/purchases.py b/servo/views/purchases.py index 66e7075..b25535b 100644 --- a/servo/views/purchases.py +++ b/servo/views/purchases.py @@ -31,13 +31,13 @@ from django.forms.models import inlineformset_factory from django.utils.translation import ugettext as _ -from django.shortcuts import render, redirect -from servo.models.order import ServiceOrderItem +from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.decorators import permission_required from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.contrib import messages +from servo.models.order import ServiceOrderItem from servo.models import Product, GsxAccount, PurchaseOrder, PurchaseOrderItem from servo.forms import PurchaseOrderItemEditForm, PurchaseOrderSearchForm @@ -125,7 +125,7 @@ def view_po(request, pk): def edit_po(request, pk, item_id=None): if pk is not None: - po = PurchaseOrder.objects.get(pk=pk) + po = get_object_or_404(PurchaseOrder, pk=pk) else: po = PurchaseOrder(created_by=request.user) @@ -163,7 +163,8 @@ def edit_po(request, pk, item_id=None): messages.success(request, msg) return redirect(list_pos) - request.session['current_po'] = po + request.session['current_po'] = po.pk + data = {'order': po, 'form': form} data['formset'] = formset data['title'] = _('Purchase Order #%d' % po.pk) @@ -177,7 +178,7 @@ def order_stock(request, po_id): Submits the PO as a GSX Stocking Order Using the default GSX account. """ - po = PurchaseOrder.objects.get(pk=po_id) + po = get_object_or_404(PurchaseOrder, pk=po_id) if request.method == "POST": if po.submitted_at: @@ -216,7 +217,7 @@ def delete_po(request, po_id): try: po.delete() messages.success(request, _("Purchase Order %s deleted" % po_id)) - except Exception, e: + except Exception as e: messages.error(request, e) return redirect(list_pos) |