Update calls to post_save

This commit is contained in:
Oliver Walters 2020-10-30 10:12:42 +11:00
parent 2d583d19c2
commit 5c5641d884
2 changed files with 16 additions and 16 deletions

View File

@ -100,9 +100,9 @@ class PurchaseOrderAttachmentCreate(AjaxCreateView):
ajax_template_name = "modal_form.html"
role_required = 'purchase_order.add'
def post_save(self, **kwargs):
self.object.user = self.request.user
self.object.save()
def post_save(self, attachment, form, **kwargs):
attachment.user = self.request.user
attachment.save()
def get_data(self):
return {
@ -148,7 +148,7 @@ class SalesOrderAttachmentCreate(AjaxCreateView):
ajax_form_title = _('Add Sales Order Attachment')
role_required = 'sales_order.add'
def post_save(self, **kwargs):
def post_save(self, attachment, form, **kwargs):
self.object.user = self.request.user
self.object.save()
@ -319,11 +319,11 @@ class PurchaseOrderCreate(AjaxCreateView):
return initials
def post_save(self, **kwargs):
def post_save(self, order, form, **kwargs):
# Record the user who created this purchase order
self.object.created_by = self.request.user
self.object.save()
order.created_by = self.request.user
order.save()
class SalesOrderCreate(AjaxCreateView):
@ -351,10 +351,10 @@ class SalesOrderCreate(AjaxCreateView):
return initials
def post_save(self, **kwargs):
def post_save(self, order, form, **kwargs):
# Record the user who created this sales order
self.object.created_by = self.request.user
self.object.save()
order.created_by = self.request.user
order.save()
class PurchaseOrderEdit(AjaxUpdateView):

View File

@ -164,11 +164,11 @@ class StockItemAttachmentCreate(AjaxCreateView):
ajax_template_name = "modal_form.html"
role_required = 'stock.add'
def post_save(self, **kwargs):
def post_save(self, attachment, form, **kwargs):
""" Record the user that uploaded the attachment """
self.object.user = self.request.user
self.object.save()
attachment.user = self.request.user
attachment.save()
def get_data(self):
return {
@ -440,11 +440,11 @@ class StockItemTestResultCreate(AjaxCreateView):
ajax_form_title = _("Add Test Result")
role_required = 'stock.add'
def post_save(self, **kwargs):
def post_save(self, result, form, **kwargs):
""" Record the user that uploaded the test result """
self.object.user = self.request.user
self.object.save()
result.user = self.request.user
result.save()
def get_initial(self):