Erpnext: Accounting Entry not generated for Purchase Receipt having rejected quantity

Created on 22 Jul 2018  路  6Comments  路  Source: frappe/erpnext

While recording Purchase Receipt of item which has some rejected quantity, the system is not generating corresponding accounting entry. However the stock ledger entry is being generated correctly.

If rejected quantity field is not used, system correctly generates accounting entry but once the rejected quantity field is given the corresponding accounting entry for that purchase receipt is not being generated.

Please look into this issue on urgent basis.

bug

All 6 comments

Tested at V10. Latest Update.

at Purchase Invoice, With update Stock Checked, accounting entry generated successfully with if we enter Rejected Qty.

but with Purchase Receipt, accounting entry is not generated if we enter Rejected Qty.

it's a BUG

is there any workaround for this issue?

Help required to fix this bug!!!!!

seems the bug related to below code purchase_receipt.py, def get_gl_entries
because when there is rejected quantity there will be 2 stock ledger entries, one for the normal received qty, and the other for the rejected quantity, but the 2nd sle entry without Stock Value Difference, per the below code, it is skipped(continue), so the fix will be simply add the order_by parameter(order_by = 'modified asc') into get_value call

    for d in self.get("items"):
        if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
            if warehouse_account.get(d.warehouse):
                stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
                    {"voucher_type": "Purchase Receipt", "voucher_no": self.name,
                    "voucher_detail_no": d.name}, "stock_value_difference")
                if not stock_value_diff:
                    continue

Hi @szufisher

Thanks for the Idea, let me try to debug it with your hint. or if you can test it to see it's working fine or not.

will update you if i test it first.

Fixed via #15815

Was this page helpful?
0 / 5 - 0 ratings