Merge branch 'develop' into fix-22-23-05690
This commit is contained in:
commit
4cd16a839b
@ -495,26 +495,22 @@ def get_amount(ref_doc, payment_account=None):
|
|||||||
"""get amount based on doctype"""
|
"""get amount based on doctype"""
|
||||||
dt = ref_doc.doctype
|
dt = ref_doc.doctype
|
||||||
if dt in ["Sales Order", "Purchase Order"]:
|
if dt in ["Sales Order", "Purchase Order"]:
|
||||||
grand_total = flt(ref_doc.rounded_total) - flt(ref_doc.advance_paid)
|
grand_total = flt(ref_doc.rounded_total) or flt(ref_doc.grand_total)
|
||||||
|
|
||||||
elif dt in ["Sales Invoice", "Purchase Invoice"]:
|
elif dt in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
if ref_doc.party_account_currency == ref_doc.currency:
|
if ref_doc.party_account_currency == ref_doc.currency:
|
||||||
grand_total = flt(ref_doc.outstanding_amount)
|
grand_total = flt(ref_doc.outstanding_amount)
|
||||||
else:
|
else:
|
||||||
grand_total = flt(ref_doc.outstanding_amount) / ref_doc.conversion_rate
|
grand_total = flt(ref_doc.outstanding_amount) / ref_doc.conversion_rate
|
||||||
|
|
||||||
elif dt == "POS Invoice":
|
elif dt == "POS Invoice":
|
||||||
for pay in ref_doc.payments:
|
for pay in ref_doc.payments:
|
||||||
if pay.type == "Phone" and pay.account == payment_account:
|
if pay.type == "Phone" and pay.account == payment_account:
|
||||||
grand_total = pay.amount
|
grand_total = pay.amount
|
||||||
break
|
break
|
||||||
|
|
||||||
elif dt == "Fees":
|
elif dt == "Fees":
|
||||||
grand_total = ref_doc.outstanding_amount
|
grand_total = ref_doc.outstanding_amount
|
||||||
|
|
||||||
if grand_total > 0:
|
if grand_total > 0:
|
||||||
return grand_total
|
return grand_total
|
||||||
|
|
||||||
else:
|
else:
|
||||||
frappe.throw(_("Payment Entry is already created"))
|
frappe.throw(_("Payment Entry is already created"))
|
||||||
|
|
||||||
|
@ -45,7 +45,10 @@ class TestPaymentRequest(unittest.TestCase):
|
|||||||
frappe.get_doc(method).insert(ignore_permissions=True)
|
frappe.get_doc(method).insert(ignore_permissions=True)
|
||||||
|
|
||||||
def test_payment_request_linkings(self):
|
def test_payment_request_linkings(self):
|
||||||
so_inr = make_sales_order(currency="INR")
|
so_inr = make_sales_order(currency="INR", do_not_save=True)
|
||||||
|
so_inr.disable_rounded_total = 1
|
||||||
|
so_inr.save()
|
||||||
|
|
||||||
pr = make_payment_request(
|
pr = make_payment_request(
|
||||||
dt="Sales Order",
|
dt="Sales Order",
|
||||||
dn=so_inr.name,
|
dn=so_inr.name,
|
||||||
|
@ -84,6 +84,9 @@ class SellingController(StockController):
|
|||||||
)
|
)
|
||||||
if not self.meta.get_field("sales_team"):
|
if not self.meta.get_field("sales_team"):
|
||||||
party_details.pop("sales_team")
|
party_details.pop("sales_team")
|
||||||
|
else:
|
||||||
|
self.set("sales_team", party_details.get("sales_team"))
|
||||||
|
|
||||||
self.update_if_missing(party_details)
|
self.update_if_missing(party_details)
|
||||||
|
|
||||||
elif lead:
|
elif lead:
|
||||||
@ -136,7 +139,7 @@ class SellingController(StockController):
|
|||||||
self.in_words = money_in_words(amount, self.currency)
|
self.in_words = money_in_words(amount, self.currency)
|
||||||
|
|
||||||
def calculate_commission(self):
|
def calculate_commission(self):
|
||||||
if not self.meta.get_field("commission_rate"):
|
if not self.meta.get_field("commission_rate") or self.docstatus.is_submitted():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.round_floats_in(self, ("amount_eligible_for_commission", "commission_rate"))
|
self.round_floats_in(self, ("amount_eligible_for_commission", "commission_rate"))
|
||||||
|
@ -253,7 +253,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculate_commission() {
|
calculate_commission() {
|
||||||
if(!this.frm.fields_dict.commission_rate) return;
|
if(!this.frm.fields_dict.commission_rate || this.frm.doc.docstatus === 1) return;
|
||||||
|
|
||||||
if(this.frm.doc.commission_rate > 100) {
|
if(this.frm.doc.commission_rate > 100) {
|
||||||
this.frm.set_value("commission_rate", 100);
|
this.frm.set_value("commission_rate", 100);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user