Merge pull request #32339 from rohitwaghchaure/fixed-opening-entry-trial-balance-issue
fix: opening entry causing discrepancy between stock and trial balance
This commit is contained in:
commit
106ee1bf4d
@ -237,9 +237,9 @@ def get_conditions(filters):
|
|||||||
or filters.get("party")
|
or filters.get("party")
|
||||||
or filters.get("group_by") in ["Group by Account", "Group by Party"]
|
or filters.get("group_by") in ["Group by Account", "Group by Party"]
|
||||||
):
|
):
|
||||||
conditions.append("posting_date >=%(from_date)s")
|
conditions.append("(posting_date >=%(from_date)s or is_opening = 'Yes')")
|
||||||
|
|
||||||
conditions.append("(posting_date <=%(to_date)s or is_opening = 'Yes')")
|
conditions.append("(posting_date <=%(to_date)s)")
|
||||||
|
|
||||||
if filters.get("project"):
|
if filters.get("project"):
|
||||||
conditions.append("project in %(project)s")
|
conditions.append("project in %(project)s")
|
||||||
|
@ -172,6 +172,7 @@ def get_rootwise_opening_balances(filters, report_type):
|
|||||||
query_filters = {
|
query_filters = {
|
||||||
"company": filters.company,
|
"company": filters.company,
|
||||||
"from_date": filters.from_date,
|
"from_date": filters.from_date,
|
||||||
|
"to_date": filters.to_date,
|
||||||
"report_type": report_type,
|
"report_type": report_type,
|
||||||
"year_start_date": filters.year_start_date,
|
"year_start_date": filters.year_start_date,
|
||||||
"project": filters.project,
|
"project": filters.project,
|
||||||
@ -200,7 +201,7 @@ def get_rootwise_opening_balances(filters, report_type):
|
|||||||
where
|
where
|
||||||
company=%(company)s
|
company=%(company)s
|
||||||
{additional_conditions}
|
{additional_conditions}
|
||||||
and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
|
and (posting_date < %(from_date)s or (ifnull(is_opening, 'No') = 'Yes' and posting_date <= %(to_date)s))
|
||||||
and account in (select name from `tabAccount` where report_type=%(report_type)s)
|
and account in (select name from `tabAccount` where report_type=%(report_type)s)
|
||||||
and is_cancelled = 0
|
and is_cancelled = 0
|
||||||
group by account""".format(
|
group by account""".format(
|
||||||
|
@ -104,12 +104,17 @@ def get_opening_balances(filters):
|
|||||||
where company=%(company)s
|
where company=%(company)s
|
||||||
and is_cancelled=0
|
and is_cancelled=0
|
||||||
and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
|
and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
|
||||||
and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
|
and (posting_date < %(from_date)s or (ifnull(is_opening, 'No') = 'Yes' and posting_date <= %(to_date)s))
|
||||||
{account_filter}
|
{account_filter}
|
||||||
group by party""".format(
|
group by party""".format(
|
||||||
account_filter=account_filter
|
account_filter=account_filter
|
||||||
),
|
),
|
||||||
{"company": filters.company, "from_date": filters.from_date, "party_type": filters.party_type},
|
{
|
||||||
|
"company": filters.company,
|
||||||
|
"from_date": filters.from_date,
|
||||||
|
"to_date": filters.to_date,
|
||||||
|
"party_type": filters.party_type,
|
||||||
|
},
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user