Merge pull request #29656 from ankush/credit_debit_pr

fix: dont ignore items that dont have SVD
This commit is contained in:
Deepesh Garg 2022-02-07 23:46:07 +05:30 committed by GitHub
commit 529cc72863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 4 deletions

View File

@ -288,9 +288,6 @@ class PurchaseReceipt(BuyingController):
{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
"voucher_detail_no": d.name, "warehouse": d.warehouse, "is_cancelled": 0}, "stock_value_difference")
if not stock_value_diff:
continue
warehouse_account_name = warehouse_account[d.warehouse]["account"]
warehouse_account_currency = warehouse_account[d.warehouse]["account_currency"]
supplier_warehouse_account = warehouse_account.get(self.supplier_warehouse, {}).get("account")

View File

@ -4,6 +4,7 @@
import json
import unittest
from collections import defaultdict
import frappe
from frappe.utils import add_days, cint, cstr, flt, today
@ -16,7 +17,7 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchas
from erpnext.stock.doctype.serial_no.serial_no import SerialNoDuplicateError, get_serial_nos
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.stock.stock_ledger import SerialNoExistsInFutureTransaction
from erpnext.tests.utils import ERPNextTestCase
from erpnext.tests.utils import ERPNextTestCase, change_settings
class TestPurchaseReceipt(ERPNextTestCase):
@ -1387,6 +1388,36 @@ class TestPurchaseReceipt(ERPNextTestCase):
automatically_fetch_payment_terms(enable=0)
@change_settings("Stock Settings", {"allow_negative_stock": 1})
def test_neg_to_positive(self):
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
item_code = "_TestNegToPosItem"
warehouse = "Stores - TCP1"
company = "_Test Company with perpetual inventory"
account = "Stock Received But Not Billed - TCP1"
make_item(item_code)
se = make_stock_entry(item_code=item_code, from_warehouse=warehouse, qty=50, do_not_save=True, rate=0)
se.items[0].allow_zero_valuation_rate = 1
se.save()
se.submit()
pr = make_purchase_receipt(
qty=50,
rate=1,
item_code=item_code,
warehouse=warehouse,
get_taxes_and_charges=True,
company=company,
)
gles = get_gl_entries(pr.doctype, pr.name)
for gle in gles:
if gle.account == account:
self.assertEqual(gle.credit, 50)
def get_sl_entries(voucher_type, voucher_no):
return frappe.db.sql(""" select actual_qty, warehouse, stock_value_difference
from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s