brotherton-erpnext/erpnext/patches/v7_1/save_stock_settings.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
478 B
Python
Raw Normal View History

2016-10-27 18:26:04 +00:00
from __future__ import unicode_literals
import frappe
def execute():
stock_settings = frappe.get_doc('Stock Settings')
2016-12-29 05:27:48 +00:00
if stock_settings.default_warehouse \
and not frappe.db.exists("Warehouse", stock_settings.default_warehouse):
stock_settings.default_warehouse = None
if stock_settings.stock_uom and not frappe.db.exists("UOM", stock_settings.stock_uom):
stock_settings.stock_uom = None
2016-10-29 09:13:58 +00:00
stock_settings.flags.ignore_mandatory = True
stock_settings.save()