mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
fix: Make shelf life mandatory in Batched Item if it has expiry date (#21045)
This commit is contained in:
@@ -122,8 +122,11 @@ class Batch(Document):
|
|||||||
self.expiry_date = add_days(self.manufacturing_date, shelf_life_in_days)
|
self.expiry_date = add_days(self.manufacturing_date, shelf_life_in_days)
|
||||||
|
|
||||||
if has_expiry_date and not self.expiry_date:
|
if has_expiry_date and not self.expiry_date:
|
||||||
frappe.msgprint(_('Expiry date is mandatory for selected item.'))
|
frappe.throw(msg=_("Please set {0} for Batched Item {1}, which is used to set {2} on Submit.") \
|
||||||
frappe.throw(_("Set item's shelf life in days, to set expiry based on manufacturing date plus shelf-life."))
|
.format(frappe.bold("Shelf Life in Days"),
|
||||||
|
frappe.utils.get_link_to_form("Item", self.item),
|
||||||
|
frappe.bold("Batch Expiry Date")),
|
||||||
|
title=_("Expiry Date Mandatory"))
|
||||||
|
|
||||||
def get_name_from_naming_series(self):
|
def get_name_from_naming_series(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -343,7 +343,8 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "shelf_life_in_days",
|
"fieldname": "shelf_life_in_days",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Shelf Life In Days"
|
"label": "Shelf Life In Days",
|
||||||
|
"mandatory_depends_on": "eval:doc.has_batch_no && doc.has_expiry_date"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "2099-12-31",
|
"default": "2099-12-31",
|
||||||
@@ -1045,7 +1046,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"links": [],
|
"links": [],
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2020-01-02 19:13:59.295963",
|
"modified": "2020-03-24 16:14:36.950677",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
|
|||||||
Reference in New Issue
Block a user