diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 10f65702ca..a92e105f12 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.1.11' +__version__ = '7.1.12' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 75c3e8c205..f463c07579 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -4,7 +4,7 @@

{%= __(report.report_name) %}

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

- {%= filters.ageing_based_on %} + {%= __(filters.ageing_based_on) %} {%= __("Until") %} {%= dateutil.str_to_user(filters.report_date) %}
@@ -12,7 +12,7 @@ - {% if(__(report.report_name) == "Accounts Receivable" || __(report.report_name) == "Accounts Payable") { %} + {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %} @@ -30,7 +30,7 @@ {% for(var i=0, l=data.length; i - {% if(__(report.report_name) == "Accounts Receivable" || __(report.report_name) == "Accounts Payable") { %} + {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %} {% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %} + {%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %} + {%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %} + {%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %} {% } else { %} + {%= format_currency(data[i]["Invoiced Amount"]) %} + {%= format_currency(data[i]["Paid Amount"]) %} + {%= format_currency(data[i]["Outstanding Amount"]) %} {% } %} {% } else { %} {% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %} @@ -71,4 +71,4 @@ {% } %}
{%= __("Date") %} {%= __("Ref") %} {%= __("Party") %}
{%= dateutil.str_to_user(data[i][__("Posting Date")]) %} {%= data[i][__("Voucher Type")] %} @@ -38,21 +38,21 @@ {%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}
- {%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %} {%= __("Total") %} - {%= format_currency(data[i][__("Invoiced Amount")]) %} - {%= format_currency(data[i][__("Paid Amount")]) %} - {%= format_currency(data[i][__("Outstanding Amount")]) %}
-

Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}

\ No newline at end of file +

{{ __("Printed On") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}

\ No newline at end of file diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py index fbfaa41162..8963bb4e50 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe import _ -from frappe.utils import flt +from frappe.utils import flt, cint from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) def execute(filters=None): @@ -92,12 +92,13 @@ def get_provisional_profit_loss(asset, liability, equity, period_list, company): def check_opening_balance(asset, liability, equity): # Check if previous year balance sheet closed opening_balance = 0 + float_precision = cint(frappe.db.get_default("float_precision")) or 2 if asset: - opening_balance = flt(asset[0].get("opening_balance", 0)) + opening_balance = flt(asset[0].get("opening_balance", 0), float_precision) if liability: - opening_balance -= flt(liability[0].get("opening_balance", 0)) + opening_balance -= flt(liability[0].get("opening_balance", 0), float_precision) if equity: - opening_balance -= flt(equity[0].get("opening_balance", 0)) + opening_balance -= flt(equity[0].get("opening_balance", 0), float_precision) if opening_balance: return _("Previous Financial Year is not closed"),opening_balance diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 54ca07b5dc..197928a34a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -231,6 +231,7 @@ class PurchaseOrder(BuyingController): "target_parent_dt": "Sales Order", "target_dt": "Sales Order Item", 'target_field': 'ordered_qty', + "join_field": "sales_order_item", "target_parent_field": '' }) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index ae03a3562c..3e22681009 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -207,6 +207,7 @@ def make_return_doc(doctype, source_name, target_doc=None): target_doc.rejected_qty = -1* source_doc.rejected_qty target_doc.qty = -1* source_doc.qty target_doc.purchase_order = source_doc.purchase_order + target_doc.purchase_order_item = source_doc.purchase_order_item target_doc.rejected_warehouse = source_doc.rejected_warehouse elif doctype == "Purchase Invoice": target_doc.received_qty = -1* source_doc.received_qty diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index fcddc8fb3d..da09e26dd5 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -271,19 +271,19 @@ class StatusUpdater(Document): %(update_modified)s where name='%(name)s'""" % args) - # update field - if args.get('status_field'): - frappe.db.sql("""update `tab%(target_parent_dt)s` - set %(status_field)s = if(%(target_parent_field)s<0.001, - 'Not %(keyword)s', if(%(target_parent_field)s>=99.99, - 'Fully %(keyword)s', 'Partly %(keyword)s')) - where name='%(name)s'""" % args) + # update field + if args.get('status_field'): + frappe.db.sql("""update `tab%(target_parent_dt)s` + set %(status_field)s = if(%(target_parent_field)s<0.001, + 'Not %(keyword)s', if(%(target_parent_field)s>=99.99, + 'Fully %(keyword)s', 'Partly %(keyword)s')) + where name='%(name)s'""" % args) - if update_modified: - target = frappe.get_doc(args["target_parent_dt"], args["name"]) - target.set_status(update=True) - target.notify_update() - notify_status(target) + if update_modified: + target = frappe.get_doc(args["target_parent_dt"], args["name"]) + target.set_status(update=True) + target.notify_update() + notify_status(target) def _update_modified(self, args, update_modified): args['update_modified'] = '' diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py index 2c6cf72bda..6e1265e82e 100644 --- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py +++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py @@ -8,32 +8,32 @@ from frappe import msgprint, _ def execute(filters=None): if not filters: filters = {} - + salary_slips = get_salary_slips(filters) columns, earning_types, ded_types = get_columns(salary_slips) ss_earning_map = get_ss_earning_map(salary_slips) ss_ded_map = get_ss_ded_map(salary_slips) - - + + data = [] for ss in salary_slips: row = [ss.name, ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation, ss.company, ss.month, ss.leave_withut_pay, ss.payment_days] - + for e in earning_types: row.append(ss_earning_map.get(ss.name, {}).get(e)) - + row += [ss.arrear_amount, ss.leave_encashment_amount, ss.gross_pay] - + for d in ded_types: row.append(ss_ded_map.get(ss.name, {}).get(d)) - + row += [ss.total_deduction, ss.net_pay] - + data.append(row) - + return columns, data - + def get_columns(salary_slips): columns = [ _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120", @@ -41,7 +41,7 @@ def get_columns(salary_slips): _("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130", _("Payment Days") + ":Float:120" ] - + salary_components = {_("Earning"): [], _("Deduction"): []} for component in frappe.db.sql("""select distinct sd.salary_component, sc.type @@ -61,47 +61,47 @@ def get_salary_slips(filters): conditions, filters = get_conditions(filters) salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where docstatus = 1 %s order by employee, month""" % conditions, filters, as_dict=1) - + if not salary_slips: - msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) + - _(" and year: ") + cstr(filters.get("fiscal_year")), raise_exception=1) - + frappe.throw(_("No salary slip found for month {0} and year {1}").format( + filters.get("month"), filters.get("fiscal_year"))) + return salary_slips - + def get_conditions(filters): conditions = "" if filters.get("month"): - month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", + month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].index(filters["month"]) + 1 filters["month"] = month conditions += " and month = %(month)s" - + if filters.get("fiscal_year"): conditions += " and fiscal_year = %(fiscal_year)s" if filters.get("company"): conditions += " and company = %(company)s" if filters.get("employee"): conditions += " and employee = %(employee)s" - + return conditions, filters - + def get_ss_earning_map(salary_slips): - ss_earnings = frappe.db.sql("""select parent, salary_component, amount + ss_earnings = frappe.db.sql("""select parent, salary_component, amount from `tabSalary Detail` where parent in (%s)""" % (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) - + ss_earning_map = {} for d in ss_earnings: ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, []) ss_earning_map[d.parent][d.salary_component] = flt(d.amount) - + return ss_earning_map def get_ss_ded_map(salary_slips): - ss_deductions = frappe.db.sql("""select parent, salary_component, amount + ss_deductions = frappe.db.sql("""select parent, salary_component, amount from `tabSalary Detail` where parent in (%s)""" % (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1) - + ss_ded_map = {} for d in ss_deductions: ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, []) ss_ded_map[d.parent][d.salary_component] = flt(d.amount) - + return ss_ded_map \ No newline at end of file diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 57dbc59839..5f8531d1a3 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -346,4 +346,6 @@ execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where pur erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01 erpnext.patches.v7_1.add_account_user_role_for_timesheet erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table -erpnext.patches.v7_1.update_invoice_status \ No newline at end of file +erpnext.patches.v7_1.update_invoice_status +erpnext.patches.v7_0.po_status_issue_for_pr_return +erpnext.patches.v7_1.update_missing_salary_component_type diff --git a/erpnext/patches/v7_0/po_status_issue_for_pr_return.py b/erpnext/patches/v7_0/po_status_issue_for_pr_return.py new file mode 100644 index 0000000000..6e92ffb8a0 --- /dev/null +++ b/erpnext/patches/v7_0/po_status_issue_for_pr_return.py @@ -0,0 +1,36 @@ +# 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(): + parent_list = [] + count = 0 + for data in frappe.db.sql(""" + select + `tabPurchase Receipt Item`.purchase_order, `tabPurchase Receipt Item`.name, + `tabPurchase Receipt Item`.item_code, `tabPurchase Receipt Item`.idx, + `tabPurchase Receipt Item`.parent + from + `tabPurchase Receipt Item`, `tabPurchase Receipt` + where + `tabPurchase Receipt Item`.parent = `tabPurchase Receipt`.name and + `tabPurchase Receipt Item`.purchase_order_item is null and + `tabPurchase Receipt Item`.purchase_order is not null and + `tabPurchase Receipt`.is_return = 1""", as_dict=1): + name = frappe.db.get_value('Purchase Order Item', + {'item_code': data.item_code, 'parent': data.purchase_order, 'idx': data.idx}, 'name') + + if name: + frappe.db.set_value('Purchase Receipt Item', data.name, 'purchase_order_item', name, update_modified=False) + parent_list.append(data.parent) + + count +=1 + if count % 200 == 0: + frappe.db.commit() + + if len(parent_list) > 0: + for parent in set(parent_list): + doc = frappe.get_doc('Purchase Receipt', parent) + doc.update_qty(update_modified=False) \ No newline at end of file diff --git a/erpnext/patches/v7_1/update_missing_salary_component_type.py b/erpnext/patches/v7_1/update_missing_salary_component_type.py new file mode 100644 index 0000000000..7f6002da00 --- /dev/null +++ b/erpnext/patches/v7_1/update_missing_salary_component_type.py @@ -0,0 +1,25 @@ +from __future__ import unicode_literals + +import frappe + +''' +Some components do not have type set, try and guess whether they turn up in +earnings or deductions in existing salary slips +''' + +def execute(): + for s in frappe.db.sql('select name from `tabSalary Component` where ifnull(type, "")=""'): + compontent = frappe.get_doc('Salary Component', s[0]) + + # guess + guess = frappe.db.sql('''select + parentfield from `tabSalary Detail` + where salary_component=%s limit 1''', s[0]) + + if guess: + compontent.type = 'Earning' if guess[0][0]=='earnings' else 'Deduction' + + else: + compontent.type = 'Deduction' + + compontent.save() \ No newline at end of file diff --git a/erpnext/patches/v7_1/update_portal_roles.py b/erpnext/patches/v7_1/update_portal_roles.py index 695f9980c0..506adb91fc 100644 --- a/erpnext/patches/v7_1/update_portal_roles.py +++ b/erpnext/patches/v7_1/update_portal_roles.py @@ -2,6 +2,7 @@ import frappe def execute(): frappe.reload_doctype('Role') + frappe.reload_doctype('User') for role_name in ('Customer', 'Supplier', 'Student'): if frappe.db.exists('Role', role_name): frappe.db.set_value('Role', role_name, 'desk_access', 0) diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css index 2bfcd3ea69..6a1d311e98 100644 --- a/erpnext/public/css/website.css +++ b/erpnext/public/css/website.css @@ -181,7 +181,6 @@ } .cart-dropdown-container .cart-items-dropdown { max-height: 350px; - overflow: auto; } .cart-dropdown-container .cart-items-dropdown .cart-dropdown { display: block; diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js index ace7fd81f3..1617283f74 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -65,7 +65,7 @@ $.extend(shopping_cart, { var cart_count = getCookie("cart_count"); if(cart_count) { - $(".shopping-cart").toggleClass('hidden', true); + $(".shopping-cart").toggleClass('hidden', false); } var $cart = $('.cart-icon'); diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less index ce36e5f59a..b270b8bed7 100644 --- a/erpnext/public/less/website.less +++ b/erpnext/public/less/website.less @@ -233,7 +233,6 @@ .cart-items-dropdown { max-height: 350px; - overflow: auto; } .cart-items-dropdown .cart-dropdown { diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 888a231cc6..707f6c4da2 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -372,7 +372,7 @@ "in_list_view": 0, "label": "Customer's Purchase Order", "length": 0, - "no_copy": 1, + "no_copy": 0, "oldfieldname": "po_no", "oldfieldtype": "Data", "permlevel": 0, @@ -403,7 +403,7 @@ "in_list_view": 0, "label": "Customer's Purchase Order Date", "length": 0, - "no_copy": 1, + "no_copy": 0, "oldfieldname": "po_date", "oldfieldtype": "Date", "permlevel": 0, @@ -3226,7 +3226,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-11-05 08:09:08.921026", + "modified": "2016-11-14 16:07:45.817880", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/stock/report/stock_balance/stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js index 43b3657d10..434c092a60 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.js +++ b/erpnext/stock/report/stock_balance/stock_balance.js @@ -8,6 +8,7 @@ frappe.query_reports["Stock Balance"] = { "label": __("From Date"), "fieldtype": "Date", "width": "80", + "reqd": 1, "default": sys_defaults.year_start_date, }, { @@ -15,6 +16,7 @@ frappe.query_reports["Stock Balance"] = { "label": __("To Date"), "fieldtype": "Date", "width": "80", + "reqd": 1, "default": frappe.datetime.get_today() }, { diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html index 5a8116cc37..c0399a787a 100644 --- a/erpnext/templates/generators/item.html +++ b/erpnext/templates/generators/item.html @@ -3,7 +3,7 @@ {% block title %} {{ title }} {% endblock %} {% block breadcrumbs %} - {% include "templates/includes/breadcrumbs.html" %} + {% include "templates/includes/breadcrumbs.html" %} {% endblock %} {% block page_content %} @@ -25,17 +25,17 @@ {{ _("Item Code") }}: {{ variant and variant.name or name }}


- {% if has_variants %} - {% for d in attributes %} + {% if has_variants %} + {% for d in attributes %} {% if attribute_values[d.attribute] -%} - + {% endfor %} + +
{%- endif %} - {% endfor %} - {% endif %} + {% endfor %} + {% endif %}
@@ -56,18 +56,17 @@

-
-
- -
- -
+
+
+ +
+ +
@@ -101,10 +100,10 @@ {% endblock %} diff --git a/erpnext/templates/includes/cart/cart_dropdown.html b/erpnext/templates/includes/cart/cart_dropdown.html index 071b28182a..de29b56fbe 100644 --- a/erpnext/templates/includes/cart/cart_dropdown.html +++ b/erpnext/templates/includes/cart/cart_dropdown.html @@ -1,6 +1,6 @@
+ style="display: none;">
{{ _("Item") }} @@ -9,13 +9,13 @@ {{ _("Price") }}
- + {% if doc.items %}
{% include "templates/includes/cart/cart_items_dropdown.html" %}
- {{ _("Checkout") }} + {{ _("Checkout") }}
{% else %}

{{ _("Cart is Empty") }}

diff --git a/erpnext/templates/includes/cart/cart_items_dropdown.html b/erpnext/templates/includes/cart/cart_items_dropdown.html index 9a3dbf89ac..b2ba4312d6 100644 --- a/erpnext/templates/includes/cart/cart_items_dropdown.html +++ b/erpnext/templates/includes/cart/cart_items_dropdown.html @@ -7,7 +7,6 @@
{{ d.get_formatted("amount") }} -
{% endfor %} \ No newline at end of file diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html index da21748f77..a25f313f60 100644 --- a/erpnext/templates/includes/macros.html +++ b/erpnext/templates/includes/macros.html @@ -1,7 +1,12 @@ {% macro product_image_square(website_image, css_class="") %} -{% if website_image -%} {%- endif %} -
+{% if website_image -%} + +{%- endif %} +
{% endmacro %} diff --git a/erpnext/templates/includes/navbar/navbar_items.html b/erpnext/templates/includes/navbar/navbar_items.html index f0c780d57d..87dea8f175 100644 --- a/erpnext/templates/includes/navbar/navbar_items.html +++ b/erpnext/templates/includes/navbar/navbar_items.html @@ -2,7 +2,7 @@ {% block navbar_right_extension %}