fix: minor changes

This commit is contained in:
Mangesh-Khairnar 2019-04-26 16:02:25 +05:30
parent da7b1673c3
commit 9cd9671bb5
2 changed files with 18 additions and 20 deletions

View File

@ -156,7 +156,6 @@ def get_data():
for po in purchase_order_entry:
# fetch material records linked to the purchase order item
mr_record = mr_records.get(po.material_request_item, [{}])[0]
procurement_detail = {
"material_request_date": mr_record.get('transaction_date', ''),
"cost_center": po.cost_center,
@ -172,11 +171,11 @@ def get_data():
"purchase_order": po.parent,
"supplier": po.supplier,
"estimated_cost": mr_record.get('amount'),
"actual_cost": pi_records.get(po.name, ''),
"actual_cost": pi_records.get(po.name),
"purchase_order_amt": po.amount,
"purchase_order_amt_in_company_currency": po.base_amount,
"expected_delivery_date": po.schedule_date,
"actual_delivery_date": pr_records.get(po.name, {})
"actual_delivery_date": pr_records.get(po.name)
}
procurement_record.append(procurement_detail)
return procurement_record
@ -207,7 +206,7 @@ def get_mapped_mr_details():
material_request_no=record.parent,
estimated_cost=record.amount
)
procurement_record_against_mr.append(procurement_record_details)
procurement_record_against_mr.append(procurement_record_details)
return mr_records, procurement_record_against_mr
def get_mapped_pi_records():

View File

@ -3,48 +3,47 @@
from __future__ import unicode_literals
import unittest
from frappe.utils import nowdate, add_months
from datetime import datetime
import frappe
from erpnext.buying.report.procurement_tracker.procurement_tracker import execute
from erpnext.stock.doctype.material_request.test_material_request import make_material_request
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_purchase_invoice
class TestProcurementTracker(unittest.TestCase):
maxDiff = None
def test_result_for_procurement_tracker(self):
mr = make_material_request()
mr.submit()
po = make_purchase_order(mr.name)
po.supplier = "_Test Supplier"
po.get("items")[0].cost_center = "_Test Cost Center - _TC"
po.get("items")[0].amount = 1000
po.get("items")[0].base_amount = 1000
po.submit()
pr = make_purchase_receipt(po.name)
pr.submit()
pi = make_purchase_invoice(po.name)
pi.submit()
frappe.db.commit()
date_obj = datetime.date(datetime.now())
report = execute()
expected_data = {
"material_request_date": nowdate(),
"material_request_date": date_obj,
"cost_center": "_Test Cost Center - _TC",
"project": '',
"project": None,
"requesting_site": "_Test Warehouse - _TC",
"requestor": "Administrator",
"material_request_no": mr.name,
"description": '_Test Item 1',
"quantity": 10,
"quantity": 10.0,
"unit_of_measurement": "_Test UOM",
"status": "To Receive and Bill",
"purchase_order_date": nowdate(),
"status": "To Bill",
"purchase_order_date": date_obj,
"purchase_order": po.name,
"supplier": "_Test Supplier",
"estimated_cost": 0.0,
"actual_cost": 1000,
"purchase_order_amt": 1000,
"purchase_order_amt_usd": 1000,
"expected_delivery_date": nowdate(),
"actual_delivery_date": nowdate()
"actual_cost": None,
"purchase_order_amt": 0.0,
"purchase_order_amt_in_company_currency": 0.0,
"expected_delivery_date": date_obj,
"actual_delivery_date": date_obj
}
length = len(report[1])
self.assertEqual(expected_data, report[1][length-1])