mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-30 02:14:48 +00:00
feat: base payment amount in payment schedule
This commit is contained in:
committed by
Deepesh Garg
parent
d27e663b2a
commit
8288b5a302
@@ -20,10 +20,13 @@
|
|||||||
"discount",
|
"discount",
|
||||||
"section_break_9",
|
"section_break_9",
|
||||||
"payment_amount",
|
"payment_amount",
|
||||||
|
"outstanding",
|
||||||
|
"paid_amount",
|
||||||
"discounted_amount",
|
"discounted_amount",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"outstanding",
|
"base_payment_amount",
|
||||||
"paid_amount"
|
"base_outstanding",
|
||||||
|
"base_paid_amount"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -65,6 +68,7 @@
|
|||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Payment Amount",
|
"label": "Payment Amount",
|
||||||
|
"options": "currency",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -77,7 +81,8 @@
|
|||||||
"depends_on": "paid_amount",
|
"depends_on": "paid_amount",
|
||||||
"fieldname": "paid_amount",
|
"fieldname": "paid_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Paid Amount"
|
"label": "Paid Amount",
|
||||||
|
"options": "currency"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_3",
|
"fieldname": "column_break_3",
|
||||||
@@ -96,6 +101,7 @@
|
|||||||
"fieldname": "outstanding",
|
"fieldname": "outstanding",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Outstanding",
|
"label": "Outstanding",
|
||||||
|
"options": "currency",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -144,12 +150,34 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "section_break_4",
|
"fieldname": "section_break_4",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "base_payment_amount",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Payment Amount (Company Currency)",
|
||||||
|
"options": "Company:company:default_currency"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "base_outstanding",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Outstanding (Company Currency)",
|
||||||
|
"options": "Company:company:default_currency",
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "base_paid_amount",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Paid Amount (Company Currency)",
|
||||||
|
"options": "Company:company:default_currency",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-04-12 15:39:47.363609",
|
"modified": "2021-04-23 13:55:59.548043",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Schedule",
|
"name": "Payment Schedule",
|
||||||
|
|||||||
@@ -911,7 +911,9 @@ class AccountsController(TransactionBase):
|
|||||||
for d in self.get("payment_schedule"):
|
for d in self.get("payment_schedule"):
|
||||||
if d.invoice_portion:
|
if d.invoice_portion:
|
||||||
d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
|
d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
|
||||||
|
d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
|
||||||
d.outstanding = d.payment_amount
|
d.outstanding = d.payment_amount
|
||||||
|
d.base_outstanding = d.base_payment_amount
|
||||||
|
|
||||||
def set_due_date(self):
|
def set_due_date(self):
|
||||||
due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date]
|
due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date]
|
||||||
@@ -950,6 +952,7 @@ class AccountsController(TransactionBase):
|
|||||||
base_total = 0
|
base_total = 0
|
||||||
for d in self.get("payment_schedule"):
|
for d in self.get("payment_schedule"):
|
||||||
total += flt(d.payment_amount)
|
total += flt(d.payment_amount)
|
||||||
|
base_total += flt(d.base_payment_amount)
|
||||||
|
|
||||||
base_grand_total = self.get("base_rounded_total") or self.base_grand_total
|
base_grand_total = self.get("base_rounded_total") or self.base_grand_total
|
||||||
grand_total = self.get("rounded_total") or self.grand_total
|
grand_total = self.get("rounded_total") or self.grand_total
|
||||||
@@ -1231,10 +1234,11 @@ def get_payment_term_details(term, posting_date=None, grand_total=None, base_gra
|
|||||||
term_details.description = term.description
|
term_details.description = term.description
|
||||||
term_details.invoice_portion = term.invoice_portion
|
term_details.invoice_portion = term.invoice_portion
|
||||||
term_details.payment_amount = flt(term.invoice_portion) * flt(grand_total) / 100
|
term_details.payment_amount = flt(term.invoice_portion) * flt(grand_total) / 100
|
||||||
|
term_details.base_payment_amount = flt(term.invoice_portion) * flt(base_grand_total) / 100
|
||||||
term_details.discount_type = term.discount_type
|
term_details.discount_type = term.discount_type
|
||||||
term_details.discount = term.discount
|
term_details.discount = term.discount
|
||||||
# term_details.discounted_amount = flt(grand_total) * (term.discount / 100) if term.discount_type == 'Percentage' else discount
|
|
||||||
term_details.outstanding = term_details.payment_amount
|
term_details.outstanding = term_details.payment_amount
|
||||||
|
term_details.base_outstanding = term_details.base_payment_amount
|
||||||
term_details.mode_of_payment = term.mode_of_payment
|
term_details.mode_of_payment = term.mode_of_payment
|
||||||
|
|
||||||
if bill_date:
|
if bill_date:
|
||||||
|
|||||||
@@ -2013,6 +2013,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
payment_term: function(doc, cdt, cdn) {
|
payment_term: function(doc, cdt, cdn) {
|
||||||
var row = locals[cdt][cdn];
|
var row = locals[cdt][cdn];
|
||||||
if(row.payment_term) {
|
if(row.payment_term) {
|
||||||
|
debugger;
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.controllers.accounts_controller.get_payment_term_details",
|
method: "erpnext.controllers.accounts_controller.get_payment_term_details",
|
||||||
args: {
|
args: {
|
||||||
|
|||||||
Reference in New Issue
Block a user