Fix - Total Fixed Cost with patch

This commit is contained in:
Neil Trini Lasrado 2014-12-10 15:47:25 +05:30
parent b71d1a4c7f
commit 3a34cadcb2
4 changed files with 23 additions and 1 deletions

View File

@ -83,6 +83,7 @@ cur_frm.cscript.hour_rate = function(doc, dt, dn) {
cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
cur_frm.cscript.fixed_cycle_cost = cur_frm.cscript.hour_rate;
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
get_bom_material_detail(doc, cdt, cdn);

View File

@ -285,7 +285,10 @@ class BOM(Document):
if not d.hour_rate:
d.hour_rate = flt(w[0])
fixed_cost += flt(w[1])
if d.fixed_cycle_cost == None:
d.fixed_cycle_cost= flt(w[1])
fixed_cost += d.fixed_cycle_cost
if d.hour_rate and d.time_in_mins:
d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0

View File

@ -89,3 +89,4 @@ erpnext.patches.v4_2.recalculate_bom_cost
erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
erpnext.patches.v4_2.update_requested_and_ordered_qty
execute:frappe.delete_doc("DocType", "Contact Control")
erpnext.patches.v4_2.recalculate_bom_costs

View File

@ -0,0 +1,17 @@
# 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():
for d in frappe.db.sql("""select name from `tabBOM` where docstatus < 2 and total_fixed_cost IS NOT NULL""", as_dict=1):
try:
bom = frappe.get_doc('BOM', d.name)
bom.ignore_validate_update_after_submit = True
bom.calculate_cost()
bom.save()
frappe.db.commit()
except:
frappe.db.rollback()