Merge pull request #28431 from marination/capacity-dashboard-style
fix: (style) Warehouse Capacity Dashboard UI
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index e05e4a1..d8b8606 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -543,6 +543,75 @@
frappe.get_doc("Item Price", {"item_code": "Water Flask"}).delete()
item.delete()
+ def test_pricing_rule_for_different_currency(self):
+ make_item("Test Sanitizer Item")
+
+ pricing_rule_record = {
+ "doctype": "Pricing Rule",
+ "title": "_Test Sanitizer Rule",
+ "apply_on": "Item Code",
+ "items": [{
+ "item_code": "Test Sanitizer Item",
+ }],
+ "selling": 1,
+ "currency": "INR",
+ "rate_or_discount": "Rate",
+ "rate": 0,
+ "priority": 2,
+ "margin_type": "Percentage",
+ "margin_rate_or_amount": 0.0,
+ "company": "_Test Company"
+ }
+
+ rule = frappe.get_doc(pricing_rule_record)
+ rule.rate_or_discount = 'Rate'
+ rule.rate = 100.0
+ rule.insert()
+
+ rule1 = frappe.get_doc(pricing_rule_record)
+ rule1.currency = 'USD'
+ rule1.rate_or_discount = 'Rate'
+ rule1.rate = 2.0
+ rule1.priority = 1
+ rule1.insert()
+
+ args = frappe._dict({
+ "item_code": "Test Sanitizer Item",
+ "company": "_Test Company",
+ "price_list": "_Test Price List",
+ "currency": "USD",
+ "doctype": "Sales Invoice",
+ "conversion_rate": 1,
+ "price_list_currency": "_Test Currency",
+ "plc_conversion_rate": 1,
+ "order_type": "Sales",
+ "customer": "_Test Customer",
+ "name": None,
+ "transaction_date": frappe.utils.nowdate()
+ })
+
+ details = get_item_details(args)
+ self.assertEqual(details.price_list_rate, 2.0)
+
+
+ args = frappe._dict({
+ "item_code": "Test Sanitizer Item",
+ "company": "_Test Company",
+ "price_list": "_Test Price List",
+ "currency": "INR",
+ "doctype": "Sales Invoice",
+ "conversion_rate": 1,
+ "price_list_currency": "_Test Currency",
+ "plc_conversion_rate": 1,
+ "order_type": "Sales",
+ "customer": "_Test Customer",
+ "name": None,
+ "transaction_date": frappe.utils.nowdate()
+ })
+
+ details = get_item_details(args)
+ self.assertEqual(details.price_list_rate, 100.0)
+
def test_pricing_rule_for_transaction(self):
make_item("Water Flask 1")
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py
index 9655ac4..02bfc9d 100644
--- a/erpnext/accounts/doctype/pricing_rule/utils.py
+++ b/erpnext/accounts/doctype/pricing_rule/utils.py
@@ -264,6 +264,11 @@
else:
p.variant_of = None
+ if len(pricing_rules) > 1:
+ filtered_rules = list(filter(lambda x: x.currency==args.get('currency'), pricing_rules))
+ if filtered_rules:
+ pricing_rules = filtered_rules
+
# find pricing rule with highest priority
if pricing_rules:
max_priority = max(cint(p.priority) for p in pricing_rules)
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js
index f9259fb..e3eed92 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.js
+++ b/erpnext/manufacturing/doctype/job_card/job_card.js
@@ -23,12 +23,6 @@
);
},
- onload: function(frm) {
- if (frm.doc.scrap_items.length == 0) {
- frm.fields_dict['scrap_items_section'].collapse();
- }
- },
-
refresh: function(frm) {
frappe.flags.pause_job = 0;
frappe.flags.resume_job = 0;
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index d4ad719..2e2b8b7 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -463,11 +463,14 @@
def check_credit_limit(customer, company, ignore_outstanding_sales_order=False, extra_amount=0):
+ credit_limit = get_credit_limit(customer, company)
+ if not credit_limit:
+ return
+
customer_outstanding = get_customer_outstanding(customer, company, ignore_outstanding_sales_order)
if extra_amount > 0:
customer_outstanding += flt(extra_amount)
- credit_limit = get_credit_limit(customer, company)
if credit_limit > 0 and flt(customer_outstanding) > credit_limit:
msgprint(_("Credit limit has been crossed for customer {0} ({1}/{2})")
.format(customer, customer_outstanding, credit_limit))
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 5ebfa04..dedd2d3 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -413,7 +413,7 @@
frappe.get_attr(module_name)(company, False)
except Exception as e:
frappe.log_error()
- frappe.throw(_("Failed to setup defaults for country {0}. Please contact support@erpnext.com").format(frappe.bold(country)))
+ frappe.throw(_("Failed to setup defaults for country {0}. Please contact support.").format(frappe.bold(country)))
def update_company_current_month_sales(company):