Merge pull request #31519 from rohitwaghchaure/fixed-time-out-error-reposting
fix: timeout error while reposting
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 7e3597e..686db9d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -539,7 +539,7 @@
},
add_custom_buttons: function(frm) {
- if (frm.doc.per_received < 100) {
+ if (frm.doc.docstatus == 1 && frm.doc.per_received < 100) {
frm.add_custom_button(__('Purchase Receipt'), () => {
frm.events.make_purchase_receipt(frm);
}, __('Create'));
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index f28de3b..8d5a042 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -300,7 +300,7 @@
raise_error_if_no_rate=False,
)
- rate = flt(outgoing_rate * d.conversion_factor, d.precision("rate"))
+ rate = flt(outgoing_rate * (d.conversion_factor or 1), d.precision("rate"))
else:
rate = frappe.db.get_value(ref_doctype, d.get(frappe.scrub(ref_doctype)), "rate")