Merge branch 'develop' into depr-expense-account
This commit is contained in:
commit
6ada1ac887
@ -543,6 +543,75 @@ class TestPricingRule(unittest.TestCase):
|
||||
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')
|
||||
|
@ -264,6 +264,11 @@ def filter_pricing_rules(args, pricing_rules, doc=None):
|
||||
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)
|
||||
|
@ -23,12 +23,6 @@ frappe.ui.form.on('Job Card', {
|
||||
);
|
||||
},
|
||||
|
||||
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;
|
||||
|
@ -463,11 +463,14 @@ def get_customer_list(doctype, txt, searchfield, start, page_len, filters=None):
|
||||
|
||||
|
||||
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))
|
||||
|
@ -413,7 +413,7 @@ def install_country_fixtures(company, country):
|
||||
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):
|
||||
|
@ -1,19 +1,19 @@
|
||||
{% for d in data %}
|
||||
<div class="dashboard-list-item" style="padding: 7px 15px;">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 small" style="margin-top: 8px;">
|
||||
<div class="col-sm-2" style="margin-top: 8px;">
|
||||
<a data-type="warehouse" data-name="{{ d.warehouse }}">{{ d.warehouse }}</a>
|
||||
</div>
|
||||
<div class="col-sm-2 small" style="margin-top: 8px; ">
|
||||
<div class="col-sm-2" style="margin-top: 8px; ">
|
||||
<a data-type="item" data-name="{{ d.item_code }}">{{ d.item_code }}</a>
|
||||
</div>
|
||||
<div class="col-sm-1 small" style="margin-top: 8px; ">
|
||||
<div class="col-sm-1" style="margin-top: 8px; ">
|
||||
{{ d.stock_capacity }}
|
||||
</div>
|
||||
<div class="col-sm-2 small" style="margin-top: 8px; ">
|
||||
<div class="col-sm-2" style="margin-top: 8px; ">
|
||||
{{ d.actual_qty }}
|
||||
</div>
|
||||
<div class="col-sm-2 small">
|
||||
<div class="col-sm-2">
|
||||
<div class="progress" title="Occupied Qty: {{ d.actual_qty }}" style="margin-bottom: 4px; height: 7px; margin-top: 14px;">
|
||||
<div class="progress-bar" role="progressbar"
|
||||
aria-valuenow="{{ d.percent_occupied }}"
|
||||
@ -23,16 +23,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1 small" style="margin-top: 8px;">
|
||||
<div class="col-sm-1" style="margin-top: 8px;">
|
||||
{{ d.percent_occupied }}%
|
||||
</div>
|
||||
{% if can_write %}
|
||||
<div class="col-sm-1 text-right" style="margin-top: 2px;">
|
||||
<button class="btn btn-default btn-xs btn-edit"
|
||||
style="margin-top: 4px;margin-bottom: 4px;"
|
||||
data-warehouse="{{ d.warehouse }}"
|
||||
data-item="{{ escape(d.item_code) }}"
|
||||
data-company="{{ escape(d.company) }}">{{ __("Edit Capacity") }}</a>
|
||||
<div class="col-sm-2 text-right" style="margin-top: 2px;">
|
||||
<button
|
||||
class="btn btn-default btn-xs btn-edit"
|
||||
style="margin: 4px 0; float: left;"
|
||||
data-warehouse="{{ d.warehouse }}"
|
||||
data-item="{{ escape(d.item_code) }}"
|
||||
data-company="{{ escape(d.company) }}">
|
||||
{{ __("Edit Capacity") }}
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@ frappe.pages['warehouse-capacity-summary'].on_page_load = function(wrapper) {
|
||||
title: 'Warehouse Capacity Summary',
|
||||
single_column: true
|
||||
});
|
||||
page.set_secondary_action('Refresh', () => page.capacity_dashboard.refresh(), 'octicon octicon-sync');
|
||||
page.set_secondary_action('Refresh', () => page.capacity_dashboard.refresh(), 'refresh');
|
||||
page.start = 0;
|
||||
|
||||
page.company_field = page.add_field({
|
||||
|
@ -1,18 +1,18 @@
|
||||
<div class="dashboard-list-item" style="padding: 12px 15px;">
|
||||
<div class="row">
|
||||
<div class="col-sm-2 small text-muted" style="margin-top: 8px;">
|
||||
<div class="col-sm-2 text-muted" style="margin-top: 8px;">
|
||||
Warehouse
|
||||
</div>
|
||||
<div class="col-sm-2 small text-muted" style="margin-top: 8px;">
|
||||
<div class="col-sm-2 text-muted" style="margin-top: 8px;">
|
||||
Item
|
||||
</div>
|
||||
<div class="col-sm-1 small text-muted" style="margin-top: 8px;">
|
||||
<div class="col-sm-1 text-muted" style="margin-top: 8px;">
|
||||
Stock Capacity
|
||||
</div>
|
||||
<div class="col-sm-2 small text-muted" style="margin-top: 8px;">
|
||||
<div class="col-sm-2 text-muted" style="margin-top: 8px;">
|
||||
Balance Stock Qty
|
||||
</div>
|
||||
<div class="col-sm-2 small text-muted" style="margin-top: 8px;">
|
||||
<div class="col-sm-2 text-muted" style="margin-top: 8px;">
|
||||
% Occupied
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user