Merge pull request #42809 from Vishnu7025/fix_so

fix: warehouse not mapping correctly during Delivery Note creation.
This commit is contained in:
ruthra kumar
2024-09-16 11:01:12 +05:30
committed by GitHub
3 changed files with 87 additions and 2 deletions

View File

@@ -32,8 +32,14 @@ class AccountsTestMixin:
else:
self.supplier = supplier_name
def create_item(self, item_name="_Test Item", is_stock=0, warehouse=None, company=None):
item = create_item(item_name, is_stock_item=is_stock, warehouse=warehouse, company=company)
def create_item(self, item_name="_Test Item", is_stock=0, warehouse=None, company=None, valuation_rate=0):
item = create_item(
item_name,
is_stock_item=is_stock,
warehouse=warehouse,
company=company,
valuation_rate=valuation_rate,
)
self.item = item.name
def create_company(self, company_name="_Test Company", abbr="_TC"):
@@ -104,6 +110,14 @@ class AccountsTestMixin:
new_acc.save()
setattr(self, acc.attribute_name, new_acc.name)
self.identify_default_warehouses()
def identify_default_warehouses(self):
for w in frappe.db.get_all(
"Warehouse", filters={"company": self.company}, fields=["name", "warehouse_name"]
):
setattr(self, "warehouse_" + w.warehouse_name.lower().strip().replace(" ", "_"), w.name)
def create_usd_receivable_account(self):
account_name = "Debtors USD"
if not frappe.db.get_value(