From b74ae7aa3130d260c370b0eb8415ddb01d78116f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 24 Nov 2014 18:17:01 +0530 Subject: [PATCH] Minor fix for order to invoice mapping --- erpnext/buying/doctype/purchase_order/purchase_order.py | 2 +- erpnext/selling/doctype/sales_order/sales_order.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 9b473c19bd..09f303f6aa 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -247,7 +247,7 @@ def make_purchase_invoice(source_name, target_doc=None): def update_item(obj, target, source_parent): target.amount = flt(obj.amount) - flt(obj.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) - target.qty = target.amount / flt(obj.rate) if flt(obj.rate) else flt(obj.qty) + target.qty = target.amount / flt(obj.rate) if (flt(obj.rate) and flt(obj.billed_amt)) else flt(obj.qty) doc = get_mapped_doc("Purchase Order", source_name, { "Purchase Order": { diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index bffa581639..498aec12b6 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -329,7 +329,7 @@ def make_sales_invoice(source_name, target_doc=None): def update_item(source, target, source_parent): target.amount = flt(source.amount) - flt(source.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) - target.qty = source.rate and target.amount / flt(source.rate) or source.qty + target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty doclist = get_mapped_doc("Sales Order", source_name, { "Sales Order": {