fixes for batch validations
This commit is contained in:
parent
9448aaf2a6
commit
14e24a947b
@ -63,7 +63,6 @@ class StockEntry(StockController):
|
|||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.validate_valuation_rate()
|
self.validate_valuation_rate()
|
||||||
self.set_total_amount()
|
self.set_total_amount()
|
||||||
self.validate_batch_item()
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.update_stock_ledger()
|
self.update_stock_ledger()
|
||||||
@ -661,10 +660,6 @@ class StockEntry(StockController):
|
|||||||
frappe.throw(_("Item or Warehouse for row {0} does not match Material Request").format(item.idx),
|
frappe.throw(_("Item or Warehouse for row {0} does not match Material Request").format(item.idx),
|
||||||
frappe.MappingMismatchError)
|
frappe.MappingMismatchError)
|
||||||
|
|
||||||
def validate_batch_item(self):
|
|
||||||
if frappe.db.get_value("Item",self.item,"has_batch_no") =='No':
|
|
||||||
frappe.throw(_("The selected item cannot have Batch"))
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_party_details(ref_dt, ref_dn):
|
def get_party_details(ref_dt, ref_dn):
|
||||||
if ref_dt in ["Delivery Note", "Sales Invoice"]:
|
if ref_dt in ["Delivery Note", "Sales Invoice"]:
|
||||||
|
@ -62,14 +62,15 @@ class StockLedgerEntry(Document):
|
|||||||
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
frappe.throw(_("Item {0} must be a stock Item").format(self.item_code))
|
||||||
|
|
||||||
# check if batch number is required
|
# check if batch number is required
|
||||||
if item_det.has_batch_no =='Yes' and self.voucher_type != 'Stock Reconciliation':
|
if self.voucher_type != 'Stock Reconciliation':
|
||||||
if not self.batch_no:
|
if item_det.has_batch_no =='Yes':
|
||||||
frappe.throw("Batch number is mandatory for Item {0}".format(self.item_code))
|
if not self.batch_no:
|
||||||
|
frappe.throw(_("Batch number is mandatory for Item {0}").format(self.item_code))
|
||||||
|
elif not frappe.db.get_value("Batch",{"item": self.item_code, "name": self.batch_no}):
|
||||||
|
frappe.throw(_("{0} is not a valid Batch Number for Item {1}").format(self.batch_no, self.item_code))
|
||||||
|
|
||||||
# check if batch belongs to item
|
elif item_det.has_batch_no =='No' and self.batch_no:
|
||||||
if not frappe.db.get_value("Batch",
|
frappe.throw(_("The Item {0} cannot have Batch").format(self.item_code))
|
||||||
{"item": self.item_code, "name": self.batch_no}):
|
|
||||||
frappe.throw(_("{0} is not a valid Batch Number for Item {1}").format(self.batch_no, self.item_code))
|
|
||||||
|
|
||||||
if item_det.has_variants:
|
if item_det.has_variants:
|
||||||
frappe.throw(_("Stock cannot exist for Item {0} since has variants").format(self.item_code),
|
frappe.throw(_("Stock cannot exist for Item {0} since has variants").format(self.item_code),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user