mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
commonified some purchase code, added test case for auto inventory accounting for purchase invoice
This commit is contained in:
@@ -89,16 +89,6 @@ class DocType(BuyingController):
|
||||
webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
|
||||
Please enter a valid Challan No.", raise_exception=1)
|
||||
|
||||
|
||||
# update valuation rate
|
||||
def update_valuation_rate(self):
|
||||
for d in self.doclist.get({"parentfield": "purchase_receipt_details"}):
|
||||
if d.qty:
|
||||
d.valuation_rate = (flt(d.purchase_rate) + flt(d.item_tax_amount)/flt(d.qty)
|
||||
+ flt(d.rm_supp_cost) / flt(d.qty)) / flt(d.conversion_factor)
|
||||
else:
|
||||
d.valuation_rate = 0.0
|
||||
|
||||
#check in manage account if purchase order required or not.
|
||||
# ====================================================================================
|
||||
def po_required(self):
|
||||
@@ -134,8 +124,7 @@ class DocType(BuyingController):
|
||||
pc_obj.validate_reference_value(self)
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# update valuation rate
|
||||
self.update_valuation_rate()
|
||||
self.update_valuation_rate("purchase_receipt_details")
|
||||
|
||||
|
||||
# On Update
|
||||
|
||||
@@ -36,7 +36,6 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
|
||||
def test_purchase_receipt_gl_entry(self):
|
||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
||||
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_inventory_accounting")), 1)
|
||||
|
||||
pr = webnotes.bean(copy=test_records[0])
|
||||
@@ -47,7 +46,6 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||
from `tabGL Entry` where voucher_type='Purchase Receipt' and voucher_no=%s
|
||||
order by account desc""", pr.doc.name, as_dict=1)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
stock_in_hand_account = webnotes.conn.get_value("Company", pr.doc.company,
|
||||
|
||||
Reference in New Issue
Block a user