[Fix] Fetch due date for Sales/Purchase invoice in payment tool
This commit is contained in:
parent
9b6198436b
commit
622fe3f1e3
@ -202,7 +202,7 @@ frappe.ui.form.on("Payment Tool Detail", "against_voucher_no", function(frm, cdt
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_amount',
|
||||
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_details',
|
||||
args: {
|
||||
"against_voucher_type": row.against_voucher_type,
|
||||
"against_voucher_no": row.against_voucher_no,
|
||||
|
@ -20,15 +20,15 @@ class PaymentTool(Document):
|
||||
jv.company = self.company
|
||||
jv.cheque_no = self.reference_no
|
||||
jv.cheque_date = self.reference_date
|
||||
|
||||
party_account_currency, party_account_type = frappe.db.get_value("Account", self.party_account,
|
||||
|
||||
party_account_currency, party_account_type = frappe.db.get_value("Account", self.party_account,
|
||||
["account_currency", "account_type"])
|
||||
|
||||
|
||||
bank_account_currency, bank_account_type = None, None
|
||||
if self.payment_account:
|
||||
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
|
||||
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
|
||||
["account_currency", "account_type"])
|
||||
|
||||
|
||||
if not self.total_payment_amount:
|
||||
frappe.throw(_("Please enter Payment Amount in atleast one row"))
|
||||
|
||||
@ -36,11 +36,11 @@ class PaymentTool(Document):
|
||||
if not frappe.db.get_value(v.against_voucher_type, {"name": v.against_voucher_no}):
|
||||
frappe.throw(_("Row {0}: {1} is not a valid {2}").format(v.idx, v.against_voucher_no,
|
||||
v.against_voucher_type))
|
||||
|
||||
|
||||
if v.payment_amount:
|
||||
exchange_rate = get_exchange_rate(self.party_account, party_account_currency,
|
||||
self.company, v.against_voucher_type, v.against_voucher_no)
|
||||
|
||||
|
||||
d1 = jv.append("accounts")
|
||||
d1.account = self.party_account
|
||||
d1.party_type = self.party_type
|
||||
@ -56,7 +56,7 @@ class PaymentTool(Document):
|
||||
d1.reference_name = v.against_voucher_no
|
||||
d1.is_advance = 'Yes' \
|
||||
if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No'
|
||||
|
||||
|
||||
amount = flt(d1.debit_in_account_currency) - flt(d1.credit_in_account_currency)
|
||||
if bank_account_currency == party_account_currency:
|
||||
total_payment_amount += amount
|
||||
@ -65,27 +65,27 @@ class PaymentTool(Document):
|
||||
|
||||
d2 = jv.append("accounts")
|
||||
if self.payment_account:
|
||||
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
|
||||
bank_account_currency, bank_account_type = frappe.db.get_value("Account", self.payment_account,
|
||||
["account_currency", "account_type"])
|
||||
|
||||
|
||||
d2.account = self.payment_account
|
||||
d2.account_currency = bank_account_currency
|
||||
d2.account_type = bank_account_type
|
||||
d2.exchange_rate = get_exchange_rate(self.payment_account, bank_account_currency, self.company,
|
||||
debit=(abs(total_payment_amount) if total_payment_amount < 0 else 0),
|
||||
d2.exchange_rate = get_exchange_rate(self.payment_account, bank_account_currency, self.company,
|
||||
debit=(abs(total_payment_amount) if total_payment_amount < 0 else 0),
|
||||
credit=(total_payment_amount if total_payment_amount > 0 else 0))
|
||||
d2.account_balance = get_balance_on(self.payment_account)
|
||||
|
||||
|
||||
amount_field_bank = 'debit_in_account_currency' if total_payment_amount < 0 \
|
||||
else 'credit_in_account_currency'
|
||||
|
||||
|
||||
d2.set(amount_field_bank, abs(total_payment_amount))
|
||||
|
||||
|
||||
company_currency = frappe.db.get_value("Company", self.company, "default_currency")
|
||||
if party_account_currency != company_currency or \
|
||||
(bank_account_currency and bank_account_currency != company_currency):
|
||||
jv.multi_currency = 1
|
||||
|
||||
|
||||
jv.set_amounts_in_company_currency()
|
||||
jv.set_total_debit_credit()
|
||||
|
||||
@ -150,7 +150,7 @@ def get_orders_to_be_billed(party_type, party, party_account_currency, company_c
|
||||
return order_list
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_against_voucher_amount(against_voucher_type, against_voucher_no, party_account, company):
|
||||
def get_against_voucher_details(against_voucher_type, against_voucher_no, party_account, company):
|
||||
party_account_currency = get_account_currency(party_account)
|
||||
company_currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
ref_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
|
||||
|
@ -16,6 +16,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Against Voucher Type",
|
||||
@ -24,6 +25,7 @@
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
@ -41,6 +43,7 @@
|
||||
"fieldtype": "Dynamic Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Against Voucher No",
|
||||
@ -49,6 +52,7 @@
|
||||
"options": "against_voucher_type",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -56,6 +60,31 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "due_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Due Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -64,6 +93,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
@ -71,6 +101,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -86,6 +117,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Total Amount",
|
||||
@ -94,6 +126,7 @@
|
||||
"options": "party_account_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -109,6 +142,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Outstanding Amount",
|
||||
@ -117,6 +151,7 @@
|
||||
"options": "party_account_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@ -132,6 +167,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Payment Amount",
|
||||
@ -140,6 +176,7 @@
|
||||
"options": "party_account_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@ -150,13 +187,14 @@
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:51.626386",
|
||||
"modified": "2016-05-05 05:37:41.206708",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Tool Detail",
|
||||
|
Loading…
x
Reference in New Issue
Block a user