fix: negative valuation rate in PR return (#37424)

* fix: negative valuation rate in PR return

* test: add test case for PR return
This commit is contained in:
s-aga-r
2023-10-11 18:44:32 +05:30
committed by GitHub
parent 573b159541
commit 26ad688584
3 changed files with 80 additions and 12 deletions

View File

@@ -698,14 +698,16 @@ class update_entries_after(object):
get_rate_for_return, # don't move this import to top
)
rate = get_rate_for_return(
sle.voucher_type,
sle.voucher_no,
sle.item_code,
voucher_detail_no=sle.voucher_detail_no,
sle=sle,
)
if self.valuation_method == "Moving Average":
rate = self.data[self.args.warehouse].previous_sle.valuation_rate
else:
rate = get_rate_for_return(
sle.voucher_type,
sle.voucher_no,
sle.item_code,
voucher_detail_no=sle.voucher_detail_no,
sle=sle,
)
elif (
sle.voucher_type in ["Purchase Receipt", "Purchase Invoice"]
and sle.voucher_detail_no