Fixed the logic in the save() method of the Account data model so that the current_user will not override the created_by and updated_by when the current_user was not supplied in the accounting application.
This commit is contained in:
parent
f26b303205
commit
8d33429fef
@ -71,9 +71,9 @@ class Account(DirtyFieldsMixin, models.Model):
|
|||||||
else Account.objects.get(code=self.code[:-1])
|
else Account.objects.get(code=self.code[:-1])
|
||||||
if self.pk is None:
|
if self.pk is None:
|
||||||
self.pk = new_pk(Account)
|
self.pk = new_pk(Account)
|
||||||
if getattr(self, "created_by", None) is None:
|
if current_user is not None:
|
||||||
self.created_by = current_user
|
self.created_by = current_user
|
||||||
if getattr(self, "updated_by", None) is None:
|
if current_user is not None:
|
||||||
self.updated_by = current_user
|
self.updated_by = current_user
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
super(Account, self).save(
|
super(Account, self).save(
|
||||||
|
Loading…
Reference in New Issue
Block a user