Skip to content

Commit

Permalink
test: auto create SCO on PO submit
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Nov 29, 2023
1 parent 857f2b5 commit 68585f6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions erpnext/buying/doctype/purchase_order/test_purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,38 @@ def update_items(po, qty):
self.assertEqual(po.items[0].qty, 30)
self.assertEqual(po.items[0].fg_item_qty, 30)

@change_settings("Buying Settings", {"auto_create_subcontracting_order": 1})
def test_auto_create_subcontracting_order(self):
from erpnext.controllers.tests.test_subcontracting_controller import (
make_bom_for_subcontracted_items,
make_raw_materials,
make_service_items,
make_subcontracted_items,
)

make_subcontracted_items()
make_raw_materials()
make_service_items()
make_bom_for_subcontracted_items()

service_items = [
{
"warehouse": "_Test Warehouse - _TC",
"item_code": "Subcontracted Service Item 7",
"qty": 10,
"rate": 100,
"fg_item": "Subcontracted Item SA7",
"fg_item_qty": 10,
},
]
po = create_purchase_order(
rm_items=service_items,
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
)

self.assertTrue(frappe.db.get_value("Subcontracting Order", {"purchase_order": po.name}))


def prepare_data_for_internal_transfer():
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
Expand Down

0 comments on commit 68585f6

Please sign in to comment.