[fix] [minor] pull only undelivered items in Dn from SO

This commit is contained in:
Nabin Hait 2013-07-30 12:54:22 +05:30
parent 9764e32d0a
commit de72b44d28
2 changed files with 9 additions and 4 deletions

View File

@ -76,7 +76,11 @@ class DocType(BuyingController):
elif is_submit == 1:
# even if this transaction is the latest one, it should be submitted
# for it to be considered for latest purchase rate
last_purchase_rate = flt(d.purchase_rate) / flt(d.conversion_factor)
if flt(d.conversion_factor):
last_purchase_rate = flt(d.purchase_rate) / flt(d.conversion_factor)
else:
msgprint(_("Row ") + cstr(d.idx) + ": " +
_("UOM Conversion Factor is mandatory"), raise_exception=1)
# update last purchsae rate
if last_purchase_rate:

View File

@ -375,7 +375,7 @@ def make_delivery_note(source_name, target_doclist=None):
target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)
target.export_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)
target.qty = flt(obj.qty) - flt(obj.delivered_qty)
doclist = get_mapped_doclist("Sales Order", source_name, {
"Sales Order": {
"doctype": "Delivery Note",
@ -396,7 +396,8 @@ def make_delivery_note(source_name, target_doclist=None):
"parenttype": "prevdoc_doctype",
"reserved_warehouse": "warehouse"
},
"postprocess": update_item
"postprocess": update_item,
"condition": lambda doc: doc.delivered_qty < doc.qty
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
@ -416,7 +417,7 @@ def make_sales_invoice(source_name, target_doclist=None):
target.export_amount = flt(obj.export_amount) - flt(obj.billed_amt)
target.amount = target.export_amount * flt(source_parent.conversion_rate)
target.qty = obj.export_rate and target.export_amount / flt(obj.export_rate) or obj.qty
doclist = get_mapped_doclist("Sales Order", source_name, {
"Sales Order": {
"doctype": "Sales Invoice",