Merge branch 'develop' into leaderboard
This commit is contained in:
commit
4c3f0b94a4
@ -38,13 +38,13 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "sales_invoice.grand_total",
|
"fetch_from": "sales_invoice.outstanding_amount",
|
||||||
|
"fetch_if_empty": 1,
|
||||||
"fieldname": "outstanding_amount",
|
"fieldname": "outstanding_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Outstanding Amount",
|
"label": "Outstanding Amount",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency"
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_3",
|
"fieldname": "column_break_3",
|
||||||
@ -60,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-08-07 15:13:55.808349",
|
"modified": "2019-09-26 11:05:36.016772",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Discounted Invoice",
|
"name": "Discounted Invoice",
|
||||||
|
@ -97,7 +97,6 @@ frappe.ui.form.on('Invoice Discounting', {
|
|||||||
}
|
}
|
||||||
frm.set_value("total_amount", total_amount);
|
frm.set_value("total_amount", total_amount);
|
||||||
},
|
},
|
||||||
|
|
||||||
get_invoices: (frm) => {
|
get_invoices: (frm) => {
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __('Get Invoices based on Filters'),
|
title: __('Get Invoices based on Filters'),
|
||||||
|
@ -27,13 +27,19 @@ class InvoiceDiscounting(AccountsController):
|
|||||||
|
|
||||||
def validate_invoices(self):
|
def validate_invoices(self):
|
||||||
discounted_invoices = [record.sales_invoice for record in
|
discounted_invoices = [record.sales_invoice for record in
|
||||||
frappe.get_all("Discounted Invoice",fields = ["sales_invoice"], filters= {"docstatus":1})]
|
frappe.get_all("Discounted Invoice",fields=["sales_invoice"], filters={"docstatus":1})]
|
||||||
|
|
||||||
for record in self.invoices:
|
for record in self.invoices:
|
||||||
if record.sales_invoice in discounted_invoices:
|
if record.sales_invoice in discounted_invoices:
|
||||||
frappe.throw("Row({0}): {1} is already discounted in {2}"
|
frappe.throw(_("Row({0}): {1} is already discounted in {2}")
|
||||||
.format(record.idx, frappe.bold(record.sales_invoice), frappe.bold(record.parent)))
|
.format(record.idx, frappe.bold(record.sales_invoice), frappe.bold(record.parent)))
|
||||||
|
|
||||||
|
actual_outstanding = frappe.db.get_value("Sales Invoice", record.sales_invoice,"outstanding_amount")
|
||||||
|
if record.outstanding_amount > actual_outstanding :
|
||||||
|
frappe.throw(_
|
||||||
|
("Row({0}): Outstanding Amount cannot be greater than actual Outstanding Amount {1} in {2}").format(
|
||||||
|
record.idx, frappe.bold(actual_outstanding), frappe.bold(record.sales_invoice)))
|
||||||
|
|
||||||
def calculate_total_amount(self):
|
def calculate_total_amount(self):
|
||||||
self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices])
|
self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user