brotherton-erpnext/erpnext/patches/v8_0/move_perpetual_inventory_setting.py
2017-06-26 13:28:45 +05:30

13 lines
492 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('Company')
enabled = frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock") or 0
for data in frappe.get_all('Company', fields = ["name"]):
doc = frappe.get_doc('Company', data.name)
doc.enable_perpetual_inventory = enabled
doc.db_update()