fix: minor changes
This commit is contained in:
parent
da7b1673c3
commit
9cd9671bb5
@ -156,7 +156,6 @@ def get_data():
|
|||||||
for po in purchase_order_entry:
|
for po in purchase_order_entry:
|
||||||
# fetch material records linked to the purchase order item
|
# fetch material records linked to the purchase order item
|
||||||
mr_record = mr_records.get(po.material_request_item, [{}])[0]
|
mr_record = mr_records.get(po.material_request_item, [{}])[0]
|
||||||
|
|
||||||
procurement_detail = {
|
procurement_detail = {
|
||||||
"material_request_date": mr_record.get('transaction_date', ''),
|
"material_request_date": mr_record.get('transaction_date', ''),
|
||||||
"cost_center": po.cost_center,
|
"cost_center": po.cost_center,
|
||||||
@ -172,11 +171,11 @@ def get_data():
|
|||||||
"purchase_order": po.parent,
|
"purchase_order": po.parent,
|
||||||
"supplier": po.supplier,
|
"supplier": po.supplier,
|
||||||
"estimated_cost": mr_record.get('amount'),
|
"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": po.amount,
|
||||||
"purchase_order_amt_in_company_currency": po.base_amount,
|
"purchase_order_amt_in_company_currency": po.base_amount,
|
||||||
"expected_delivery_date": po.schedule_date,
|
"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)
|
procurement_record.append(procurement_detail)
|
||||||
return procurement_record
|
return procurement_record
|
||||||
@ -207,7 +206,7 @@ def get_mapped_mr_details():
|
|||||||
material_request_no=record.parent,
|
material_request_no=record.parent,
|
||||||
estimated_cost=record.amount
|
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
|
return mr_records, procurement_record_against_mr
|
||||||
|
|
||||||
def get_mapped_pi_records():
|
def get_mapped_pi_records():
|
||||||
|
@ -3,48 +3,47 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import unittest
|
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.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.test_material_request import make_material_request
|
||||||
from erpnext.stock.doctype.material_request.material_request import make_purchase_order
|
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
|
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_purchase_invoice
|
||||||
|
|
||||||
class TestProcurementTracker(unittest.TestCase):
|
class TestProcurementTracker(unittest.TestCase):
|
||||||
|
maxDiff = None
|
||||||
def test_result_for_procurement_tracker(self):
|
def test_result_for_procurement_tracker(self):
|
||||||
mr = make_material_request()
|
mr = make_material_request()
|
||||||
mr.submit()
|
|
||||||
po = make_purchase_order(mr.name)
|
po = make_purchase_order(mr.name)
|
||||||
po.supplier = "_Test Supplier"
|
po.supplier = "_Test Supplier"
|
||||||
po.get("items")[0].cost_center = "_Test Cost Center - _TC"
|
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()
|
po.submit()
|
||||||
pr = make_purchase_receipt(po.name)
|
pr = make_purchase_receipt(po.name)
|
||||||
pr.submit()
|
pr.submit()
|
||||||
pi = make_purchase_invoice(po.name)
|
frappe.db.commit()
|
||||||
pi.submit()
|
date_obj = datetime.date(datetime.now())
|
||||||
|
|
||||||
report = execute()
|
report = execute()
|
||||||
expected_data = {
|
expected_data = {
|
||||||
"material_request_date": nowdate(),
|
"material_request_date": date_obj,
|
||||||
"cost_center": "_Test Cost Center - _TC",
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
"project": '',
|
"project": None,
|
||||||
"requesting_site": "_Test Warehouse - _TC",
|
"requesting_site": "_Test Warehouse - _TC",
|
||||||
"requestor": "Administrator",
|
"requestor": "Administrator",
|
||||||
"material_request_no": mr.name,
|
"material_request_no": mr.name,
|
||||||
"description": '_Test Item 1',
|
"description": '_Test Item 1',
|
||||||
"quantity": 10,
|
"quantity": 10.0,
|
||||||
"unit_of_measurement": "_Test UOM",
|
"unit_of_measurement": "_Test UOM",
|
||||||
"status": "To Receive and Bill",
|
"status": "To Bill",
|
||||||
"purchase_order_date": nowdate(),
|
"purchase_order_date": date_obj,
|
||||||
"purchase_order": po.name,
|
"purchase_order": po.name,
|
||||||
"supplier": "_Test Supplier",
|
"supplier": "_Test Supplier",
|
||||||
"estimated_cost": 0.0,
|
"estimated_cost": 0.0,
|
||||||
"actual_cost": 1000,
|
"actual_cost": None,
|
||||||
"purchase_order_amt": 1000,
|
"purchase_order_amt": 0.0,
|
||||||
"purchase_order_amt_usd": 1000,
|
"purchase_order_amt_in_company_currency": 0.0,
|
||||||
"expected_delivery_date": nowdate(),
|
"expected_delivery_date": date_obj,
|
||||||
"actual_delivery_date": nowdate()
|
"actual_delivery_date": date_obj
|
||||||
}
|
}
|
||||||
length = len(report[1])
|
length = len(report[1])
|
||||||
self.assertEqual(expected_data, report[1][length-1])
|
self.assertEqual(expected_data, report[1][length-1])
|
Loading…
Reference in New Issue
Block a user