mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
feat: add transaction details in ledger
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-05-09 15:54:52.834794",
|
"modified": "2019-05-09 18:36:07.383714",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Ledger Entry",
|
"name": "Leave Ledger Entry",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
# import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import add_days
|
from frappe.utils import add_days
|
||||||
|
|
||||||
@@ -17,10 +17,9 @@ def create_leave_ledger_entry(ref_doc, submit=True):
|
|||||||
employee_name=ref_doc.employee_name,
|
employee_name=ref_doc.employee_name,
|
||||||
leave_type=ref_doc.leave_type,
|
leave_type=ref_doc.leave_type,
|
||||||
from_date=ref_doc.from_date,
|
from_date=ref_doc.from_date,
|
||||||
transaction_document_type=ref_doc.doctype,
|
transaction_type=ref_doc.doctype,
|
||||||
transaction_document_name=ref_doc.name
|
transaction_name=ref_doc.name
|
||||||
)
|
)
|
||||||
|
|
||||||
if ref_doc.carry_forwarded_leaves:
|
if ref_doc.carry_forwarded_leaves:
|
||||||
expiry_days = frappe.db.get_value("Leave Type", ref_doc.leave_type, "carry_forward_leave_expiry")
|
expiry_days = frappe.db.get_value("Leave Type", ref_doc.leave_type, "carry_forward_leave_expiry")
|
||||||
|
|
||||||
@@ -29,11 +28,11 @@ def create_leave_ledger_entry(ref_doc, submit=True):
|
|||||||
to_date=add_days(ref_doc.from_date, expiry_days) if expiry_days else ref_doc.to_date,
|
to_date=add_days(ref_doc.from_date, expiry_days) if expiry_days else ref_doc.to_date,
|
||||||
is_carry_forward=1
|
is_carry_forward=1
|
||||||
))
|
))
|
||||||
frappe.get_doc(ledger).insert()
|
frappe.get_doc(ledger).submit()
|
||||||
|
|
||||||
ledger.update(dict(
|
ledger.update(dict(
|
||||||
leaves=ref_doc.new_leaves_allocated * 1 if submit else -1,
|
leaves=ref_doc.new_leaves_allocated * 1 if submit else -1,
|
||||||
to_date=ref_doc.to_date,
|
to_date=ref_doc.to_date,
|
||||||
is_carry_forward=0
|
is_carry_forward=0
|
||||||
))
|
))
|
||||||
frappe.get_doc(ledger).insert()
|
frappe.get_doc(ledger).submit()
|
||||||
Reference in New Issue
Block a user