diff --git a/erpnext/__init__.py b/erpnext/__init__.py index cbc8ad66422..b9c80226d55 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.36' +__version__ = '7.0.37' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js index 38be2637a2c..8ff4b83d681 100644 --- a/erpnext/accounts/doctype/asset/asset.js +++ b/erpnext/accounts/doctype/asset/asset.js @@ -18,7 +18,8 @@ frappe.ui.form.on('Asset', { frm.set_query("warehouse", function() { return { "filters": { - "company": frm.doc.company + "company": frm.doc.company, + "is_group": 0 } }; }); @@ -232,7 +233,10 @@ erpnext.asset.transfer_asset = function(frm) { "options": "Warehouse", "get_query": function () { return { - filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]] + filters: [ + ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]], + ["Warehouse", "is_group", "=", 0] + ] } }, "reqd": 1 diff --git a/erpnext/accounts/doctype/asset_movement/asset_movement.js b/erpnext/accounts/doctype/asset_movement/asset_movement.js index 680eedc9bc6..808f01a40ce 100644 --- a/erpnext/accounts/doctype/asset_movement/asset_movement.js +++ b/erpnext/accounts/doctype/asset_movement/asset_movement.js @@ -7,7 +7,10 @@ frappe.ui.form.on('Asset Movement', { frm.set_query("target_warehouse", function() { return { - filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]] + filters: [ + ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]], + ["Warehouse", "is_group", "=", 0] + ] } }) diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py index a6cc8baa9c8..752ecdaeb7c 100644 --- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py +++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py @@ -43,7 +43,7 @@ def create_or_update_cheque_print_format(template_name): - {{doc.party}} + {{doc.party_name}} - {%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %} + {%= frappe.boot.letter_heads[frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %}

{%= __(report.report_name) %}

{%= filters.customer || filters.supplier %}

diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html index 84cad1610d3..6959e5d3ed9 100644 --- a/erpnext/accounts/report/financial_statements.html +++ b/erpnext/accounts/report/financial_statements.html @@ -13,7 +13,9 @@ height: 37px; } - +
+ {%= frappe.boot.letter_heads[frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %} +

{%= __(report.report_name) %}

{%= filters.company %}

{%= filters.fiscal_year %}

diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html index f22e7212707..7552eed1ac3 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.html +++ b/erpnext/accounts/report/general_ledger/general_ledger.html @@ -1,5 +1,5 @@
- {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %} + {%= frappe.boot.letter_heads[filters.letter_head || frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %}

{%= __("Statement of Account") %}

{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ") || "" %} {%= filters.company %}

diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py index 2298c3fc3e1..080d7499aa0 100644 --- a/erpnext/controllers/trends.py +++ b/erpnext/controllers/trends.py @@ -39,6 +39,7 @@ def validate_filters(filters): frappe.throw(_("'Based On' and 'Group By' can not be same")) def get_data(filters, conditions): + data = [] inc, cond= '','' query_details = conditions["based_on_select"] + conditions["period_wise_select"] @@ -49,6 +50,9 @@ def get_data(filters, conditions): if conditions["based_on_select"] in ["t1.project,", "t2.project,"]: cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL' + + if conditions.get('trans') in ['Sales Order', 'Purchase Order']: + cond += "and t1.status != 'Closed'" year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", filters.get('fiscal_year'), ["year_start_date", "year_end_date"]) @@ -85,10 +89,10 @@ def get_data(filters, conditions): #to get distinct value of col specified by group_by in filter row = frappe.db.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s where t2.parent = t1.name and t1.company = %s and %s between %s and %s - and t1.docstatus = 1 and %s = %s %s + and t1.docstatus = 1 and %s = %s %s %s """ % (sel_col, conditions["trans"], conditions["trans"], conditions["addl_tables"], - "%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")), + "%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond"), cond), (filters.get("company"), year_start_date, year_end_date, data1[d][0]), as_list=1) for i in range(len(row)): @@ -97,11 +101,11 @@ def get_data(filters, conditions): #get data for group_by filter row1 = frappe.db.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s where t2.parent = t1.name and t1.company = %s and %s between %s and %s - and t1.docstatus = 1 and %s = %s and %s = %s %s + and t1.docstatus = 1 and %s = %s and %s = %s %s %s """ % (sel_col, conditions["period_wise_select"], conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s", posting_date, "%s","%s", sel_col, - "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")), + "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond"), cond), (filters.get("company"), year_start_date, year_end_date, row[i][0], data1[d][0]), as_list=1) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 9b97bd1cd27..d0e0d86d2e3 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -174,7 +174,8 @@ erpnext.production_order = { var company_filter = function(doc) { return { filters: { - 'company': frm.doc.company + 'company': frm.doc.company, + 'is_group': 0 } } } diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 68a717b1f7f..0c6a978a9b5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -313,4 +313,6 @@ erpnext.patches.v7_0.set_portal_settings erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice erpnext.patches.v7_0.fix_duplicate_icons erpnext.patches.v7_0.repost_gle_for_pos_sales_return -erpnext.patches.v7_0.update_missing_employee_in_timesheet \ No newline at end of file +erpnext.patches.v7_0.update_missing_employee_in_timesheet +erpnext.patches.v7_0.update_status_for_timesheet +erpnext.patches.v7_0.set_party_name_in_payment_entry diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py index 6a6fa26d8ed..a176a8f349c 100644 --- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py +++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py @@ -19,13 +19,14 @@ def execute(): time_sheet.employee = data.employee time_sheet.note = data.note time_sheet.company = company - + time_sheet.set_status() + time_sheet.set_dates() time_sheet.update_cost() time_sheet.calculate_total_amounts() time_sheet.flags.ignore_validate = True time_sheet.save(ignore_permissions=True) - + # To ignore validate_mandatory_fields function if data.docstatus == 1: time_sheet.db_set("docstatus", 1) @@ -33,7 +34,6 @@ def execute(): d.db_set("docstatus", 1) time_sheet.update_production_order(time_sheet.name) time_sheet.update_task_and_project() - def get_timelog_data(data): return { diff --git a/erpnext/patches/v7_0/set_party_name_in_payment_entry.py b/erpnext/patches/v7_0/set_party_name_in_payment_entry.py new file mode 100644 index 00000000000..c3085ce98c6 --- /dev/null +++ b/erpnext/patches/v7_0/set_party_name_in_payment_entry.py @@ -0,0 +1,18 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals + +import frappe + +def execute(): + customers = frappe._dict(frappe.db.sql("select name, customer_name from tabCustomer")) + suppliers = frappe._dict(frappe.db.sql("select name, supplier_name from tabSupplier")) + + pe_list = frappe.db.sql("""select name, party_type, party from `tabPayment Entry` + where party is not null and party != ''""", as_dict=1) + for pe in pe_list: + party_name = customers.get(pe.party) if pe.party_type=="Customer" else suppliers.get(pe.party) + + frappe.db.set_value("Payment Entry", pe.name, "party_name", party_name, update_modified=False) + \ No newline at end of file diff --git a/erpnext/patches/v7_0/update_status_for_timesheet.py b/erpnext/patches/v7_0/update_status_for_timesheet.py new file mode 100644 index 00000000000..117c40c59f2 --- /dev/null +++ b/erpnext/patches/v7_0/update_status_for_timesheet.py @@ -0,0 +1,11 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql("""update + `tabTimesheet` as ts, + ( + select min(from_time)as from_time, max(to_time) as to_time, parent from `tabTimesheet Detail` group by parent + ) as tsd + set ts.status = 'Submitted', ts.start_date = tsd.from_time, ts.end_date = tsd.to_time + where tsd.parent = ts.name and ts.status = 'Draft' and ts.docstatus =1""") \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 792f269bcf5..d477189c62a 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -25,14 +25,20 @@ frappe.ui.form.on("Purchase Receipt", { $.each(["warehouse", "rejected_warehouse"], function(i, field) { frm.set_query(field, "items", function() { return { - filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]] + filters: [ + ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]], + ["Warehouse", "is_group", "=", 0] + ] } }) }) frm.set_query("supplier_warehouse", function() { return { - filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]] + filters: [ + ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]], + ["Warehouse", "is_group", "=", 0] + ] } }) } diff --git a/erpnext/templates/includes/rfq.js b/erpnext/templates/includes/rfq.js index 3e9c261a200..c63226c9bd0 100644 --- a/erpnext/templates/includes/rfq.js +++ b/erpnext/templates/includes/rfq.js @@ -30,9 +30,10 @@ rfq = Class.extend({ var me = this; $('.rfq-items').on("change", ".rfq-qty", function(){ me.idx = parseFloat($(this).attr('data-idx')); - me.qty = parseFloat($(this).val()); + me.qty = parseFloat($(this).val()) || 0; me.rate = parseFloat($(repl('.rfq-rate[data-idx=%(idx)s]',{'idx': me.idx})).val()); me.update_qty_rate(); + $(this).val(format_number(me.qty, 2)); }) }, @@ -40,9 +41,10 @@ rfq = Class.extend({ var me = this; $(".rfq-items").on("change", ".rfq-rate", function(){ me.idx = parseFloat($(this).attr('data-idx')); - me.rate = parseFloat($(this).val()); + me.rate = parseFloat($(this).val()) || 0; me.qty = parseFloat($(repl('.rfq-qty[data-idx=%(idx)s]',{'idx': me.idx})).val()); me.update_qty_rate(); + $(this).val(format_number(me.rate, 2)); }) }, diff --git a/erpnext/templates/includes/rfq/rfq_items.html b/erpnext/templates/includes/rfq/rfq_items.html index 1e99a7671b7..cb77f7eea5c 100644 --- a/erpnext/templates/includes/rfq/rfq_items.html +++ b/erpnext/templates/includes/rfq/rfq_items.html @@ -3,26 +3,26 @@ {% for d in doc.items %}
-
+
{{ item_name_and_description(d, doc) }}
-
- +

- {{_("UOM") + ": "+ d.uom}} + {{_("UOM") + ":"+ d.uom}}

-
- {{doc.currency_symbol}} +
-
+
{{doc.currency_symbol}} 0.00
diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html index 5729e89d408..b151987052d 100644 --- a/erpnext/templates/pages/rfq.html +++ b/erpnext/templates/pages/rfq.html @@ -33,16 +33,16 @@
-
+
Items
-
+
Qty
-
+
Rate
-
+
Amount
@@ -55,8 +55,8 @@
{% if doc.items %}
-
{{ _("Grand Total") }}
-
+
{{ _("Grand Total") }}
+
{{doc.currency_symbol}} 0.0