Revised the #isQueryMatched method to match the current net balance instead of the net balance but the current form in the JavaScript OriginalLineItem class.
This commit is contained in:
parent
c865141583
commit
c8504bcbf5
@ -781,8 +781,7 @@ class JournalEntryLineItem(db.Model):
|
|||||||
"{}/{}/{}".format(journal_entry_day.year,
|
"{}/{}/{}".format(journal_entry_day.year,
|
||||||
journal_entry_day.month,
|
journal_entry_day.month,
|
||||||
journal_entry_day.day),
|
journal_entry_day.day),
|
||||||
format_amount(self.amount),
|
format_amount(self.amount)]
|
||||||
format_amount(self.net_balance)]
|
|
||||||
|
|
||||||
|
|
||||||
class Option(db.Model):
|
class Option(db.Model):
|
||||||
|
@ -366,6 +366,9 @@ class OriginalLineItem {
|
|||||||
if (query === "") {
|
if (query === "") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (this.#getNetBalanceForQuery().includes(query.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (const queryValue of this.#queryValues) {
|
for (const queryValue of this.#queryValues) {
|
||||||
if (queryValue.toLowerCase().includes(query.toLowerCase())) {
|
if (queryValue.toLowerCase().includes(query.toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
@ -374,6 +377,17 @@ class OriginalLineItem {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the net balance in the format for query match.
|
||||||
|
*
|
||||||
|
* @return {string} the net balance in the format for query match
|
||||||
|
*/
|
||||||
|
#getNetBalanceForQuery() {
|
||||||
|
const frac = this.netBalance.modulo(1);
|
||||||
|
const whole = Number(this.netBalance.minus(frac));
|
||||||
|
return String(whole) + String(frac).substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the option is shown.
|
* Sets whether the option is shown.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user