Merge branch 'develop'
This commit is contained in:
commit
af5820874c
@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '5.0.25'
|
||||
__version__ = '5.0.26'
|
||||
|
@ -210,7 +210,7 @@ def get_gl_entries(company, from_date, to_date, root_lft, root_rgt, ignore_closi
|
||||
if from_date:
|
||||
additional_conditions.append("and posting_date >= %(from_date)s")
|
||||
|
||||
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit from `tabGL Entry`
|
||||
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening from `tabGL Entry`
|
||||
where company=%(company)s
|
||||
{additional_conditions}
|
||||
and posting_date <= %(to_date)s
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt, getdate
|
||||
from frappe.utils import flt, getdate, cstr
|
||||
from frappe import _
|
||||
|
||||
def execute(filters=None):
|
||||
@ -155,7 +155,7 @@ def get_accountwise_gle(filters, gl_entries, gle_map):
|
||||
for gle in gl_entries:
|
||||
amount = flt(gle.debit, 3) - flt(gle.credit, 3)
|
||||
if (filters.get("account") or filters.get("party") or filters.get("group_by_account")) \
|
||||
and gle.posting_date < from_date:
|
||||
and (gle.posting_date < from_date or cstr(gle.is_opening) == "Yes"):
|
||||
gle_map[gle.account].opening += amount
|
||||
if filters.get("account") or filters.get("party"):
|
||||
opening += amount
|
||||
|
@ -90,7 +90,7 @@ def get_rootwise_opening_balances(filters, report_type):
|
||||
where
|
||||
company=%(company)s
|
||||
{additional_conditions}
|
||||
and posting_date < %(from_date)s
|
||||
and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
|
||||
and account in (select name from `tabAccount` where report_type=%(report_type)s)
|
||||
group by account""".format(additional_conditions=additional_conditions),
|
||||
{
|
||||
@ -128,16 +128,21 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters)
|
||||
for d in accounts:
|
||||
d.update(init.copy())
|
||||
|
||||
# add opening
|
||||
d["opening_debit"] = opening_balances.get(d.name, {}).get("opening_debit", 0)
|
||||
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
||||
|
||||
for entry in gl_entries_by_account.get(d.name, []):
|
||||
d["debit"] += flt(entry.debit)
|
||||
d["credit"] += flt(entry.credit)
|
||||
if entry.is_opening == "Yes" and d.root_type in ("Asset", "Liability", "Equity"):
|
||||
d["opening_debit"] += flt(entry.debit)
|
||||
d["opening_credit"] += flt(entry.credit)
|
||||
else:
|
||||
d["debit"] += flt(entry.debit)
|
||||
d["credit"] += flt(entry.credit)
|
||||
|
||||
total_row["debit"] += d["debit"]
|
||||
total_row["credit"] += d["credit"]
|
||||
|
||||
# add opening
|
||||
d["opening_debit"] = opening_balances.get(d.name, {}).get("opening_debit", 0)
|
||||
d["opening_credit"] = opening_balances.get(d.name, {}).get("opening_credit", 0)
|
||||
|
||||
return total_row
|
||||
|
||||
|
@ -103,6 +103,12 @@ def get_data():
|
||||
"name": "Completed Production Orders",
|
||||
"doctype": "Production Order"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "BOM Search",
|
||||
"doctype": "BOM"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -237,6 +237,12 @@ def get_data():
|
||||
"route": "query-report/Sales Person Target Variance Item Group-Wise",
|
||||
"doctype": "Sales Person",
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "BOM Search",
|
||||
"doctype": "BOM"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
|
@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors"
|
||||
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "5.0.25"
|
||||
app_version = "5.0.26"
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
|
@ -26,7 +26,8 @@ class NamingSeries(Document):
|
||||
except frappe.DoesNotExistError:
|
||||
continue
|
||||
|
||||
prefixes = prefixes + "\n" + options
|
||||
if options:
|
||||
prefixes = prefixes + "\n" + options
|
||||
|
||||
prefixes.replace("\n\n", "\n")
|
||||
prefixes = "\n".join(sorted(prefixes.split()))
|
||||
|
@ -55,6 +55,9 @@ frappe.ui.form.on("Item", {
|
||||
// read only if any stock ledger entry exists
|
||||
erpnext.item.make_dashboard(frm);
|
||||
|
||||
// clear intro
|
||||
frm.set_intro();
|
||||
|
||||
if (frm.doc.has_variants) {
|
||||
frm.set_intro(__("This Item is a Template and cannot be used in transactions. Item attributes will be copied over into the variants unless 'No Copy' is set"), true);
|
||||
frm.add_custom_button(__("Show Variants"), function() {
|
||||
@ -85,7 +88,7 @@ frappe.ui.form.on("Item", {
|
||||
erpnext.item.weight_to_validate(frm);
|
||||
erpnext.item.variants_can_not_be_created_manually(frm);
|
||||
},
|
||||
|
||||
|
||||
image: function(frm) {
|
||||
refresh_field("image_view");
|
||||
},
|
||||
@ -209,11 +212,11 @@ $.extend(erpnext.item, {
|
||||
validated = 0;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
variants_can_not_be_created_manually: function(frm) {
|
||||
if (frm.doc.__islocal && frm.doc.variant_of)
|
||||
frappe.throw(__("Variants can not be created manually, add item attributes in the template item"))
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
0
erpnext/stock/report/bom_search/__init__.py
Normal file
0
erpnext/stock/report/bom_search/__init__.py
Normal file
42
erpnext/stock/report/bom_search/bom_search.js
Normal file
42
erpnext/stock/report/bom_search/bom_search.js
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.query_reports["BOM Search"] = {
|
||||
"filters": [
|
||||
{
|
||||
fieldname: "item1",
|
||||
label: __("Item 1"),
|
||||
fieldtype: "Link",
|
||||
options: "Item"
|
||||
},
|
||||
{
|
||||
fieldname: "item2",
|
||||
label: __("Item 2"),
|
||||
fieldtype: "Link",
|
||||
options: "Item"
|
||||
},
|
||||
{
|
||||
fieldname: "item3",
|
||||
label: __("Item 3"),
|
||||
fieldtype: "Link",
|
||||
options: "Item"
|
||||
},
|
||||
{
|
||||
fieldname: "item4",
|
||||
label: __("Item 4"),
|
||||
fieldtype: "Link",
|
||||
options: "Item"
|
||||
},
|
||||
{
|
||||
fieldname: "item5",
|
||||
label: __("Item 5"),
|
||||
fieldtype: "Link",
|
||||
options: "Item"
|
||||
},
|
||||
{
|
||||
fieldname: "search_sub_assemblies",
|
||||
label: __("Search Sub Assemblies"),
|
||||
fieldtype: "Check",
|
||||
},
|
||||
]
|
||||
}
|
17
erpnext/stock/report/bom_search/bom_search.json
Normal file
17
erpnext/stock/report/bom_search/bom_search.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"creation": "2015-06-16 15:16:11.930954",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-06-16 15:16:29.850834",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "BOM Search",
|
||||
"owner": "Administrator",
|
||||
"ref_doctype": "BOM",
|
||||
"report_name": "BOM Search",
|
||||
"report_type": "Script Report"
|
||||
}
|
43
erpnext/stock/report/bom_search/bom_search.py
Normal file
43
erpnext/stock/report/bom_search/bom_search.py
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
|
||||
def execute(filters=None):
|
||||
data = []
|
||||
parents = {
|
||||
"Sales BOM Item": "Sales BOM",
|
||||
"BOM Explosion Item": "BOM",
|
||||
"BOM Item": "BOM"
|
||||
}
|
||||
|
||||
for doctype in ("Sales BOM Item",
|
||||
"BOM Explosion Item" if filters.search_sub_assemblies else "BOM Item"):
|
||||
all_boms = {}
|
||||
for d in frappe.get_all(doctype, fields=["parent", "item_code"]):
|
||||
all_boms.setdefault(d.parent, []).append(d.item_code)
|
||||
|
||||
for parent, items in all_boms.iteritems():
|
||||
valid = True
|
||||
for key, item in filters.iteritems():
|
||||
if key != "search_sub_assemblies":
|
||||
if item and item not in items:
|
||||
valid = False
|
||||
|
||||
if valid:
|
||||
data.append((parent, parents[doctype]))
|
||||
|
||||
return [{
|
||||
"fieldname": "parent",
|
||||
"label": "BOM",
|
||||
"width": 200,
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "doctype"
|
||||
},
|
||||
{
|
||||
"fieldname": "doctype",
|
||||
"label": "Type",
|
||||
"width": 200,
|
||||
"fieldtype": "Data"
|
||||
}], data
|
Loading…
x
Reference in New Issue
Block a user