fix: add filters to account link fields in Non Profit Settings
- fetch memberships ordered by date in certificate
This commit is contained in:
parent
a54eecb230
commit
04c0296558
@ -42,7 +42,7 @@ class Donation(Document):
|
||||
self.load_from_db()
|
||||
self.create_payment_entry()
|
||||
|
||||
def create_payment_entry(self):
|
||||
def create_payment_entry(self, date=None):
|
||||
settings = frappe.get_doc('Non Profit Settings')
|
||||
if not settings.automate_donation_payment_entries:
|
||||
return
|
||||
@ -58,8 +58,9 @@ class Donation(Document):
|
||||
frappe.flags.ignore_account_permission = False
|
||||
pe.paid_from = settings.donation_debit_account
|
||||
pe.paid_to = settings.donation_payment_account
|
||||
pe.posting_date = date or getdate()
|
||||
pe.reference_no = self.name
|
||||
pe.reference_date = getdate()
|
||||
pe.reference_date = date or getdate()
|
||||
pe.flags.ignore_mandatory = True
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
@ -19,7 +19,7 @@ frappe.ui.form.on("Non Profit Settings", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("debit_account", function() {
|
||||
frm.set_query("membership_debit_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"account_type": "Receivable",
|
||||
@ -29,6 +29,16 @@ frappe.ui.form.on("Non Profit Settings", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("donation_debit_account", function() {
|
||||
return {
|
||||
filters: {
|
||||
"account_type": "Receivable",
|
||||
"is_group": 0,
|
||||
"company": frm.doc.donation_company
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("membership_payment_account", function () {
|
||||
var account_types = ["Bank", "Cash"];
|
||||
return {
|
||||
@ -40,6 +50,17 @@ frappe.ui.form.on("Non Profit Settings", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("donation_payment_account", function () {
|
||||
var account_types = ["Bank", "Cash"];
|
||||
return {
|
||||
filters: {
|
||||
"account_type": ["in", account_types],
|
||||
"is_group": 0,
|
||||
"company": frm.doc.donation_company
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let docs_url = "https://docs.erpnext.com/docs/user/manual/en/non_profit/membership";
|
||||
|
||||
frm.set_intro(__("You can learn more about memberships in the manual. ") + `<a href='${docs_url}'>${__('ERPNext Docs')}</a>`, true);
|
||||
|
@ -81,7 +81,7 @@ class TaxExemption80GCertificate(Document):
|
||||
'from_date': ['between', (fiscal_year.year_start_date, fiscal_year.year_end_date)],
|
||||
'to_date': ['between', (fiscal_year.year_start_date, fiscal_year.year_end_date)],
|
||||
'membership_status': ('!=', 'Cancelled')
|
||||
}, ['from_date', 'amount', 'name', 'invoice', 'payment_id'])
|
||||
}, ['from_date', 'amount', 'name', 'invoice', 'payment_id'], order_by='from_date')
|
||||
|
||||
if not memberships:
|
||||
frappe.msgprint(_('No Membership Payments found against the Member {0}').format(self.member))
|
||||
|
Loading…
x
Reference in New Issue
Block a user