finish purchase from list
This commit is contained in:
parent
540f5ee42c
commit
7f6584ecf7
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
class="text-black dark:text-white w-4 h-4">
|
||||||
|
<path fill="currentColor" d="M 43.470703 8.9863281 A 1.50015 1.50015 0 0 0 42.439453 9.4394531 L 16.5 35.378906 L 5.5605469 24.439453 A 1.50015 1.50015 0 1 0 3.4394531 26.560547 L 15.439453 38.560547 A 1.50015 1.50015 0 0 0 17.560547 38.560547 L 44.560547 11.560547 A 1.50015 1.50015 0 0 0 43.470703 8.9863281 z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 477 B |
|
@ -54,6 +54,11 @@ urlpatterns = [
|
||||||
purchase.delete_purchase,
|
purchase.delete_purchase,
|
||||||
name="delete_purchase",
|
name="delete_purchase",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"purchase/<int:purchase_id>/finish",
|
||||||
|
purchase.finish_purchase,
|
||||||
|
name="finish_purchase",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"purchase/list",
|
"purchase/list",
|
||||||
purchase.list_purchases,
|
purchase.list_purchases,
|
||||||
|
|
|
@ -103,6 +103,15 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||||
"cotton/button_group.html",
|
"cotton/button_group.html",
|
||||||
{
|
{
|
||||||
"buttons": [
|
"buttons": [
|
||||||
|
{
|
||||||
|
"href": reverse(
|
||||||
|
"finish_purchase", args=[purchase.pk]
|
||||||
|
),
|
||||||
|
"slot": Icon("checkmark"),
|
||||||
|
"title": "Mark as finished",
|
||||||
|
}
|
||||||
|
if not purchase.date_finished
|
||||||
|
else {},
|
||||||
{
|
{
|
||||||
"href": reverse(
|
"href": reverse(
|
||||||
"drop_purchase", args=[purchase.pk]
|
"drop_purchase", args=[purchase.pk]
|
||||||
|
@ -223,6 +232,14 @@ def refund_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
return redirect("list_purchases")
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def finish_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
|
purchase = get_object_or_404(Purchase, id=purchase_id)
|
||||||
|
purchase.date_finished = timezone.now()
|
||||||
|
purchase.save()
|
||||||
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
def related_purchase_by_edition(request: HttpRequest) -> HttpResponse:
|
def related_purchase_by_edition(request: HttpRequest) -> HttpResponse:
|
||||||
edition_id = request.GET.get("edition")
|
edition_id = request.GET.get("edition")
|
||||||
if not edition_id:
|
if not edition_id:
|
||||||
|
|
Loading…
Reference in New Issue