mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
fix(web-app-erpnext): seed the standard price lists the skipped setup wizard creates
The deploy bypasses ERPNext's setup wizard and with it install_defaults, so a site without the store's GUI fixtures had no Standard Selling or Standard Buying price list and every Item Price insert failed with "Could not find Price List: Standard Selling". company.py now creates both after the Company, insert-if-missing, with the wizard's selling and buying flags and the Company's own currency; Price List.on_update fills the Selling and Buying Settings defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0aa5d1386b
commit
ac4a8f45e2
3 files changed
+62
-1
No files matched your search
@@ -26,6 +26,7 @@ NAME_FIELDS = {
|
||||
"Customer Group": "customer_group_name",
|
||||
"Fiscal Year": "year",
|
||||
"Item Group": "item_group_name",
|
||||
"Price List": "price_list_name",
|
||||
"Role": "role_name",
|
||||
"Supplier Group": "supplier_group_name",
|
||||
"Territory": "territory_name",
|
||||
|
||||
@@ -95,6 +95,46 @@ class TestCompany(unittest.TestCase):
|
||||
records["Supplier Group"]["All Supplier Groups"]["is_group"], 1
|
||||
)
|
||||
|
||||
def test_creates_the_standard_price_lists_in_the_company_currency(self) -> None:
|
||||
result = self._run()
|
||||
|
||||
price_lists = self.frappe.records["Price List"]
|
||||
selling = price_lists["Standard Selling"]
|
||||
buying = price_lists["Standard Buying"]
|
||||
self.assertEqual((selling["selling"], selling["buying"]), (1, 0))
|
||||
self.assertEqual((buying["selling"], buying["buying"]), (0, 1))
|
||||
for price_list in (selling, buying):
|
||||
self.assertEqual(price_list["enabled"], 1)
|
||||
self.assertEqual(price_list["currency"], "EUR")
|
||||
self.assertIn("Price List: Standard Selling", result["created"])
|
||||
self.assertIn("Price List: Standard Buying", result["created"])
|
||||
|
||||
def test_existing_company_gets_price_lists_in_its_own_currency(self) -> None:
|
||||
_seed_company(self.frappe, COMPANY, "XY", default_cash_account="Cash - XY")
|
||||
|
||||
self._run()
|
||||
|
||||
for price_list in self.frappe.records["Price List"].values():
|
||||
self.assertEqual(price_list["currency"], "USD")
|
||||
|
||||
def test_keeps_an_existing_price_list(self) -> None:
|
||||
self.frappe.seed(
|
||||
"Price List",
|
||||
"Standard Selling",
|
||||
price_list_name="Standard Selling",
|
||||
enabled=0,
|
||||
selling=1,
|
||||
buying=0,
|
||||
currency="CHF",
|
||||
)
|
||||
|
||||
result = self._run()
|
||||
|
||||
self.assertEqual(
|
||||
self.frappe.records["Price List"]["Standard Selling"]["currency"], "CHF"
|
||||
)
|
||||
self.assertNotIn("Price List: Standard Selling", result["created"])
|
||||
|
||||
def test_creates_a_fiscal_year_covering_today(self) -> None:
|
||||
self._run()
|
||||
|
||||
|
||||
Reference in new issue
Block a user