BugFix: use transfer_qty instead of actual_qty in check_duplicate_entry_for_production_order - ported webnotes/erpnext@942ff2583b
This commit is contained in:
parent
8bde7f9b3a
commit
bbffaf78fb
@ -30,6 +30,7 @@ class StockEntry(StockController):
|
|||||||
pro_obj = self.production_order and \
|
pro_obj = self.production_order and \
|
||||||
frappe.get_doc('Production Order', self.production_order) or None
|
frappe.get_doc('Production Order', self.production_order) or None
|
||||||
|
|
||||||
|
self.set_transfer_qty()
|
||||||
self.validate_item()
|
self.validate_item()
|
||||||
self.validate_uom_is_integer("uom", "qty")
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
self.validate_uom_is_integer("stock_uom", "transfer_qty")
|
self.validate_uom_is_integer("stock_uom", "transfer_qty")
|
||||||
@ -68,6 +69,10 @@ class StockEntry(StockController):
|
|||||||
if self.purpose not in valid_purposes:
|
if self.purpose not in valid_purposes:
|
||||||
frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes)))
|
frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes)))
|
||||||
|
|
||||||
|
def set_transfer_qty(self):
|
||||||
|
for item in self.get("mtn_details"):
|
||||||
|
item.transfer_qty = flt(item.qty * item.conversion_factor, self.precision("transfer_qty", item))
|
||||||
|
|
||||||
def validate_item(self):
|
def validate_item(self):
|
||||||
stock_items = self.get_stock_items()
|
stock_items = self.get_stock_items()
|
||||||
for item in self.get("mtn_details"):
|
for item in self.get("mtn_details"):
|
||||||
@ -157,7 +162,7 @@ class StockEntry(StockController):
|
|||||||
production_item, qty = frappe.db.get_value("Production Order",
|
production_item, qty = frappe.db.get_value("Production Order",
|
||||||
self.production_order, ["production_item", "qty"])
|
self.production_order, ["production_item", "qty"])
|
||||||
args = other_ste + [production_item]
|
args = other_ste + [production_item]
|
||||||
fg_qty_already_entered = frappe.db.sql("""select sum(actual_qty)
|
fg_qty_already_entered = frappe.db.sql("""select sum(transfer_qty)
|
||||||
from `tabStock Entry Detail`
|
from `tabStock Entry Detail`
|
||||||
where parent in (%s)
|
where parent in (%s)
|
||||||
and item_code = %s
|
and item_code = %s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user