Merge pull request #30453 from rahib-hassan/fix-paymentorder-row-delete
fix: enable row deletion in reference table
This commit is contained in:
commit
5408980223
@ -12,7 +12,6 @@ frappe.ui.form.on('Payment Order', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frm.set_df_property('references', 'cannot_add_rows', true);
|
frm.set_df_property('references', 'cannot_add_rows', true);
|
||||||
frm.set_df_property('references', 'cannot_delete_rows', true);
|
|
||||||
},
|
},
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
if (frm.doc.docstatus == 0) {
|
if (frm.doc.docstatus == 0) {
|
||||||
|
|||||||
@ -53,6 +53,22 @@ frappe.query_reports["Accounts Payable"] = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "party_account",
|
||||||
|
"label": __("Payable Account"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Account",
|
||||||
|
get_query: () => {
|
||||||
|
var company = frappe.query_report.get_filter_value('company');
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'company': company,
|
||||||
|
'account_type': 'Payable',
|
||||||
|
'is_group': 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "ageing_based_on",
|
"fieldname": "ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
|
|||||||
@ -66,6 +66,22 @@ frappe.query_reports["Accounts Receivable"] = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "party_account",
|
||||||
|
"label": __("Receivable Account"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Account",
|
||||||
|
get_query: () => {
|
||||||
|
var company = frappe.query_report.get_filter_value('company');
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'company': company,
|
||||||
|
'account_type': 'Receivable',
|
||||||
|
'is_group': 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "ageing_based_on",
|
"fieldname": "ageing_based_on",
|
||||||
"label": __("Ageing Based On"),
|
"label": __("Ageing Based On"),
|
||||||
|
|||||||
@ -111,6 +111,7 @@ class ReceivablePayableReport(object):
|
|||||||
voucher_type=gle.voucher_type,
|
voucher_type=gle.voucher_type,
|
||||||
voucher_no=gle.voucher_no,
|
voucher_no=gle.voucher_no,
|
||||||
party=gle.party,
|
party=gle.party,
|
||||||
|
party_account=gle.account,
|
||||||
posting_date=gle.posting_date,
|
posting_date=gle.posting_date,
|
||||||
account_currency=gle.account_currency,
|
account_currency=gle.account_currency,
|
||||||
remarks=gle.remarks if self.filters.get("show_remarks") else None,
|
remarks=gle.remarks if self.filters.get("show_remarks") else None,
|
||||||
@ -777,18 +778,22 @@ class ReceivablePayableReport(object):
|
|||||||
conditions.append("party=%s")
|
conditions.append("party=%s")
|
||||||
values.append(self.filters.get(party_type_field))
|
values.append(self.filters.get(party_type_field))
|
||||||
|
|
||||||
# get GL with "receivable" or "payable" account_type
|
if self.filters.party_account:
|
||||||
account_type = "Receivable" if self.party_type == "Customer" else "Payable"
|
conditions.append("account =%s")
|
||||||
accounts = [
|
values.append(self.filters.party_account)
|
||||||
d.name
|
else:
|
||||||
for d in frappe.get_all(
|
# get GL with "receivable" or "payable" account_type
|
||||||
"Account", filters={"account_type": account_type, "company": self.filters.company}
|
account_type = "Receivable" if self.party_type == "Customer" else "Payable"
|
||||||
)
|
accounts = [
|
||||||
]
|
d.name
|
||||||
|
for d in frappe.get_all(
|
||||||
|
"Account", filters={"account_type": account_type, "company": self.filters.company}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
if accounts:
|
if accounts:
|
||||||
conditions.append("account in (%s)" % ",".join(["%s"] * len(accounts)))
|
conditions.append("account in (%s)" % ",".join(["%s"] * len(accounts)))
|
||||||
values += accounts
|
values += accounts
|
||||||
|
|
||||||
def add_customer_filters(self, conditions, values):
|
def add_customer_filters(self, conditions, values):
|
||||||
if self.filters.get("customer_group"):
|
if self.filters.get("customer_group"):
|
||||||
@ -888,6 +893,13 @@ class ReceivablePayableReport(object):
|
|||||||
options=self.party_type,
|
options=self.party_type,
|
||||||
width=180,
|
width=180,
|
||||||
)
|
)
|
||||||
|
self.add_column(
|
||||||
|
label="Receivable Account" if self.party_type == "Customer" else "Payable Account",
|
||||||
|
fieldname="party_account",
|
||||||
|
fieldtype="Link",
|
||||||
|
options="Account",
|
||||||
|
width=180,
|
||||||
|
)
|
||||||
|
|
||||||
if self.party_naming_by == "Naming Series":
|
if self.party_naming_by == "Naming Series":
|
||||||
self.add_column(
|
self.add_column(
|
||||||
|
|||||||
@ -50,12 +50,19 @@ class TestAccountsReceivable(unittest.TestCase):
|
|||||||
make_credit_note(name)
|
make_credit_note(name)
|
||||||
report = execute(filters)
|
report = execute(filters)
|
||||||
|
|
||||||
expected_data_after_credit_note = [100, 0, 0, 40, -40]
|
expected_data_after_credit_note = [100, 0, 0, 40, -40, "Debtors - _TC2"]
|
||||||
|
|
||||||
row = report[1][0]
|
row = report[1][0]
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_data_after_credit_note,
|
expected_data_after_credit_note,
|
||||||
[row.invoice_grand_total, row.invoiced, row.paid, row.credit_note, row.outstanding],
|
[
|
||||||
|
row.invoice_grand_total,
|
||||||
|
row.invoiced,
|
||||||
|
row.paid,
|
||||||
|
row.credit_note,
|
||||||
|
row.outstanding,
|
||||||
|
row.party_account,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user