fix: corrected mismatch in the Purchase Receipt Status #15620 (#42138)

This commit is contained in:
Poorvi-R-Bhat
2024-07-09 14:59:31 +05:30
committed by GitHub
parent ad137250fc
commit 623b4c21cd
3 changed files with 23 additions and 3 deletions

View File

@@ -102,7 +102,10 @@ status_map = {
["To Bill", "eval:self.per_billed == 0 and self.docstatus == 1"],
["Partly Billed", "eval:self.per_billed > 0 and self.per_billed < 100 and self.docstatus == 1"],
["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"],
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
[
"Completed",
"eval:(self.per_billed == 100 and self.docstatus == 1) or (self.docstatus == 1 and self.grand_total == 0 and self.per_returned != 100 and self.is_return == 0)",
],
["Cancelled", "eval:self.docstatus==2"],
["Closed", "eval:self.status=='Closed' and self.docstatus != 2"],
],

View File

@@ -1111,6 +1111,7 @@
"depends_on": "eval:!doc.__islocal",
"fieldname": "per_returned",
"fieldtype": "Percent",
"in_list_view": 1,
"label": "% Returned",
"no_copy": 1,
"print_hide": 1,
@@ -1272,7 +1273,7 @@
"idx": 261,
"is_submittable": 1,
"links": [],
"modified": "2024-04-08 20:23:03.699201",
"modified": "2024-07-04 14:50:10.538472",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",

View File

@@ -8,6 +8,7 @@ from pypika import functions as fn
import erpnext
from erpnext.accounts.doctype.account.test_account import get_inventory_account
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
from erpnext.controllers.accounts_controller import InvalidQtyError
from erpnext.controllers.buying_controller import QtyMismatchError
from erpnext.stock import get_warehouse_account_map
@@ -3269,6 +3270,22 @@ class TestPurchaseReceipt(FrappeTestCase):
doc.flags.ignore_validate = True
doc.save()
def test_status_mapping(self):
item_code = "item_for_status"
create_item(item_code)
create_item("item_for_status")
warehouse = create_warehouse("Stores")
supplier = "Test Supplier"
create_supplier(supplier_name=supplier)
pr = make_purchase_receipt(
item_code=item_code,
warehouse=warehouse,
qty=1,
rate=0,
)
self.assertEqual(pr.grand_total, 0.0)
self.assertEqual(pr.status, "Completed")
def prepare_data_for_internal_transfer():
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
@@ -3512,7 +3529,6 @@ def make_purchase_receipt(**args):
pr.insert()
if not args.do_not_submit:
pr.submit()
pr.load_from_db()
return pr