Merge pull request #31493 from deepeshgarg007/internal_invoicing_references
fix: Internal PI link in Sales Invoice
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py
index e1ccc11..7b7d057 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py
@@ -624,7 +624,7 @@
data = self.get_data_for_eval()
for struct_row in self._salary_structure_doc.get(component_type):
amount = self.eval_condition_and_formula(struct_row, data)
- if amount and struct_row.statistical_component == 0:
+ if amount is not None and struct_row.statistical_component == 0:
self.update_component_row(struct_row, amount, component_type)
def get_data_for_eval(self):
@@ -854,6 +854,10 @@
component_row, joining_date, relieving_date
)[0]
+ # remove 0 valued components that have been updated later
+ if component_row.amount == 0:
+ self.remove(component_row)
+
def set_precision_for_component_amounts(self):
for component_type in ("earnings", "deductions"):
for component_row in self.get(component_type):
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 01f72ad..ee77b46 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1107,9 +1107,25 @@
}
}
+ is_a_mapped_document(item) {
+ const mapped_item_field_map = {
+ "Delivery Note Item": ["si_detail", "so_detail", "dn_detail"],
+ "Sales Invoice Item": ["dn_detail", "so_detail", "sales_invoice_item"],
+ "Purchase Receipt Item": ["purchase_order_item", "purchase_invoice_item", "purchase_receipt_item"],
+ "Purchase Invoice Item": ["purchase_order_item", "pr_detail", "po_detail"],
+ };
+ const mappped_fields = mapped_item_field_map[item.doctype] || [];
+
+ return mappped_fields
+ .map((field) => item[field])
+ .filter(Boolean).length > 0;
+ }
+
batch_no(doc, cdt, cdn) {
let item = frappe.get_doc(cdt, cdn);
- this.apply_price_list(item, true);
+ if (!this.is_a_mapped_document(item)) {
+ this.apply_price_list(item, true);
+ }
}
toggle_conversion_factor(item) {