[fix] set missing values on creation of stock entry from material request
This commit is contained in:
parent
9f28996165
commit
16ec14f9ab
@ -348,8 +348,15 @@ def make_supplier_quotation(source_name, target_doclist=None):
|
||||
def make_stock_entry(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def set_purpose(source, target):
|
||||
def update_item(obj, target, source_parent):
|
||||
target.conversion_factor = 1
|
||||
target.qty = flt(obj.qty) - flt(obj.ordered_qty)
|
||||
target.transfer_qty = flt(obj.qty) - flt(obj.ordered_qty)
|
||||
|
||||
def set_missing_values(source, target):
|
||||
target[0].purpose = "Material Transfer"
|
||||
se = webnotes.bean(target)
|
||||
se.run_method("get_stock_and_rate")
|
||||
|
||||
doclist = get_mapped_doclist("Material Request", source_name, {
|
||||
"Material Request": {
|
||||
@ -369,6 +376,6 @@ def make_stock_entry(source_name, target_doclist=None):
|
||||
},
|
||||
"postprocess": update_item
|
||||
}
|
||||
}, target_doclist, set_purpose)
|
||||
}, target_doclist, set_missing_values)
|
||||
|
||||
return [d.fields for d in doclist]
|
Loading…
x
Reference in New Issue
Block a user