[bug][fix]: set status to object instead of variable (#20790)
This commit is contained in:
parent
eb2f79b16e
commit
19df2ffbd8
@ -149,6 +149,49 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", pi.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 0)
|
||||
|
||||
|
||||
def test_payment_against_sales_invoice_to_check_status(self):
|
||||
si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
|
||||
currency="USD", conversion_rate=50)
|
||||
|
||||
pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC")
|
||||
pe.reference_no = "1"
|
||||
pe.reference_date = "2016-01-01"
|
||||
pe.target_exchange_rate = 50
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 0)
|
||||
self.assertEqual(si.status, 'Paid')
|
||||
|
||||
pe.cancel()
|
||||
|
||||
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 100)
|
||||
self.assertEqual(si.status, 'Unpaid')
|
||||
|
||||
def test_payment_against_purchase_invoice_to_check_status(self):
|
||||
pi = make_purchase_invoice(supplier="_Test Supplier USD", debit_to="_Test Payable USD - _TC",
|
||||
currency="USD", conversion_rate=50)
|
||||
|
||||
pe = get_payment_entry("Purchase Invoice", pi.name, bank_account="_Test Bank USD - _TC")
|
||||
pe.reference_no = "1"
|
||||
pe.reference_date = "2016-01-01"
|
||||
pe.source_exchange_rate = 50
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
outstanding_amount = flt(frappe.db.get_value("Purchase Invoice", pi.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 0)
|
||||
self.assertEqual(pi.status, 'Paid')
|
||||
|
||||
pe.cancel()
|
||||
|
||||
outstanding_amount = flt(frappe.db.get_value("Purchase Invoice", pi.name, "outstanding_amount"))
|
||||
self.assertEqual(outstanding_amount, 100)
|
||||
self.assertEqual(pi.status, 'Unpaid')
|
||||
|
||||
def test_payment_entry_against_ec(self):
|
||||
|
||||
payable = frappe.get_cached_value('Company', "_Test Company", 'default_payable_account')
|
||||
|
@ -141,10 +141,10 @@ class PurchaseInvoice(BuyingController):
|
||||
self.docstatus,
|
||||
precision
|
||||
]
|
||||
status = get_status(args)
|
||||
self.status = get_status(args)
|
||||
|
||||
if update:
|
||||
self.db_set('status', status, update_modified = update_modified)
|
||||
self.db_set('status', self.status, update_modified = update_modified)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
if not self.credit_to:
|
||||
|
@ -1234,10 +1234,10 @@ class SalesInvoice(SellingController):
|
||||
self.docstatus,
|
||||
precision,
|
||||
]
|
||||
status = get_status(args)
|
||||
self.status = get_status(args)
|
||||
|
||||
if update:
|
||||
self.db_set('status', status, update_modified = update_modified)
|
||||
self.db_set('status', self.status, update_modified = update_modified)
|
||||
|
||||
def get_discounting_status(sales_invoice):
|
||||
status = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user