Skip to content

Commit

Permalink
fix: batch qty conversion factor issue fixed in pos transaction (#34917)
Browse files Browse the repository at this point in the history
fix: batch qty conversion factor issue fixed in pos transaction (#34917)

(cherry picked from commit 59f3fed)

Co-authored-by: Vishal Dhayagude <vishdha@users.noreply.github.com>
Co-authored-by: Sagar Sharma <sagarsharma.s312@gmail.com>
  • Loading branch information
3 people committed Apr 20, 2023
1 parent 11e4fcb commit 56ef0ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions erpnext/selling/page/point_of_sale/pos_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,10 @@ erpnext.PointOfSale.Controller = class {

item_row = this.frm.add_child('items', new_item);

if (field === 'qty' && value !== 0 && !this.allow_negative_stock)
await this.check_stock_availability(item_row, value, this.frm.doc.set_warehouse);
if (field === 'qty' && value !== 0 && !this.allow_negative_stock) {
const qty_needed = value * item_row.conversion_factor;
await this.check_stock_availability(item_row, qty_needed, this.frm.doc.set_warehouse);
}

await this.trigger_new_item_events(item_row);

Expand Down
2 changes: 1 addition & 1 deletion erpnext/stock/doctype/batch/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def get_pos_reserved_batch_qty(filters):

p = frappe.qb.DocType("POS Invoice").as_("p")
item = frappe.qb.DocType("POS Invoice Item").as_("item")
sum_qty = frappe.query_builder.functions.Sum(item.qty).as_("qty")
sum_qty = frappe.query_builder.functions.Sum(item.stock_qty).as_("qty")

reserved_batch_qty = (
frappe.qb.from_(p)
Expand Down

0 comments on commit 56ef0ba

Please sign in to comment.