From a147ce42843f4d830e4d64077362ec816c3fdb56 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 18 Mar 2020 21:53:02 +1100 Subject: [PATCH] Save the current user when creating a new part --- InvenTree/part/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 5bdb101398..c7a1b959fa 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -366,7 +366,10 @@ class PartDuplicate(AjaxCreateView): if valid: # Create the new Part - part = form.save() + part = form.save(commit=False) + + part.creation_user = request.user + part.save() data['pk'] = part.pk data['text'] = str(part) @@ -488,7 +491,12 @@ class PartCreate(AjaxCreateView): if valid: # Create the new Part - part = form.save() + part = form.save(commit=False) + + # Record the user who created this part + part.creation_user = request.user + + part.save() data['pk'] = part.pk data['text'] = str(part)