Skip to content

Commit

Permalink
fix: Use fallback conversion factor while setting incoming rate for p…
Browse files Browse the repository at this point in the history
…etty purchase

- PIs for petty items (that do not need an Item record) are allowed using Item Name field
- If a different UOM is used in this case, conversion factor stays 0 and causes an error
- Fallback to 1 in `set_incoming_rate` for buying
- Selling will need a proper item, so this change is not needed there

(cherry picked from commit aa043fe)
  • Loading branch information
marination authored and mergify[bot] committed Jul 5, 2022
1 parent 776e807 commit 2a432c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion erpnext/controllers/buying_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def set_incoming_rate(self):
raise_error_if_no_rate=False,
)

rate = flt(outgoing_rate * d.conversion_factor, d.precision("rate"))
rate = flt(outgoing_rate * (d.conversion_factor or 1), d.precision("rate"))
else:
rate = frappe.db.get_value(ref_doctype, d.get(frappe.scrub(ref_doctype)), "rate")

Expand Down

0 comments on commit 2a432c2

Please sign in to comment.