brotherton-erpnext/erpnext/patches/v7_2/stock_uom_in_selling.py

15 lines
522 B
Python
Raw Normal View History

from __future__ import unicode_literals
2017-02-10 08:57:11 +00:00
import frappe
def execute():
frappe.reload_doctype('Sales Order')
frappe.reload_doctype('Sales Invoice')
frappe.reload_doctype('Quotation')
frappe.reload_doctype('Delivery Note')
doctype_list = ['Sales Order Item', 'Delivery Note Item', 'Quotation Item', 'Sales Invoice Item']
for doctype in doctype_list:
2017-03-06 13:22:34 +00:00
frappe.reload_doctype(doctype)
2017-02-10 08:57:11 +00:00
frappe.db.sql("""update `tab{doctype}`
set uom = stock_uom, conversion_factor = 1, stock_qty = qty""".format(doctype=doctype))