Merge branch 'develop' into fix/github-issue/30339
This commit is contained in:
commit
be4593c1d9
@ -569,6 +569,10 @@ frappe.ui.form.on("Purchase Invoice", {
|
|||||||
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
||||||
return erpnext.queries.warehouse(frm.doc);
|
return erpnext.queries.warehouse(frm.doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (frm.is_new()) {
|
||||||
|
frm.clear_table("tax_withheld_vouchers");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
is_subcontracted: function(frm) {
|
is_subcontracted: function(frm) {
|
||||||
|
@ -71,6 +71,9 @@ class PurchaseInvoice(BuyingController):
|
|||||||
supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")
|
supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")
|
||||||
self.set_onload("supplier_tds", supplier_tds)
|
self.set_onload("supplier_tds", supplier_tds)
|
||||||
|
|
||||||
|
if self.is_new():
|
||||||
|
self.set("tax_withheld_vouchers", [])
|
||||||
|
|
||||||
def before_save(self):
|
def before_save(self):
|
||||||
if not self.on_hold:
|
if not self.on_hold:
|
||||||
self.release_date = ""
|
self.release_date = ""
|
||||||
@ -1415,7 +1418,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"Stock Ledger Entry",
|
"Stock Ledger Entry",
|
||||||
"Repost Item Valuation",
|
"Repost Item Valuation",
|
||||||
"Payment Ledger Entry",
|
"Payment Ledger Entry",
|
||||||
"Purchase Invoice",
|
"Tax Withheld Vouchers",
|
||||||
)
|
)
|
||||||
self.update_advance_tax_references(cancel=1)
|
self.update_advance_tax_references(cancel=1)
|
||||||
|
|
||||||
|
@ -965,7 +965,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
pos_return.insert()
|
pos_return.insert()
|
||||||
pos_return.submit()
|
pos_return.submit()
|
||||||
|
|
||||||
self.assertEqual(pos_return.get("payments")[0].amount, -1000)
|
self.assertEqual(pos_return.get("payments")[0].amount, -500)
|
||||||
|
self.assertEqual(pos_return.get("payments")[1].amount, -500)
|
||||||
|
|
||||||
def test_pos_change_amount(self):
|
def test_pos_change_amount(self):
|
||||||
make_pos_profile(
|
make_pos_profile(
|
||||||
|
@ -889,24 +889,33 @@ class calculate_taxes_and_totals(object):
|
|||||||
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
|
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
|
||||||
|
|
||||||
def set_total_amount_to_default_mop(self, total_amount_to_pay):
|
def set_total_amount_to_default_mop(self, total_amount_to_pay):
|
||||||
default_mode_of_payment = frappe.db.get_value(
|
total_paid_amount = 0
|
||||||
"POS Payment Method",
|
for payment in self.doc.get("payments"):
|
||||||
{"parent": self.doc.pos_profile, "default": 1},
|
total_paid_amount += (
|
||||||
["mode_of_payment"],
|
payment.amount if self.doc.party_account_currency == self.doc.currency else payment.base_amount
|
||||||
as_dict=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
if default_mode_of_payment:
|
|
||||||
self.doc.payments = []
|
|
||||||
self.doc.append(
|
|
||||||
"payments",
|
|
||||||
{
|
|
||||||
"mode_of_payment": default_mode_of_payment.mode_of_payment,
|
|
||||||
"amount": total_amount_to_pay,
|
|
||||||
"default": 1,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pending_amount = total_amount_to_pay - total_paid_amount
|
||||||
|
|
||||||
|
if pending_amount > 0:
|
||||||
|
default_mode_of_payment = frappe.db.get_value(
|
||||||
|
"POS Payment Method",
|
||||||
|
{"parent": self.doc.pos_profile, "default": 1},
|
||||||
|
["mode_of_payment"],
|
||||||
|
as_dict=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
if default_mode_of_payment:
|
||||||
|
self.doc.payments = []
|
||||||
|
self.doc.append(
|
||||||
|
"payments",
|
||||||
|
{
|
||||||
|
"mode_of_payment": default_mode_of_payment.mode_of_payment,
|
||||||
|
"amount": pending_amount,
|
||||||
|
"default": 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_itemised_tax_breakup_html(doc):
|
def get_itemised_tax_breakup_html(doc):
|
||||||
if not doc.taxes:
|
if not doc.taxes:
|
||||||
|
@ -590,6 +590,7 @@ class TestMaterialRequest(FrappeTestCase):
|
|||||||
mr = frappe.copy_doc(test_records[0])
|
mr = frappe.copy_doc(test_records[0])
|
||||||
mr.material_request_type = "Material Issue"
|
mr.material_request_type = "Material Issue"
|
||||||
mr.submit()
|
mr.submit()
|
||||||
|
frappe.db.value_cache = {}
|
||||||
|
|
||||||
# testing bin value after material request is submitted
|
# testing bin value after material request is submitted
|
||||||
self.assertEqual(_get_requested_qty(), existing_requested_qty - 54.0)
|
self.assertEqual(_get_requested_qty(), existing_requested_qty - 54.0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user