mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
* fix(Warehouse): add buttons only if the user can use them (cherry picked from commit10ae5aaf52) * fix: missing discount on POS Credit Notes (cherry picked from commit1049550951) * chore: rename test suite for payable report (cherry picked from commit9474f72776) * refactor: test suite for item-wise sales register (cherry picked from commit3aaa22e672) * refactor(test): use each instance UOM for assertion (cherry picked from commitcf4fbfb601) * fix: slowness in reposting dependent vouchers. (backport #42282) (#42292) fix: slowness in reposting dependent vouchers. (#42282) (cherry picked from commitb17696a8ae) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> * refactor(test): clear old records * fix: keep status as In Progress for RIV for Timeout Error (backport #42274) (#42296) fix: keep status as In Progress for RIV for Timeout Error (#42274) (cherry picked from commit10280d6140) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> * fix: cost center filter by company (backport #42297) (#42299) fix: cost center filter by company (#42297) (cherry picked from commit9838f7e6ba) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> * feat: configurable depreciation calculation via accounts settings (#42276) * feat: configurable depreciation calculation via accounts settings * refactor: code optimization * style: changes in description and label (cherry picked from commitb04da63aad) * fix: not able to submit LCV entry (backport #42303) (#42304) fix: not able to submit LCV entry (#42303) (cherry picked from commit9cf92eaeab) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> * fix: While submitting PCV ensure previous FY is closed (backport #42284) (#42300) fix: While submitting PCV ensure previous FY is closed (#42284) (cherry picked from commitd0bbc8ca70) Co-authored-by: Nabin Hait <nabinhait@gmail.com> --------- Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com> Co-authored-by: ruthra kumar <ruthra@erpnext.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> Co-authored-by: Khushi Rawat <142375893+khushi8112@users.noreply.github.com>
63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
import frappe
|
|
from frappe.tests.utils import FrappeTestCase
|
|
from frappe.utils import today
|
|
|
|
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
|
|
from erpnext.accounts.report.accounts_payable.accounts_payable import execute
|
|
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
|
|
|
|
|
|
class TestAccountsPayable(AccountsTestMixin, FrappeTestCase):
|
|
def setUp(self):
|
|
self.create_company()
|
|
self.create_customer()
|
|
self.create_item()
|
|
self.create_supplier(currency="USD", supplier_name="Test Supplier2")
|
|
self.create_usd_payable_account()
|
|
|
|
def tearDown(self):
|
|
frappe.db.rollback()
|
|
|
|
def test_accounts_payable_for_foreign_currency_supplier(self):
|
|
pi = self.create_purchase_invoice(do_not_submit=True)
|
|
pi.currency = "USD"
|
|
pi.conversion_rate = 80
|
|
pi.credit_to = self.creditors_usd
|
|
pi = pi.save().submit()
|
|
|
|
filters = {
|
|
"company": self.company,
|
|
"party_type": "Supplier",
|
|
"party": [self.supplier],
|
|
"report_date": today(),
|
|
"range1": 30,
|
|
"range2": 60,
|
|
"range3": 90,
|
|
"range4": 120,
|
|
"in_party_currency": 1,
|
|
}
|
|
|
|
data = execute(filters)
|
|
self.assertEqual(data[1][0].get("outstanding"), 300)
|
|
self.assertEqual(data[1][0].get("currency"), "USD")
|
|
|
|
def create_purchase_invoice(self, do_not_submit=False):
|
|
frappe.set_user("Administrator")
|
|
pi = make_purchase_invoice(
|
|
item=self.item,
|
|
company=self.company,
|
|
supplier=self.supplier,
|
|
is_return=False,
|
|
update_stock=False,
|
|
posting_date=frappe.utils.datetime.date(2021, 5, 1),
|
|
do_not_save=1,
|
|
rate=300,
|
|
price_list_rate=300,
|
|
qty=1,
|
|
)
|
|
|
|
pi = pi.save()
|
|
if not do_not_submit:
|
|
pi = pi.submit()
|
|
return pi
|