Added owner's equity (base code starts with "3") to the accounts that can take offset.

This commit is contained in:
依瑪貓 2023-03-18 19:14:35 +08:00
parent c869bccc04
commit 4eac10981f
3 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ class NoOffsetNominalAccount:
return return
if form.base_code.data is None: if form.base_code.data is None:
return return
if form.base_code.data[0] not in {"1", "2"}: if form.base_code.data[0] not in {"1", "2", "3"}:
raise ValidationError(lazy_gettext( raise ValidationError(lazy_gettext(
"A nominal account does not need offset.")) "A nominal account does not need offset."))
@ -102,7 +102,7 @@ class AccountForm(FlaskForm):
obj.base_code = self.base_code.data obj.base_code = self.base_code.data
obj.no = count + 1 obj.no = count + 1
obj.title = self.title.data obj.title = self.title.data
if self.base_code.data[0] in {"1", "2"}: if self.base_code.data[0] in {"1", "2", "3"}:
obj.is_offset_needed = self.is_offset_needed.data obj.is_offset_needed = self.is_offset_needed.data
else: else:
obj.is_offset_needed = False obj.is_offset_needed = False

View File

@ -137,7 +137,7 @@ class AccountForm {
setBaseAccount(code, text) { setBaseAccount(code, text) {
this.#baseCode.value = code; this.#baseCode.value = code;
this.#base.innerText = text; this.#base.innerText = text;
if (["1", "2"].includes(code.substring(0, 1))) { if (["1", "2", "3"].includes(code.substring(0, 1))) {
this.#isOffsetNeededControl.classList.remove("d-none"); this.#isOffsetNeededControl.classList.remove("d-none");
this.#isOffsetNeeded.disabled = false; this.#isOffsetNeeded.disabled = false;
} else { } else {

View File

@ -62,7 +62,7 @@ First written: 2023/2/1
<div id="accounting-title-error" class="invalid-feedback">{% if form.title.errors %}{{ form.title.errors[0] }}{% endif %}</div> <div id="accounting-title-error" class="invalid-feedback">{% if form.title.errors %}{{ form.title.errors[0] }}{% endif %}</div>
</div> </div>
<div id="accounting-is-offset-needed-control" class="form-check form-switch mb-3 {% if form.base_code.data[0] not in ["1", "2"] %} d-none {% endif %}"> <div id="accounting-is-offset-needed-control" class="form-check form-switch mb-3 {% if form.base_code.data[0] not in ["1", "2", "3"] %} d-none {% endif %}">
<input id="accounting-is-offset-needed" class="form-check-input" type="checkbox" name="is_offset_needed" value="1" {% if form.is_offset_needed.data %} checked="checked" {% endif %}> <input id="accounting-is-offset-needed" class="form-check-input" type="checkbox" name="is_offset_needed" value="1" {% if form.is_offset_needed.data %} checked="checked" {% endif %}>
<label class="form-check-label" for="accounting-is-offset-needed"> <label class="form-check-label" for="accounting-is-offset-needed">
{{ A_("The entries in the account need offset.") }} {{ A_("The entries in the account need offset.") }}