* fix: add validation for 'for_qty' else throws errors * fix: check if for_qty is None * fix: check purpose * fix: add purpose to pick list get_doc * fix: set as read only to prevent se from picking up value * chore: undo changes to doctype modified timestamp
This commit is contained in:
parent
3239f774bd
commit
37a25308ae
@ -184,4 +184,4 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,9 @@ from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note a
|
||||
# TODO: Prioritize SO or WO group warehouse
|
||||
|
||||
class PickList(Document):
|
||||
def validate(self):
|
||||
self.validate_for_qty()
|
||||
|
||||
def before_save(self):
|
||||
self.set_item_locations()
|
||||
|
||||
@ -35,6 +38,7 @@ class PickList(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def set_item_locations(self, save=False):
|
||||
self.validate_for_qty()
|
||||
items = self.aggregate_item_qty()
|
||||
self.item_location_map = frappe._dict()
|
||||
|
||||
@ -107,6 +111,11 @@ class PickList(Document):
|
||||
|
||||
return item_map.values()
|
||||
|
||||
def validate_for_qty(self):
|
||||
if self.purpose == "Material Transfer for Manufacture" \
|
||||
and (self.for_qty is None or self.for_qty == 0):
|
||||
frappe.throw(_("Qty of Finished Goods Item should be greater than 0."))
|
||||
|
||||
|
||||
def validate_item_locations(pick_list):
|
||||
if not pick_list.locations:
|
||||
|
@ -37,6 +37,7 @@ class TestPickList(unittest.TestCase):
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'purpose': 'Delivery',
|
||||
'locations': [{
|
||||
'item_code': '_Test Item',
|
||||
'qty': 5,
|
||||
@ -90,6 +91,7 @@ class TestPickList(unittest.TestCase):
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'purpose': 'Delivery',
|
||||
'locations': [{
|
||||
'item_code': '_Test Item Warehouse Group Wise Reorder',
|
||||
'qty': 1000,
|
||||
@ -135,6 +137,7 @@ class TestPickList(unittest.TestCase):
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'purpose': 'Delivery',
|
||||
'locations': [{
|
||||
'item_code': '_Test Serialized Item',
|
||||
'qty': 1000,
|
||||
@ -264,6 +267,7 @@ class TestPickList(unittest.TestCase):
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'purpose': 'Delivery',
|
||||
'locations': [{
|
||||
'item_code': '_Test Item',
|
||||
'qty': 5,
|
||||
@ -319,6 +323,7 @@ class TestPickList(unittest.TestCase):
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'purpose': 'Delivery',
|
||||
'locations': [{
|
||||
'item_code': '_Test Item',
|
||||
'qty': 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user