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

View File

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