fix: Remove irrelevant code

This commit is contained in:
GangaManoj 2021-08-05 00:28:42 +05:30
parent 8328f45230
commit 23c104555b
2 changed files with 0 additions and 57 deletions

View File

@ -1142,36 +1142,6 @@ class PurchaseInvoice(BuyingController):
if update:
self.db_set('status', self.status, update_modified = update_modified)
# to get details of purchase invoice/receipt from which this doc was created for exchange rate difference handling
def get_purchase_document_details(doc):
if doc.doctype == 'Purchase Invoice':
doc_reference = 'purchase_receipt'
items_reference = 'pr_detail'
parent_doctype = 'Purchase Receipt'
child_doctype = 'Purchase Receipt Item'
else:
doc_reference = 'purchase_invoice'
items_reference = 'purchase_invoice_item'
parent_doctype = 'Purchase Invoice'
child_doctype = 'Purchase Invoice Item'
purchase_receipts_or_invoices = []
items = []
for item in doc.get('items'):
if item.get(doc_reference):
purchase_receipts_or_invoices.append(item.get(doc_reference))
if item.get(items_reference):
items.append(item.get(items_reference))
exchange_rate_map = frappe._dict(frappe.get_all(parent_doctype, filters={'name': ('in',
purchase_receipts_or_invoices)}, fields=['name', 'conversion_rate'], as_list=1))
net_rate_map = frappe._dict(frappe.get_all(child_doctype, filters={'name': ('in',
items)}, fields=['name', 'net_rate'], as_list=1))
return exchange_rate_map, net_rate_map
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)

View File

@ -1052,33 +1052,6 @@ class TestPurchaseReceipt(unittest.TestCase):
frappe.db.set_value('Company', company, 'enable_perpetual_inventory_for_non_stock_items', before_test_value)
def test_purchase_receipt_with_exchange_rate_difference(self):
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice as create_purchase_invoice
from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import make_purchase_receipt as create_purchase_receipt
pi = create_purchase_invoice(company="_Test Company with perpetual inventory",
cost_center = "Main - TCP1",
warehouse = "Stores - TCP1",
expense_account ="_Test Account Cost for Goods Sold - TCP1",
currency = "USD", conversion_rate = 70)
pr = create_purchase_receipt(pi.name)
pr.conversion_rate = 80
pr.items[0].purchase_invoice = pi.name
pr.items[0].purchase_invoice_item = pi.items[0].name
pr.save()
pr.submit()
# Get exchnage gain and loss account
exchange_gain_loss_account = frappe.db.get_value('Company', pr.company, 'exchange_gain_loss_account')
# fetching the latest GL Entry with exchange gain and loss account account
amount = frappe.db.get_value('GL Entry', {'account': exchange_gain_loss_account, 'voucher_no': pr.name}, 'credit')
discrepancy_caused_by_exchange_rate_diff = abs(pi.items[0].base_net_amount - pr.items[0].base_net_amount)
self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice