2015-03-03 14:55:30 +05:30
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2014-12-10 15:47:25 +05:30
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
2014-12-18 11:36:23 +05:30
|
|
|
frappe.reload_doc('manufacturing', 'doctype', 'bom_operation')
|
2014-12-31 13:30:36 +05:30
|
|
|
for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2""", as_dict=1):
|
2014-12-10 15:47:25 +05:30
|
|
|
try:
|
|
|
|
bom = frappe.get_doc('BOM', d.name)
|
2015-02-10 14:41:27 +05:30
|
|
|
bom.flags.ignore_validate_update_after_submit = True
|
2014-12-10 15:47:25 +05:30
|
|
|
bom.calculate_cost()
|
|
|
|
bom.save()
|
|
|
|
frappe.db.commit()
|
|
|
|
except:
|
|
|
|
frappe.db.rollback()
|