Fixed a type hint in the populate_obj method of the AccountForm form.

This commit is contained in:
依瑪貓 2023-02-24 00:18:55 +08:00
parent d5af5de3c1
commit 3f63fb0bda

View File

@ -81,7 +81,7 @@ class AccountForm(FlaskForm):
obj.id = new_id(Account) obj.id = new_id(Account)
obj.base_code = self.base_code.data obj.base_code = self.base_code.data
if prev_base_code != self.base_code.data: if prev_base_code != self.base_code.data:
max_no: int = db.session.scalars( max_no: int | None = db.session.scalars(
sa.select(sa.func.max(Account.no)) sa.select(sa.func.max(Account.no))
.filter(Account.base_code == self.base_code.data)).one() .filter(Account.base_code == self.base_code.data)).one()
obj.no = 1 if max_no is None else max_no + 1 obj.no = 1 if max_no is None else max_no + 1