Renamed the "eid" field to "id" in the LineItemForm form, since the problem is found. It was the "id" property of the enclosing FormField. If we extract the form from FormField, we can still access the "id" field.
This commit is contained in:
@ -369,7 +369,7 @@ class OffsetTestCase(unittest.TestCase):
|
||||
|
||||
# Not deleting matched original line items
|
||||
form = journal_entry_data.update_form(self.csrf_token)
|
||||
del form["currency-1-debit-1-eid"]
|
||||
del form["currency-1-debit-1-id"]
|
||||
response = self.client.post(update_uri, data=form)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response.headers["Location"], edit_uri)
|
||||
@ -697,7 +697,7 @@ class OffsetTestCase(unittest.TestCase):
|
||||
|
||||
# Not deleting matched original line items
|
||||
form = journal_entry_data.update_form(self.csrf_token)
|
||||
del form["currency-1-credit-1-eid"]
|
||||
del form["currency-1-credit-1-id"]
|
||||
response = self.client.post(update_uri, data=form)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response.headers["Location"], edit_uri)
|
||||
|
@ -166,7 +166,7 @@ def get_unchanged_update_form(journal_entry_id: int, app: Flask,
|
||||
line_item_index: int = __get_new_index(line_item_indices_used)
|
||||
line_item_no = line_item_no + 3 + randbelow(3)
|
||||
prefix = f"{currency_prefix}-debit-{line_item_index}"
|
||||
form[f"{prefix}-eid"] = str(line_item.id)
|
||||
form[f"{prefix}-id"] = str(line_item.id)
|
||||
form[f"{prefix}-no"] = str(line_item_no)
|
||||
form[f"{prefix}-account_code"] = line_item.account.code
|
||||
form[f"{prefix}-description"] \
|
||||
@ -180,7 +180,7 @@ def get_unchanged_update_form(journal_entry_id: int, app: Flask,
|
||||
line_item_index: int = __get_new_index(line_item_indices_used)
|
||||
line_item_no = line_item_no + 3 + randbelow(3)
|
||||
prefix = f"{currency_prefix}-credit-{line_item_index}"
|
||||
form[f"{prefix}-eid"] = str(line_item.id)
|
||||
form[f"{prefix}-id"] = str(line_item.id)
|
||||
form[f"{prefix}-no"] = str(line_item_no)
|
||||
form[f"{prefix}-account_code"] = line_item.account.code
|
||||
form[f"{prefix}-description"] \
|
||||
|
@ -66,7 +66,7 @@ class JournalEntryLineItemData:
|
||||
f"{prefix}-description": self.description,
|
||||
f"{prefix}-amount": str(self.amount)}
|
||||
if is_update and self.id != -1:
|
||||
form[f"{prefix}-eid"] = str(self.id)
|
||||
form[f"{prefix}-id"] = str(self.id)
|
||||
form[f"{prefix}-no"] = str(index) if self.no == -1 else str(self.no)
|
||||
if self.original_line_item is not None:
|
||||
assert self.original_line_item.id != -1
|
||||
|
Reference in New Issue
Block a user