fix: Don't create inward SLE against SI unless is internal customer enabled (#27086)

* fix: Dont create inward SLE against SI unless is internal customer enabled

- Check if is internal customer enabled apart from target warehouse
- Test to check if inward SLE is made if target warehouse is accidentally set but customer is not internal

* test: Use internal customer for delivery of bundle items to target warehouse

- created `create_internal_customer` util
- reused it in delivery note and sales invoice tests
- use internal customer for target warehouse test in delivery note

(cherry picked from commit f4dc9ee2aa)

# Conflicts:
#	erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
This commit is contained in:
Marica
2021-08-26 13:12:51 +05:30
committed by frappe-pr-bot
parent 16fbee30a6
commit 6636d857f7
4 changed files with 171 additions and 23 deletions

View File

@@ -422,7 +422,7 @@ class SellingController(StockController):
or (cint(self.is_return) and self.docstatus==2)):
sl_entries.append(self.get_sle_for_source_warehouse(d))
if d.target_warehouse:
if d.target_warehouse and self.get("is_internal_customer"):
sl_entries.append(self.get_sle_for_target_warehouse(d))
if d.warehouse and ((not cint(self.is_return) and self.docstatus==2)