# 89 Ecoaccount recorded state reset (fix)

* fixes bug where recorded state of eco account has been reset, if a deduction is created from the detail view of the ecoaccount itself
This commit is contained in:
2022-01-31 10:14:46 +01:00
parent 9c338f8a90
commit 8979149e56
4 changed files with 15 additions and 7 deletions

View File

@@ -262,12 +262,15 @@ class RecordableObjectMixin(models.Model):
return action
def mark_as_edited(self, performing_user: User, request: HttpRequest = None, edit_comment: str = None):
def mark_as_edited(self, performing_user: User, request: HttpRequest = None, edit_comment: str = None, reset_recorded: bool = True):
""" In case the object or a related object changed, internal processes need to be started, such as
unrecord and uncheck
Args:
performing_user (User): The user which performed the editing action
request (HttpRequest): The used request for this action
edit_comment (str): Additional comment for the log entry
reset_recorded (bool): Whether the record-state of the object should be reset
Returns:
@@ -277,7 +280,7 @@ class RecordableObjectMixin(models.Model):
self.log.add(action)
self.save()
if self.recorded:
if self.recorded and reset_recorded:
action = self.set_unrecorded(performing_user)
self.log.add(action)
if request: