From 57a19055767e0333f90de9af0959272310c7423f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 20 Sep 2016 17:22:54 +0530 Subject: [PATCH 1/4] [minor] bring back old grid style in material request --- erpnext/setup/setup_wizard/domainify.py | 3 +- .../material_request/material_request.py | 6 +-- .../form_grid/material_request_grid.html | 49 +++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 erpnext/templates/form_grid/material_request_grid.html diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py index 67d77a85df..05af9a6f7f 100644 --- a/erpnext/setup/setup_wizard/domainify.py +++ b/erpnext/setup/setup_wizard/domainify.py @@ -63,7 +63,8 @@ def get_domain(domain): 'Education': { 'desktop_icons': ['Student', 'Program', 'Course', 'Student Group', 'Instructor', 'Fees', 'ToDo', 'Schools'], - 'allow_roles': ['Academics User', 'Accounts User', 'Accounts Manager', 'Website Manager'], + 'allow_roles': ['Academics User', 'Accounts User', 'Accounts Manager', 'Item Manager', + 'Website Manager', 'HR User', 'HR Manager', 'Purchase User', 'Purchase Manager'], 'allow_sidebar_items': ['/announcement', '/course', '/assessment', '/fees'] }, } diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index b1f142386c..0be2baee0c 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -15,9 +15,9 @@ from erpnext.controllers.buying_controller import BuyingController from erpnext.manufacturing.doctype.production_order.production_order import get_item_details -# form_grid_templates = { -# "items": "templates/form_grid/material_request_grid.html" -# } +form_grid_templates = { + "items": "templates/form_grid/material_request_grid.html" +} class MaterialRequest(BuyingController): def get_feed(self): diff --git a/erpnext/templates/form_grid/material_request_grid.html b/erpnext/templates/form_grid/material_request_grid.html new file mode 100644 index 0000000000..866c06e586 --- /dev/null +++ b/erpnext/templates/form_grid/material_request_grid.html @@ -0,0 +1,49 @@ +{% var visible_columns = row.get_visible_columns(["item_code", "warehouse", + "item_name", "amount", "stock_uom", "uom", "qty", "schedule_date"]); %} + +{% if(!doc) { %} +
+
{%= __("Item") %}
+
{%= __("Required On") %}
+
{%= __("Warehouse") %}
+
{%= __("Qty") %}
+
+{% } else { %} +
+
+ {%= doc.item_code %} + {% if(doc.item_name != doc.item_code) { %} +
{%= doc.item_name %}{% } %} + + {% include "templates/form_grid/includes/visible_cols.html" %} +
+ + +
+ {% if(doc.schedule_date) { %} + + {%= doc.get_formatted("schedule_date") %} + {% } %} +
+ + +
+ {% if(doc.warehouse) { %} + + {%= doc.warehouse %} + + {% } %} +
+ + +
+ {%= doc.get_formatted("qty") %} + {%= doc.uom || doc.stock_uom %} +
+
+{% } %} From d12990ff57b5dbc35611f3096e7248322ab07085 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Sep 2016 18:20:58 +0530 Subject: [PATCH 2/4] Update update_home_page.py --- erpnext/patches/v7_0/update_home_page.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v7_0/update_home_page.py b/erpnext/patches/v7_0/update_home_page.py index 7bc7a2e202..ed88e203e6 100644 --- a/erpnext/patches/v7_0/update_home_page.py +++ b/erpnext/patches/v7_0/update_home_page.py @@ -13,7 +13,7 @@ def execute(): header = frappe.db.get_value('Web Page', website_settings.home_page, 'header') if header and header.startswith("
"): homepage = frappe.get_doc('Homepage', 'Homepage') - homepage.company = erpnext.get_default_company() + homepage.company = erpnext.get_default_company() or frappe.get_all("Company")[0].name if '

' in header: homepage.tag_line = header.split('

')[1].split('

')[0] or 'Default Website' else: From aac32d644dc1c06d051930e3aecc8d4b768c47e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2016 11:46:07 +0530 Subject: [PATCH 3/4] Fix in Sales Register for multiple mode of payments --- .../item_wise_sales_register.py | 17 +++++++++---- .../report/sales_register/sales_register.py | 24 +++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 9f303499cb..a2f2de367e 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt +from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments def execute(filters=None): if not filters: filters = {} @@ -21,6 +22,7 @@ def execute(filters=None): "width": 80 }) company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + mode_of_payments = get_mode_of_payments(set([d.parent for d in item_list])) data = [] for d in item_list: @@ -32,7 +34,8 @@ def execute(filters=None): from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail)) row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name, - d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order, + d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])), + d.territory, d.project, d.company, d.sales_order, delivery_note, d.income_account, d.cost_center, d.qty, d.base_net_rate, d.base_net_amount] for tax in tax_accounts: @@ -52,7 +55,7 @@ def get_columns(): _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120", _("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Receivable Account") + ":Link/Account:120", - _("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80", + _("Mode of Payment") + "::120", _("Territory") + ":Link/Territory:80", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140", _("Cost Center") + ":Link/Cost Center:140", @@ -68,10 +71,14 @@ def get_conditions(filters): ("customer", " and si.customer = %(customer)s"), ("item_code", " and si_item.item_code = %(item_code)s"), ("from_date", " and si.posting_date>=%(from_date)s"), - ("to_date", " and si.posting_date<=%(to_date)s"), - ("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")): + ("to_date", " and si.posting_date<=%(to_date)s")): if filters.get(opts[0]): conditions += opts[1] + + if filters.get("mode_of_payment"): + conditions += """ and exists(select name from `tabSales Invoice Payment` + where parent=si.name + and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)""" return conditions @@ -84,7 +91,7 @@ def get_items(filters): si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, si_item.cost_center, si_item.qty, si_item.base_net_rate, si_item.base_net_amount, si.customer_name, - si.customer_group, si_item.so_detail, si.mode_of_payment + si.customer_group, si_item.so_detail from `tabSales Invoice` si, `tabSales Invoice Item` si_item where si.name = si_item.parent and si.docstatus = 1 %s order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1) diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 663c5c95cc..97b717341b 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -23,6 +23,7 @@ def execute(filters=None): invoice_so_dn_map = get_invoice_so_dn_map(invoice_list) customer_map = get_customer_deatils(invoice_list) company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list]) data = [] for inv in invoice_list: @@ -33,7 +34,7 @@ def execute(filters=None): row = [inv.name, inv.posting_date, inv.customer, inv.customer_name, customer_map.get(inv.customer, {}).get("customer_group"), customer_map.get(inv.customer, {}).get("territory"), - inv.debit_to, inv.mode_of_payment, inv.project, inv.remarks, + inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])), inv.project, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note), company_currency] # map income values @@ -68,7 +69,7 @@ def get_columns(invoice_list): _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120", _("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80", - _("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + ":Link/Mode of Payment:80", + _("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120", _("Project") +":Link/Project:80", _("Remarks") + "::150", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", { @@ -113,8 +114,11 @@ def get_conditions(filters): if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s" if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s" - if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s" - + if filters.get("mode_of_payment"): + conditions += """ and exists(select name from `tabSales Invoice Payment` + where parent=`tabSales Invoice`.name + and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)""" + return conditions def get_invoices(filters): @@ -188,3 +192,15 @@ def get_customer_deatils(invoice_list): customer_map.setdefault(cust.name, cust) return customer_map + + +def get_mode_of_payments(invoice_list): + mode_of_payments = {} + inv_mop = frappe.db.sql("""select parent, mode_of_payment + from `tabSales Invoice Payment` where parent in (%s) group by parent, mode_of_payment""" % + ', '.join(['%s']*len(invoice_list)), tuple(invoice_list), as_dict=1) + + for d in inv_mop: + mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment) + + return mode_of_payments \ No newline at end of file From 4fead634192f1b71317ac94eb9f16aedbc18b8d3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Sep 2016 13:35:26 +0600 Subject: [PATCH 4/4] bumped to version 7.0.45 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index bdfd22283b..bf4ca7f471 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.44' +__version__ = '7.0.45' def get_default_company(user=None): '''Get default company for user'''