[fix] [mapper]
diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py
index 406f3a9..e2d7a45 100644
--- a/buying/doctype/purchase_order/purchase_order.py
+++ b/buying/doctype/purchase_order/purchase_order.py
@@ -249,7 +249,7 @@
def update_item(obj, target, source_parent):
target.conversion_factor = 1
target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
- target.amount = target.import_amount / flt(source_parent.conversion_rate)
+ target.amount = target.import_amount * flt(source_parent.conversion_rate)
if flt(obj.purchase_rate):
target.qty = target.amount / flt(obj.purchase_rate)
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 13f0e9f..b67510d 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -412,9 +412,9 @@
@webnotes.whitelist()
def make_sales_invoice(source_name, target_doclist=None):
def update_item(obj, target, source_parent):
- target.export_amount = flt(obj.amount) - flt(obj.billed_amt)
- target.amount = target.export_amount / flt(source_parent.conversion_rate)
- target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
+ 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": {
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 6cc54b0..e2f1333 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -358,12 +358,7 @@
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
@webnotes.whitelist()
-def make_sales_invoice(source_name, target_doclist=None):
- def update_item(obj, target, source_parent):
- target.export_amount = flt(obj.amount)
- target.amount = target.export_amount / flt(source_parent.conversion_rate)
- target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
-
+def make_sales_invoice(source_name, target_doclist=None):
def update_accounts(source, target):
si = webnotes.bean(target)
si.run_method("onload_post_render")
@@ -384,7 +379,6 @@
"prevdoc_docname": "sales_order",
"serial_no": "serial_no"
},
- "postprocess": update_item
},
"Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges",
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py
index 14d0c03..89a40e7 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -352,10 +352,6 @@
def update_item(obj, target, source_parent):
target.conversion_factor = 1
- target.import_amount = flt(obj.import_amount)
- target.amount = target.import_amount / flt(source_parent.conversion_rate)
- if flt(obj.purchase_rate):
- target.qty = target.amount / flt(obj.purchase_rate)
doclist = get_mapped_doclist("Purchase Receipt", source_name, {
"Purchase Receipt": {