Skip to content

Commit

Permalink
fix: set correct purchase_sle in get_last_sle() (#37708)
Browse files Browse the repository at this point in the history
sle_dict may look like this:
{
  'incoming': [
    {... Stock Entry ...},
    {... Purchase Receipt ...}
  ],
  'outgoing': [
    {... Stock Entry ...}
  ]
}
  • Loading branch information
scdanieli authored Oct 31, 2023
1 parent 25718d9 commit 86cf156
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erpnext/stock/doctype/serial_no/serial_no.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def get_last_sle(self, serial_no=None):
sle_dict = self.get_stock_ledger_entries(serial_no)
if sle_dict:
if sle_dict.get("incoming", []):
entries["purchase_sle"] = sle_dict["incoming"][0]
entries["purchase_sle"] = sle_dict["incoming"][-1]

if len(sle_dict.get("incoming", [])) - len(sle_dict.get("outgoing", [])) > 0:
entries["last_sle"] = sle_dict["incoming"][0]
Expand Down

0 comments on commit 86cf156

Please sign in to comment.