Merge pull request #32905 from vishdha/internal_transfer

fix: Internal Transfer Material Request cycle and tracking fixed till purchase receipt
This commit is contained in:
Sagar Sharma 2022-11-18 13:15:27 +05:30 committed by GitHub
commit 602a13b0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 2 deletions

View File

@ -2165,6 +2165,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
if source.doctype == "Purchase Order Item" and target.doctype == "Sales Order Item": if source.doctype == "Purchase Order Item" and target.doctype == "Sales Order Item":
target.purchase_order = source.parent target.purchase_order = source.parent
target.purchase_order_item = source.name target.purchase_order_item = source.name
target.material_request = source.material_request
target.material_request_item = source.material_request_item
if ( if (
source.get("purchase_order") source.get("purchase_order")

View File

@ -833,6 +833,10 @@ class TestPurchaseOrder(FrappeTestCase):
prepare_data_for_internal_transfer() prepare_data_for_internal_transfer()
supplier = "_Test Internal Supplier 2" supplier = "_Test Internal Supplier 2"
mr = make_material_request(
qty=2, company="_Test Company with perpetual inventory", warehouse="Stores - TCP1"
)
po = create_purchase_order( po = create_purchase_order(
company="_Test Company with perpetual inventory", company="_Test Company with perpetual inventory",
supplier=supplier, supplier=supplier,
@ -840,6 +844,8 @@ class TestPurchaseOrder(FrappeTestCase):
from_warehouse="_Test Internal Warehouse New 1 - TCP1", from_warehouse="_Test Internal Warehouse New 1 - TCP1",
qty=2, qty=2,
rate=1, rate=1,
material_request=mr.name,
material_request_item=mr.items[0].name,
) )
so = make_inter_company_sales_order(po.name) so = make_inter_company_sales_order(po.name)
@ -875,9 +881,11 @@ class TestPurchaseOrder(FrappeTestCase):
self.assertTrue(pi.items[0].purchase_order) self.assertTrue(pi.items[0].purchase_order)
self.assertTrue(pi.items[0].po_detail) self.assertTrue(pi.items[0].po_detail)
pi.submit() pi.submit()
mr.reload()
po.load_from_db() po.load_from_db()
self.assertEqual(po.status, "Completed") self.assertEqual(po.status, "Completed")
self.assertEqual(mr.status, "Received")
def prepare_data_for_internal_transfer(): def prepare_data_for_internal_transfer():
@ -979,6 +987,8 @@ def create_purchase_order(**args):
"schedule_date": add_days(nowdate(), 1), "schedule_date": add_days(nowdate(), 1),
"include_exploded_items": args.get("include_exploded_items", 1), "include_exploded_items": args.get("include_exploded_items", 1),
"against_blanket_order": args.against_blanket_order, "against_blanket_order": args.against_blanket_order,
"material_request": args.material_request,
"material_request_item": args.material_request_item,
}, },
) )

View File

@ -95,8 +95,10 @@
"item_tax_rate", "item_tax_rate",
"transaction_date", "transaction_date",
"inter_transfer_reference_section", "inter_transfer_reference_section",
"material_request",
"purchase_order", "purchase_order",
"column_break_89", "column_break_89",
"material_request_item",
"purchase_order_item" "purchase_order_item"
], ],
"fields": [ "fields": [
@ -847,12 +849,23 @@
"label": "quotation_item", "label": "quotation_item",
"no_copy": 1, "no_copy": 1,
"read_only": 1 "read_only": 1
},
{
"fieldname": "material_request",
"fieldtype": "Link",
"label": "Material Request",
"options": "Material Request"
},
{
"fieldname": "material_request_item",
"fieldtype": "Data",
"label": "Material Request Item"
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2022-11-10 18:20:30.137455", "modified": "2022-11-18 11:39:01.741665",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order Item", "name": "Sales Order Item",

View File

@ -902,6 +902,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
"serial_no": "serial_no", "serial_no": "serial_no",
"purchase_order": "purchase_order", "purchase_order": "purchase_order",
"purchase_order_item": "purchase_order_item", "purchase_order_item": "purchase_order_item",
"material_request": "material_request",
"Material_request_item": "material_request_item",
}, },
"field_no_map": ["warehouse"], "field_no_map": ["warehouse"],
}, },

View File

@ -11,11 +11,14 @@ def get_data():
}, },
"internal_links": { "internal_links": {
"Sales Order": ["items", "against_sales_order"], "Sales Order": ["items", "against_sales_order"],
"Material Request": ["items", "material_request"],
"Purchase Order": ["items", "purchase_order"],
}, },
"transactions": [ "transactions": [
{"label": _("Related"), "items": ["Sales Invoice", "Packing Slip", "Delivery Trip"]}, {"label": _("Related"), "items": ["Sales Invoice", "Packing Slip", "Delivery Trip"]},
{"label": _("Reference"), "items": ["Sales Order", "Shipment", "Quality Inspection"]}, {"label": _("Reference"), "items": ["Sales Order", "Shipment", "Quality Inspection"]},
{"label": _("Returns"), "items": ["Stock Entry"]}, {"label": _("Returns"), "items": ["Stock Entry"]},
{"label": _("Subscription"), "items": ["Auto Repeat"]}, {"label": _("Subscription"), "items": ["Auto Repeat"]},
{"label": _("Internal Transfer"), "items": ["Material Request", "Purchase Order"]},
], ],
} }

View File

@ -88,9 +88,11 @@
"allow_zero_valuation_rate", "allow_zero_valuation_rate",
"column_break_71", "column_break_71",
"internal_transfer_section", "internal_transfer_section",
"material_request",
"purchase_order", "purchase_order",
"column_break_82", "column_break_82",
"purchase_order_item", "purchase_order_item",
"material_request_item",
"accounting_dimensions_section", "accounting_dimensions_section",
"cost_center", "cost_center",
"dimension_col_break", "dimension_col_break",
@ -818,13 +820,24 @@
"fieldtype": "Check", "fieldtype": "Check",
"label": "Has Item Scanned", "label": "Has Item Scanned",
"read_only": 1 "read_only": 1
},
{
"fieldname": "material_request",
"fieldtype": "Link",
"label": "Material Request",
"options": "Material Request"
},
{
"fieldname": "material_request_item",
"fieldtype": "Data",
"label": "Material Request Item"
} }
], ],
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2022-11-02 12:54:07.225623", "modified": "2022-11-09 12:17:50.850142",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Delivery Note Item", "name": "Delivery Note Item",

View File

@ -14,5 +14,6 @@ def get_data():
}, },
{"label": _("Stock"), "items": ["Stock Entry", "Purchase Receipt", "Pick List"]}, {"label": _("Stock"), "items": ["Stock Entry", "Purchase Receipt", "Pick List"]},
{"label": _("Manufacturing"), "items": ["Work Order"]}, {"label": _("Manufacturing"), "items": ["Work Order"]},
{"label": _("Internal Transfer"), "items": ["Sales Order"]},
], ],
} }