Merge branch 'develop' of https://github.com/frappe/erpnext into deferred_revenue_multi_currency_jv
This commit is contained in:
commit
2aea078699
@ -117,6 +117,11 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
|||||||
"label": __("Show Future Payments"),
|
"label": __("Show Future Payments"),
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"show_gl_balance",
|
||||||
|
"label": __("Show GL Balance"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
onload: function(report) {
|
onload: function(report) {
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, scrub
|
from frappe import _, scrub
|
||||||
from frappe.utils import cint
|
from frappe.utils import cint, flt
|
||||||
|
from six import iteritems
|
||||||
|
|
||||||
from erpnext.accounts.party import get_partywise_advanced_payment_amount
|
from erpnext.accounts.party import get_partywise_advanced_payment_amount
|
||||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||||
@ -36,7 +37,10 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
|
party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
|
||||||
self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {}
|
self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {}
|
||||||
|
|
||||||
for party, party_dict in self.party_total.items():
|
if self.filters.show_gl_balance:
|
||||||
|
gl_balance_map = get_gl_balance(self.filters.report_date)
|
||||||
|
|
||||||
|
for party, party_dict in iteritems(self.party_total):
|
||||||
if party_dict.outstanding == 0:
|
if party_dict.outstanding == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -55,6 +59,10 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
# but in summary report advance shown in separate column
|
# but in summary report advance shown in separate column
|
||||||
row.paid -= row.advance
|
row.paid -= row.advance
|
||||||
|
|
||||||
|
if self.filters.show_gl_balance:
|
||||||
|
row.gl_balance = gl_balance_map.get(party)
|
||||||
|
row.diff = flt(row.outstanding) - flt(row.gl_balance)
|
||||||
|
|
||||||
self.data.append(row)
|
self.data.append(row)
|
||||||
|
|
||||||
def get_party_total(self, args):
|
def get_party_total(self, args):
|
||||||
@ -114,6 +122,10 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
self.add_column(_(credit_debit_label), fieldname='credit_note')
|
self.add_column(_(credit_debit_label), fieldname='credit_note')
|
||||||
self.add_column(_('Outstanding Amount'), fieldname='outstanding')
|
self.add_column(_('Outstanding Amount'), fieldname='outstanding')
|
||||||
|
|
||||||
|
if self.filters.show_gl_balance:
|
||||||
|
self.add_column(_('GL Balance'), fieldname='gl_balance')
|
||||||
|
self.add_column(_('Difference'), fieldname='diff')
|
||||||
|
|
||||||
self.setup_ageing_columns()
|
self.setup_ageing_columns()
|
||||||
|
|
||||||
if self.party_type == "Customer":
|
if self.party_type == "Customer":
|
||||||
@ -140,3 +152,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
|
|
||||||
# Add column for total due amount
|
# Add column for total due amount
|
||||||
self.add_column(label="Total Amount Due", fieldname='total_due')
|
self.add_column(label="Total Amount Due", fieldname='total_due')
|
||||||
|
|
||||||
|
def get_gl_balance(report_date):
|
||||||
|
return frappe._dict(frappe.db.get_all("GL Entry", fields=['party', 'sum(debit - credit)'],
|
||||||
|
filters={'posting_date': ("<=", report_date), 'is_cancelled': 0}, group_by='party', as_list=1))
|
||||||
|
@ -113,7 +113,7 @@ class AccountsController(TransactionBase):
|
|||||||
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
_('{0} is blocked so this transaction cannot proceed').format(supplier_name), raise_exception=1)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.get('is_return'):
|
if not self.get('is_return') and not self.get('is_debit_note'):
|
||||||
self.validate_qty_is_not_zero()
|
self.validate_qty_is_not_zero()
|
||||||
|
|
||||||
if self.get("_action") and self._action != "update_after_submit":
|
if self.get("_action") and self._action != "update_after_submit":
|
||||||
|
@ -139,6 +139,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
|
|
||||||
if not item.qty and self.doc.get("is_return"):
|
if not item.qty and self.doc.get("is_return"):
|
||||||
item.amount = flt(-1 * item.rate, item.precision("amount"))
|
item.amount = flt(-1 * item.rate, item.precision("amount"))
|
||||||
|
elif not item.qty and self.doc.get("is_debit_note"):
|
||||||
|
item.amount = flt(item.rate, item.precision("amount"))
|
||||||
else:
|
else:
|
||||||
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
item.amount = flt(item.rate * item.qty, item.precision("amount"))
|
||||||
|
|
||||||
|
@ -165,7 +165,6 @@ erpnext.patches.v12_0.set_updated_purpose_in_pick_list
|
|||||||
erpnext.patches.v12_0.set_default_payroll_based_on
|
erpnext.patches.v12_0.set_default_payroll_based_on
|
||||||
erpnext.patches.v12_0.repost_stock_ledger_entries_for_target_warehouse
|
erpnext.patches.v12_0.repost_stock_ledger_entries_for_target_warehouse
|
||||||
erpnext.patches.v12_0.update_end_date_and_status_in_email_campaign
|
erpnext.patches.v12_0.update_end_date_and_status_in_email_campaign
|
||||||
erpnext.patches.v13_0.validate_options_for_data_field
|
|
||||||
erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123
|
erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123
|
||||||
erpnext.patches.v12_0.fix_quotation_expired_status
|
erpnext.patches.v12_0.fix_quotation_expired_status
|
||||||
erpnext.patches.v12_0.rename_pos_closing_doctype
|
erpnext.patches.v12_0.rename_pos_closing_doctype
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
# Copyright (c) 2021, Frappe and Contributors
|
|
||||||
# License: GNU General Public License v3. See license.txt
|
|
||||||
|
|
||||||
|
|
||||||
import frappe
|
|
||||||
from frappe.model import data_field_options
|
|
||||||
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
|
|
||||||
for field in frappe.get_all('Custom Field',
|
|
||||||
fields = ['name'],
|
|
||||||
filters = {
|
|
||||||
'fieldtype': 'Data',
|
|
||||||
'options': ['!=', None]
|
|
||||||
}):
|
|
||||||
|
|
||||||
if field not in data_field_options:
|
|
||||||
frappe.db.sql("""
|
|
||||||
UPDATE
|
|
||||||
`tabCustom Field`
|
|
||||||
SET
|
|
||||||
options=NULL
|
|
||||||
WHERE
|
|
||||||
name=%s
|
|
||||||
""", (field))
|
|
@ -114,6 +114,8 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
|
|
||||||
if ((!item.qty) && me.frm.doc.is_return) {
|
if ((!item.qty) && me.frm.doc.is_return) {
|
||||||
item.amount = flt(item.rate * -1, precision("amount", item));
|
item.amount = flt(item.rate * -1, precision("amount", item));
|
||||||
|
} else if ((!item.qty) && me.frm.doc.is_debit_note) {
|
||||||
|
item.amount = flt(item.rate, precision("amount", item));
|
||||||
} else {
|
} else {
|
||||||
item.amount = flt(item.rate * item.qty, precision("amount", item));
|
item.amount = flt(item.rate * item.qty, precision("amount", item));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user