[patch] [minor] fix sle against cancelled stock entry for production

This commit is contained in:
Nabin Hait 2013-08-20 17:40:26 +05:30
parent 4aeee45530
commit 7bd850a133
4 changed files with 26 additions and 12 deletions

View File

@ -162,5 +162,6 @@ def make_stock_entry(production_order_id, purpose):
else:
stock_entry.doc.from_warehouse = production_order.doc.wip_warehouse
stock_entry.doc.to_warehouse = production_order.doc.fg_warehouse
stock_entry.run_method("get_items")
return [d.fields for d in stock_entry.doclist]

View File

@ -0,0 +1,23 @@
import webnotes
def execute():
from stock.stock_ledger import update_entries_after
stock_entries = webnotes.conn.sql("""select name from `tabStock Entry`
where docstatus < 2 and modified >= '2013-08-15'
and ifnull(production_order, '') != '' and ifnull(bom_no, '') != ''""")
for entry in stock_entries:
webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled = 'Yes'
where voucher_type = 'Stock Entry' and voucher_no = %s""", entry[0])
item_warehouse = webnotes.conn.sql("""select distinct item_code, warehouse
from `tabStock Ledger Entry`
where voucher_type = 'Stock Entry' and voucher_no = %s""", entry[0], as_dict=1)
for d in item_warehouse:
update_entries_after({
"item_code": d.item_code,
"warehouse": d.warehouse,
"posting_date": "2013-08-15",
"posting_date": "01:00"
})

View File

@ -256,4 +256,5 @@ patch_list = [
"patches.august_2013.p05_update_serial_no_status",
"patches.august_2013.p05_employee_birthdays",
"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16",
"patches.august_2013.p06_fix_sle_against_stock_entry",
]

View File

@ -103,12 +103,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
},
callback: function(r) {
if (!r.exc) me.frm.set_value("expense_adjustment_account", r.message);
me.get_items_onload();
}
});
} else {
me.get_items_onload();
}
},
@ -121,13 +117,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
}
},
get_items_onload: function() {
if (this.frm.doc.__islocal && !getchildren('Stock Entry Detail', this.frm.doc.name,
'mtn_details').length) {
this.get_items()
}
},
get_items: function() {
if(this.frm.doc.production_order || this.frm.doc.bom_no) {
// if production order / bom is mentioned, get items