Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

frappe.ui.form.on("Daliy Cash Entry", {
refresh:function(frm) {
frm.set_query("cost_center", function() {
return {
filters: {
'is_group': 0
}
};
});
if (frm.doc.paid_type!="Other" && frm.doc.docstatus === 1 && !frm.doc.payment_entry) {
frm.add_custom_button(__("Payment Entry"),function () {
frappe.call({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"payment_entry",
"journal_entry",
"amended_from",
"naming_series"
"naming_series",
"voucher_status"
],
"fields": [
{
Expand All @@ -30,7 +31,6 @@
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date",
"reqd": 1
},
Expand All @@ -42,15 +42,13 @@
"allow_in_quick_entry": 1,
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount ",
"reqd": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "note",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Remarks",
"reqd": 1
},
Expand Down Expand Up @@ -123,13 +121,34 @@
"hidden": 1,
"label": "Naming SeriesDCE-.YYYY.-.#####",
"options": "DCE-.YYYY.-.#####"
},
{
"allow_in_quick_entry": 1,
"allow_on_submit": 1,
"columns": 1,
"fieldname": "voucher_status",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Voucher Status",
"read_only": 1
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2026-01-28 16:28:04.425592",
"links": [
{
"group": "Voucher Entry",
"link_doctype": "Journal Entry",
"link_fieldname": "custom_daily_cash_entry"
},
{
"group": "Voucher Entry",
"link_doctype": "Payment Entry",
"link_fieldname": "custom_daily_cash_entry"
}
],
"modified": "2026-02-04 10:59:54.634383",
"modified_by": "Administrator",
"module": "Calicut Textiles",
"name": "Daliy Cash Entry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ def on_cancel(self):
if pe.docstatus == 1:
pe.cancel()
frappe.db.set_value(self.doctype, self.name, "payment_entry", None)
frappe.db.set_value(self.doctype, self.name, "voucher_status", None)
frappe.db.commit()
# pe.delete()
if self.journal_entry:
je = frappe.get_doc("Journal Entry", self.journal_entry)
if je.docstatus == 1:
je.cancel()
frappe.db.set_value(self.doctype, self.name, "journal_entry", None)
frappe.db.set_value(self.doctype, self.name, "voucher_status", None)
frappe.db.commit()
# je.delete()

Expand All @@ -31,6 +33,7 @@ def create_payment_entry(daliy_cash_entry):
"doctype": "Payment Entry",
"payment_type": "Pay",
"mode_of_payment": "Cash",
"custom_daily_cash_entry": doc.name,
"company": company,
"paid_from": frappe.db.get_value("Company", company, "default_cash_account"),
"party_type": doc.paid_type,
Expand All @@ -44,6 +47,7 @@ def create_payment_entry(daliy_cash_entry):
})
payment_entry.insert()
frappe.db.set_value(doc.doctype, doc.name, "payment_entry", payment_entry.name)
frappe.db.set_value(doc.doctype, doc.name, "voucher_status", "Voucher Created")
frappe.db.commit()
return payment_entry

Expand All @@ -56,23 +60,26 @@ def create_journal_entry(daliy_cash_entry):
"company": company,
"posting_date": doc.posting_date,
"user_remark": f"Paid To :{doc.paid_name}, Note:{doc.note}",
"custom_cost_center": doc.cost_center if doc.cost_center else frappe.db.get_value("Company", company, "cost_center"),
"custom_daily_cash_entry": doc.name,
"accounts": [
{
"account": frappe.db.get_value("Company", company, "default_cash_account"),
"debit_in_account_currency": doc.amount,
"debit": doc.amount,
"credit_in_account_currency": doc.amount,
"credit": doc.amount,
"cost_center": doc.cost_center if doc.cost_center else frappe.db.get_value("Company", company, "cost_center"),
},
{
"account": frappe.db.get_value("Company", company, "default_expense_account"),
"credit_in_account_currency": doc.amount,
"credit": doc.amount,
"debit_in_account_currency": doc.amount,
"debit": doc.amount,
"cost_center": doc.cost_center if doc.cost_center else frappe.db.get_value("Company", company, "cost_center"),
}
]
})
journal_entry.insert()
frappe.db.set_value(doc.doctype, doc.name, "journal_entry", journal_entry.name)
frappe.db.set_value(doc.doctype, doc.name, "voucher_status", "Voucher Created")
frappe.db.commit()
return journal_entry

Expand All @@ -83,6 +90,7 @@ def delete_linked_daliy_cash_entry(payment_entry, method):
if dce_name:
dce = frappe.get_doc("Daliy Cash Entry", dce_name)
frappe.db.set_value(dce.doctype, dce.name, "payment_entry", None)
frappe.db.set_value(dce.doctype, dce.name, "voucher_status", None)
frappe.db.commit()
if dce.docstatus == 1:
dce.cancel()
Expand All @@ -93,6 +101,7 @@ def delete_linked_journal_daliy_cash_entry(journal_entry, method):
if dce_name:
dce = frappe.get_doc("Daliy Cash Entry", dce_name)
frappe.db.set_value(dce.doctype, dce.name, "journal_entry", None)
frappe.db.set_value(dce.doctype, dce.name, "voucher_status", None)
frappe.db.commit()
if dce.docstatus == 1:
dce.cancel()
Loading