Merge pull request #26993 from rohitwaghchaure/fixed-sales-invoice-not-loading
fix: sales invoice not loading issue
diff --git a/.github/helper/documentation.py b/.github/helper/documentation.py
index b4a4ba1..91983d3 100644
--- a/.github/helper/documentation.py
+++ b/.github/helper/documentation.py
@@ -32,9 +32,9 @@
if response.ok:
payload = response.json()
- title = payload.get("title", "").lower().strip()
- head_sha = payload.get("head", {}).get("sha")
- body = payload.get("body", "").lower()
+ title = (payload.get("title") or "").lower().strip()
+ head_sha = (payload.get("head") or {}).get("sha")
+ body = (payload.get("body") or "").lower()
if (title.startswith("feat")
and head_sha
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 46904f7..831b270 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -529,7 +529,7 @@
if self.payment_type == "Receive" \
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
- self.unallocated_amount = (self.received_amount + total_deductions -
+ self.unallocated_amount = (self.base_received_amount + total_deductions -
self.base_total_allocated_amount) / self.source_exchange_rate
self.unallocated_amount -= included_taxes
elif self.payment_type == "Pay" \
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index d1302f5..801dadc 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -295,6 +295,34 @@
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
self.assertEqual(outstanding_amount, 80)
+ def test_payment_entry_against_si_usd_to_usd_with_deduction_in_base_currency (self):
+ si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
+ currency="USD", conversion_rate=50, do_not_save=1)
+
+ si.plc_conversion_rate = 50
+ si.save()
+ si.submit()
+
+ pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
+ bank_account="_Test Bank USD - _TC", bank_amount=900)
+
+ pe.source_exchange_rate = 45.263
+ pe.target_exchange_rate = 45.263
+ pe.reference_no = "1"
+ pe.reference_date = "2016-01-01"
+
+
+ pe.append("deductions", {
+ "account": "_Test Exchange Gain/Loss - _TC",
+ "cost_center": "_Test Cost Center - _TC",
+ "amount": 94.80
+ })
+
+ pe.save()
+
+ self.assertEqual(flt(pe.difference_amount, 2), 0.0)
+ self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
+
def test_payment_entry_retrieves_last_exchange_rate(self):
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 5424ef3..5fa6228 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -478,6 +478,9 @@
if cint(self.is_pos) != 1:
return
+ if not self.account_for_change_amount:
+ self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account')
+
from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
if not self.pos_profile:
pos_profile = get_pos_profile(self.company) or {}
@@ -492,9 +495,6 @@
if not self.get('payments') and not for_validate:
update_multi_mode_option(self, pos)
- if not self.account_for_change_amount:
- self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account')
-
if pos:
if not for_validate:
self.tax_category = pos.get("tax_category")
@@ -1463,7 +1463,7 @@
discounting_status = None
if self.is_discounted:
- discountng_status = get_discounting_status(self.name)
+ discounting_status = get_discounting_status(self.name)
if not status:
if self.docstatus == 2:
@@ -1471,11 +1471,11 @@
elif self.docstatus == 1:
if self.is_internal_transfer():
self.status = 'Internal Transfer'
- elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discountng_status=='Disbursed':
+ elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discounting_status=='Disbursed':
self.status = "Overdue and Discounted"
elif outstanding_amount > 0 and due_date < nowdate:
self.status = "Overdue"
- elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discountng_status=='Disbursed':
+ elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discounting_status=='Disbursed':
self.status = "Unpaid and Discounted"
elif outstanding_amount > 0 and due_date >= nowdate:
self.status = "Unpaid"
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
index e3afaec..9e126ba 100644
--- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
@@ -16,7 +16,7 @@
"name": "Bank and Cash Payment Voucher",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
index 8c9c266..08b8ef8 100755
--- a/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
+++ b/erpnext/accounts/print_format/cheque_printing_format/cheque_printing_format.json
@@ -10,6 +10,6 @@
"modified_by": "Administrator",
"name": "Cheque Printing Format",
"owner": "Administrator",
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/credit_note/credit_note.json b/erpnext/accounts/print_format/credit_note/credit_note.json
index c5a11cf..d12b872 100644
--- a/erpnext/accounts/print_format/credit_note/credit_note.json
+++ b/erpnext/accounts/print_format/credit_note/credit_note.json
@@ -17,7 +17,7 @@
"owner": "Administrator",
"parentfield": "__print_formats",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
index 6d7c3d3..1467f27 100644
--- a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
+++ b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
@@ -16,7 +16,7 @@
"name": "GST Purchase Invoice",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
index 927e818..e45295d 100644
--- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
@@ -16,7 +16,7 @@
"name": "Journal Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
index f1de448..c52eeb2 100755
--- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
+++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.json
@@ -12,6 +12,6 @@
"name": "Payment Receipt Voucher",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
index 73779d4..3398117 100644
--- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
@@ -16,7 +16,7 @@
"name": "Purchase Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
index 0544e0b..289e184 100644
--- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
@@ -16,7 +16,7 @@
"name": "Sales Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
index 0c7cad6..2e2a048 100644
--- a/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
+++ b/erpnext/buying/print_format/drop_shipping_format/drop_shipping_format.json
@@ -13,6 +13,6 @@
"name": "Drop Shipping Format",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 943f7aa..b1f89b0 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import flt, comma_or, nowdate, getdate
+from frappe.utils import flt, comma_or, nowdate, getdate, now
from frappe import _
from frappe.model.document import Document
@@ -336,10 +336,14 @@
target.notify_update()
def _update_modified(self, args, update_modified):
- args['update_modified'] = ''
- if update_modified:
- args['update_modified'] = ', modified = now(), modified_by = {0}'\
- .format(frappe.db.escape(frappe.session.user))
+ if not update_modified:
+ args['update_modified'] = ''
+ return
+
+ args['update_modified'] = ', modified = {0}, modified_by = {1}'.format(
+ frappe.db.escape(now()),
+ frappe.db.escape(frappe.session.user)
+ )
def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
ref_fieldname = frappe.scrub(ref_dt)
diff --git a/erpnext/healthcare/print_format/encounter_print/encounter_print.json b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
index ec1e0f2..3c90adb 100644
--- a/erpnext/healthcare/print_format/encounter_print/encounter_print.json
+++ b/erpnext/healthcare/print_format/encounter_print/encounter_print.json
@@ -16,7 +16,7 @@
"name": "Encounter Print",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
index e99ce70..4819e6d 100644
--- a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
+++ b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
@@ -16,7 +16,7 @@
"name": "Sample ID Print",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
diff --git a/erpnext/hr/print_format/job_offer/job_offer.json b/erpnext/hr/print_format/job_offer/job_offer.json
index 3fc2bcf..0a92230 100644
--- a/erpnext/hr/print_format/job_offer/job_offer.json
+++ b/erpnext/hr/print_format/job_offer/job_offer.json
@@ -15,7 +15,7 @@
"name": "Job Offer",
"owner": "Administrator",
"print_format_builder": 0,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/shopify_deprecation_warning.py b/erpnext/patches/v13_0/shopify_deprecation_warning.py
index 8b0f193..6f199c8 100644
--- a/erpnext/patches/v13_0/shopify_deprecation_warning.py
+++ b/erpnext/patches/v13_0/shopify_deprecation_warning.py
@@ -4,10 +4,6 @@
def execute():
- frappe.reload_doc("erpnext_integrations", "doctype", "shopify_settings")
- if not frappe.db.get_single_value("Shopify Settings", "enable_shopify"):
- return
-
click.secho(
"Shopify Integration is moved to a separate app and will be removed from ERPNext in version-14.\n"
"Please install the app to continue using the integration: https://github.com/frappe/ecommerce_integrations",
diff --git a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
index ceaf4a6..d5fee6b 100644
--- a/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
+++ b/erpnext/payroll/print_format/salary_slip_based_on_timesheet/salary_slip_based_on_timesheet.json
@@ -13,6 +13,6 @@
"name": "Salary Slip based on Timesheet",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
index b01239f..98a4435 100644
--- a/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
+++ b/erpnext/payroll/print_format/salary_slip_standard/salary_slip_standard.json
@@ -16,7 +16,7 @@
"name": "Salary Slip Standard",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
index ab56c6b..f67e245 100644
--- a/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
+++ b/erpnext/regional/print_format/detailed_tax_invoice/detailed_tax_invoice.json
@@ -16,7 +16,7 @@
"name": "Detailed Tax Invoice",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
index 7d8e675..b23206b 100644
--- a/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
+++ b/erpnext/regional/print_format/gst_tax_invoice/gst_tax_invoice.json
@@ -16,7 +16,7 @@
"name": "GST Tax Invoice",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
index b324f6e..aed2e89 100644
--- a/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
+++ b/erpnext/regional/print_format/simplified_tax_invoice/simplified_tax_invoice.json
@@ -16,7 +16,7 @@
"name": "Simplified Tax Invoice",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/regional/print_format/tax_invoice/tax_invoice.json b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
index 74db067..7479891 100644
--- a/erpnext/regional/print_format/tax_invoice/tax_invoice.json
+++ b/erpnext/regional/print_format/tax_invoice/tax_invoice.json
@@ -16,7 +16,7 @@
"name": "Tax Invoice",
"owner": "Administrator",
"print_format_builder": 1,
- "print_format_type": "Server",
+ "print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}
\ No newline at end of file
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
index b1273b7..b67c7fc 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.json
@@ -183,6 +183,7 @@
},
{
"label": "Pause SLA On",
+ "fieldname": "pause_sla_on",
"options": "Pause SLA On Status"
},
{
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index eb9fa12..083bde9 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -220,7 +220,7 @@
return
filters = [
- ["Service Level Agreement", "document_type", "=", doctype],
+ ["Service Level Agreement", "document_type", "=", doc.get('doctype')],
["Service Level Agreement", "enabled", "=", 1]
]