Merge pull request #12573 from rohitwaghchaure/reorder_issue
[Fix] Wrong projected qty for warehouse group in the process of reorder item, which making extra material requests
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index bd400c0..4beb35b 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
-__version__ = '10.0.10'
+__version__ = '10.0.12'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html
index 83325aa..90e8059 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.html
+++ b/erpnext/accounts/report/general_ledger/general_ledger.html
@@ -17,12 +17,12 @@
<table class="table table-bordered">
<thead>
<tr>
- <th style="width: 15%">{%= __("Date") %}</th>
+ <th style="width: 12%">{%= __("Date") %}</th>
<th style="width: 15%">{%= __("Ref") %}</th>
<th style="width: 25%">{%= __("Party") %}</th>
<th style="width: 15%">{%= __("Debit") %}</th>
<th style="width: 15%">{%= __("Credit") %}</th>
- <th style="width: 15%">{%= __("Balance") %}</th>
+ <th style="width: 18%">{%= __("Balance") %}</th>
</tr>
</thead>
<tbody>
@@ -76,9 +76,11 @@
{% } %}
{% } %}
{% if(filters.print_in_account_currency) { %}
- <td style="text-align: right">{%= data[i].balance_in_account_currency %}</td>
+ <td style="text-align: right">{%= get_currency_symbol(data[i].account_currency)%}
+ {%= data[i].balance_in_account_currency %}</td>
{% } else { %}
- <td style="text-align: right">{%= data[i].balance %}</td>
+ <td style="text-align: right">{%= get_currency_symbol()%}
+ {%= data[i].balance %}</td>
{% } %}
</tr>
{% } %}
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 72fe793..b6b26b1 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -238,7 +238,7 @@
inv_details = get_supplier_invoice_details()
for d in data:
- if not d.posting_date:
+ if not d.get('posting_date'):
balance, balance_in_account_currency = 0, 0
balance, label = get_balance(d, balance, 'debit', 'credit')
@@ -254,7 +254,7 @@
d['balance_in_account_currency'] = d.get('balance')
d['account_currency'] = filters.account_currency
- d['bill_no'] = inv_details.get(d.against_voucher, '')
+ d['bill_no'] = inv_details.get(d.get('against_voucher'), '')
return data
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
index f38f28d..c2b1456 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -36,8 +36,8 @@
return data
def get_conditions(filters):
- conditions = ""
- if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s"
+ conditions = "1=1"
+ if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
if filters.get("company"): conditions += " and a.company=%(company)s"
if filters.get("customer"): conditions += " and a.customer = %(customer)s"
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index fe8642c..ab8ab03 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -21,10 +21,10 @@
return erpnext.queries.warehouse(frm.doc);
});
- frappe.db.get_value('Buying Settings', {name: 'Buying Settings'}, 'disable_fetch_last_purchase_rate', (r) => {
- value = r && cint(r.disable_fetch_last_purchase_rate);
- frm.toggle_display('get_last_purchase_rate', !value);
- });
+ if (frm.doc.__onload) {
+ frm.toggle_display('get_last_purchase_rate',
+ frm.doc.__onload.disable_fetch_last_purchase_rate);
+ }
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 1929476..db13bd5 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -34,6 +34,12 @@
'overflow_type': 'order'
}]
+ def onload(self):
+ super(PurchaseOrder, self).onload()
+
+ self.set_onload('disable_fetch_last_purchase_rate',
+ cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")))
+
def validate(self):
super(PurchaseOrder, self).validate()
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index cd74fb5..53f9ecb 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -152,7 +152,7 @@
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = []
- return frappe.db.sql("""select tabItem.name, tabItem.item_group, tabItem.image,
+ return frappe.db.sql("""select tabItem.name, tabItem.item_group,
if(length(tabItem.item_name) > 40,
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
if(length(tabItem.description) > 40, \
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 3ef7be1..16a3023 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -310,6 +310,7 @@
}
"""
item_list = []
+ precision = frappe.get_precision("BOM Item", "stock_qty")
for bom, so_wise_qty in bom_dict.items():
bom_wise_item_details = {}
@@ -334,8 +335,9 @@
for item, item_details in bom_wise_item_details.items():
for so_qty in so_wise_qty:
- item_list.append([item, flt(item_details.qty) * so_qty[1], item_details.description,
- item_details.stock_uom, item_details.min_order_qty, so_qty[0]])
+ item_list.append([item, flt(flt(item_details.qty) * so_qty[1], precision),
+ item_details.description, item_details.stock_uom, item_details.min_order_qty,
+ so_qty[0]])
self.make_items_dict(item_list)
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index 9894c2a..4b6cf74 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -16,7 +16,7 @@
else:
company = frappe.db.get_single_value('Global Defaults', 'default_company')
- time_sheet = make_timesheet(data.production_order)
+ time_sheet = make_timesheet(data.production_order, company)
args = get_timelog_data(data)
add_timesheet_detail(time_sheet, args)
if data.docstatus == 2:
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 9ee82d2..d290c92 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -648,6 +648,9 @@
}
}).fail(() => this.frm.set_value('shipping_rule', ''));
}
+ else {
+ me.calculate_taxes_and_totals();
+ }
},
set_actual_charges_based_on_currency: function() {
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index ac7c830..c0e90e0 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -162,8 +162,14 @@
self._set_default_account("default_expense_account", "Cost of Goods Sold")
if not self.default_income_account:
- self.db_set("default_income_account", frappe.db.get_value("Account",
- {"account_name": _("Sales"), "company": self.name}))
+ income_account = frappe.db.get_value("Account",
+ {"account_name": _("Sales"), "company": self.name, "is_group": 0})
+
+ if not income_account:
+ income_account = frappe.db.get_value("Account",
+ {"account_name": _("Sales Account"), "company": self.name})
+
+ self.db_set("default_income_account", income_account)
if not self.default_payable_account:
self.db_set("default_payable_account", self.default_payable_account)
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 01125f9..0032e80 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -26,7 +26,7 @@
now = now_datetime()
self.posting_date = now.strftime('%Y-%m-%d')
self.posting_time = now.strftime('%H:%M:%S.%f')
- else:
+ elif self.posting_time:
try:
get_time(self.posting_time)
except ValueError: