Merge pull request #17145 from Mangesh-Khairnar/salary-register-doj
feat: add date of joining column in salary register
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 9ef6446..b8073ce 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -749,7 +749,7 @@
@frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency):
- total_amount = outstanding_amount = exchange_rate = None
+ total_amount = outstanding_amount = exchange_rate = bill_no = None
ref_doc = frappe.get_doc(reference_doctype, reference_name)
company_currency = ref_doc.get("company_currency") or erpnext.get_company_currency(ref_doc.company)
@@ -783,6 +783,7 @@
if reference_doctype in ("Sales Invoice", "Purchase Invoice"):
outstanding_amount = ref_doc.get("outstanding_amount")
+ bill_no = ref_doc.get("bill_no")
elif reference_doctype == "Expense Claim":
outstanding_amount = flt(ref_doc.get("total_sanctioned_amount")) \
- flt(ref_doc.get("total_amount+reimbursed")) - flt(ref_doc.get("total_advance_amount"))
@@ -799,7 +800,8 @@
"due_date": ref_doc.get("due_date"),
"total_amount": total_amount,
"outstanding_amount": outstanding_amount,
- "exchange_rate": exchange_rate
+ "exchange_rate": exchange_rate,
+ "bill_no": bill_no
})
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 43d7972..a108305 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -118,7 +118,6 @@
self.validate_has_variants()
self.validate_stock_exists_for_template_item()
- self.validate_asset_exists_for_serialized_asset()
self.validate_attributes()
self.validate_variant_attributes()
self.validate_website_image()
@@ -128,6 +127,7 @@
self.validate_uom_conversion_factor()
self.validate_item_defaults()
self.validate_customer_provided_part()
+ self.validate_stock_for_has_batch_and_has_serial()
if not self.get("__islocal"):
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
@@ -759,12 +759,6 @@
frappe.throw(
_('Cannot change Attributes after stock transaction. Make a new Item and transfer stock to the new Item'))
- def validate_asset_exists_for_serialized_asset(self):
- if (not self.get("__islocal") and self.asset_exists() and
- cint(self.has_serial_no) != cint(frappe.db.get_value('Item', self.name, 'has_serial_no'))):
- frappe.throw(_("Asset is already exists against the item {0}, you cannot change the has serial no value")
- .format(self.name))
-
def asset_exists(self):
if not hasattr(self, '_asset_created'):
self._asset_created = frappe.db.get_all("Asset",
@@ -824,6 +818,11 @@
for d in self.attributes:
d.variant_of = self.variant_of
+ def validate_stock_for_has_batch_and_has_serial(self):
+ if self.stock_ledger_created():
+ for value in ["has_batch_no", "has_serial_no"]:
+ if frappe.db.get_value("Item", self.name, value) != self.get_value(value):
+ frappe.throw(_("Cannot change {0} as Stock Transaction for Item {1} exist.".format(value, self.name)))
def get_timeline_data(doctype, name):
'''returns timeline data based on stock ledger entry'''