From f4dc71661d1d07e883e83b5a27ba9b4b1bbce7cf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 15 Nov 2018 17:04:02 +0530 Subject: [PATCH 01/10] [Fix] Address not set from the API --- erpnext/controllers/buying_controller.py | 12 ++++++++++++ erpnext/controllers/selling_controller.py | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index cd3cbe97c9..7ed225fa28 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -10,6 +10,7 @@ from erpnext.accounts.party import get_party_details from erpnext.stock.get_item_details import get_conversion_factor from erpnext.buying.utils import validate_for_items, update_last_purchase_rate from erpnext.stock.stock_ledger import get_valuation_rate +from frappe.contacts.doctype.address.address import get_address_display from erpnext.controllers.stock_controller import StockController @@ -39,6 +40,7 @@ class BuyingController(StockController): self.set_qty_as_per_stock_uom() self.validate_stock_or_nonstock_items() self.validate_warehouse() + self.set_supplier_address() if self.doctype=="Purchase Invoice": self.validate_purchase_receipt_if_update_stock() @@ -96,6 +98,16 @@ class BuyingController(StockController): if not d.cost_center and lc_voucher_data and lc_voucher_data[0][1]: d.db_set('cost_center', lc_voucher_data[0][1]) + def set_supplier_address(self): + address_dict = { + 'supplier_address': 'address_display', + 'shipping_address': 'shipping_address_display' + } + + for address_field, address_display_field in address_dict.items(): + if self.get(address_field): + self.set(address_display_field, get_address_display(self.get(address_field))) + def set_total_in_words(self): from frappe.utils import money_in_words if self.meta.get_field("base_in_words"): diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index be5f64ecb1..5c203aff69 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -8,6 +8,7 @@ from frappe import _, throw from erpnext.stock.get_item_details import get_bin_details from erpnext.stock.utils import get_incoming_rate from erpnext.stock.get_item_details import get_conversion_factor +from frappe.contacts.doctype.address.address import get_address_display from erpnext.controllers.stock_controller import StockController @@ -40,6 +41,7 @@ class SellingController(StockController): self.validate_selling_price() self.set_qty_as_per_stock_uom() self.set_po_nos() + self.set_customer_address() check_active_sales_items(self) def set_missing_values(self, for_validate=False): @@ -344,6 +346,17 @@ class SellingController(StockController): po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)}) self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no]))) + def set_customer_address(self): + address_dict = { + 'customer_address': 'address_display', + 'shipping_address_name': 'shipping_address', + 'company_address': 'company_address_display' + } + + for address_field, address_display_field in address_dict.items(): + if self.get(address_field): + self.set(address_display_field, get_address_display(self.get(address_field))) + def validate_items(self): # validate items to see if they have is_sales_item enabled from erpnext.controllers.buying_controller import validate_item_type From 27a0c3796399fca289a5a7ec9033dd7ad7e71a09 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Thu, 15 Nov 2018 19:21:30 +0000 Subject: [PATCH 02/10] css: build files in v10 --- erpnext/public/css/erpnext.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index 460efbfe9f..c55e422151 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -346,6 +346,11 @@ body[data-route="pos"] .btn-more { body[data-route="pos"] .collapse-btn { cursor: pointer; } +@media (max-width: 767px) { + body[data-route="pos"] .page-actions { + max-width: 110px; + } +} .price-info { position: absolute; left: 0; From f838597b5faec9994155edd191a8d16482cdee63 Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Tue, 20 Nov 2018 13:12:13 +0530 Subject: [PATCH 03/10] fix(task): Fix error when trying to convert a task into a group even if no child tasks exist --- erpnext/projects/doctype/task/task.js | 10 +++++----- erpnext/projects/doctype/task/task.py | 15 ++++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index b8f324a85f..c1a9c448b4 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -80,15 +80,15 @@ frappe.ui.form.on("Task", { } }, - is_group: function(frm) { + is_group: function (frm) { frappe.call({ - method:"erpnext.projects.doctype.task.task.check_if_child_exists", + method: "erpnext.projects.doctype.task.task.check_if_child_exists", args: { name: frm.doc.name }, - callback: function(r){ - if(r.message){ - frappe.msgprint(__('Cannot convert it to non-group. Child Tasks exist.')); + callback: function (r) { + if (r.message.length > 0) { + frappe.msgprint(__(`Cannot convert it to non-group. The following child Tasks exist: ${r.message.join(", ")}.`)); frm.reload_doc(); } } diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 3dc52d4ebe..649d73a63f 100755 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -2,12 +2,15 @@ # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals -import frappe, json -from frappe.utils import getdate, date_diff, add_days, cstr +import json + +import frappe from frappe import _, throw +from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate from frappe.utils.nestedset import NestedSet + class CircularReferenceError(frappe.ValidationError): pass class Task(NestedSet): @@ -157,8 +160,10 @@ class Task(NestedSet): @frappe.whitelist() def check_if_child_exists(name): - return frappe.db.sql("""select name from `tabTask` - where parent_task = %s""", name) + child_tasks = frappe.get_all("Task", filters={"parent_task": name}) + child_tasks = [get_link_to_form("Task", task.name) for task in child_tasks] + return child_tasks + def get_project(doctype, txt, searchfield, start, page_len, filters): from erpnext.controllers.queries import get_match_cond @@ -237,4 +242,4 @@ def add_multiple_tasks(data, parent): new_task.insert() def on_doctype_update(): - frappe.db.add_index("Task", ["lft", "rgt"]) \ No newline at end of file + frappe.db.add_index("Task", ["lft", "rgt"]) From 6424f47f3bd5054643edacc1261099ffe0435306 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 21 Nov 2018 23:18:41 +0530 Subject: [PATCH 04/10] [Fix] Incorrect stock value difference because of negative stock --- erpnext/stock/stock_ledger.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 53267d64bc..43140faff6 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -176,7 +176,11 @@ class update_entries_after(object): # rounding as per precision self.stock_value = flt(self.stock_value, self.precision) - stock_value_difference = self.stock_value - self.prev_stock_value + if self.prev_stock_value < 0 and self.stock_value >= 0: + stock_value_difference = sle.actual_qty * self.valuation_rate + else: + stock_value_difference = self.stock_value - self.prev_stock_value + self.prev_stock_value = self.stock_value # update current sle From 5dbb9f5312b42f907fdbac939bc1ea7ecaa06975 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Fri, 23 Nov 2018 19:54:08 +0530 Subject: [PATCH 05/10] Accounts receivable summary print fix --- .../accounts_receivable.html | 6 +- .../accounts_receivable_summary.py | 104 +++++++++++++++--- 2 files changed, 89 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 933c6ddf89..b4276a10cd 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -194,7 +194,7 @@ {% if(!filters.show_pdc_in_print) { %} {%= format_currency(data[i]["paid_amount"], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["debit_note"], data[i]["currency"]) %} {% } %} {%= format_currency(data[i]["outstanding_amount"], data[i]["currency"]) %} @@ -220,7 +220,7 @@
{%= data[i][__("Customer Name")] %} {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
{%= data[i][__("Supplier Name")] %} - {% } %} + {% } %} {% } %}
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %} @@ -230,7 +230,7 @@ {% } %} {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("credit_note_amt")], data[i]["currency"]) : format_currency(data[i][__("debit_note_amt")], data[i]["currency"]) %} {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} {% } %} {% } %} diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 08b24fb147..fdb7ec82ca 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe import _ +from frappe import _, scrub from frappe.utils import flt from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport @@ -18,25 +18,93 @@ class AccountsReceivableSummary(ReceivablePayableReport): if party_naming_by == "Naming Series": columns += [ args.get("party_type") + " Name::140"] - credit_debit_label = _("Credit Note Amt") if args.get('party_type') == 'Customer' else _("Debit Note Amt") + credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt" + + columns += [{ + "label": _("Total Invoiced Amt"), + "fieldname": "total_invoiced_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }, + { + "label": _("Total Paid Amt"), + "fieldname": "total_paid_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }] + columns += [ - _("Total Invoiced Amt") + ":Currency/currency:140", - _("Total Paid Amt") + ":Currency/currency:140", - credit_debit_label + ":Currency/currency:140", - _("Total Outstanding Amt") + ":Currency/currency:160", - "0-" + str(self.filters.range1) + ":Currency/currency:100", - str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100", - str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100", - str(self.filters.range3) + _("-Above") + ":Currency/currency:100"] + { + "label": _(credit_debit_label), + "fieldname": scrub(credit_debit_label), + "fieldtype": "Currency", + "options": "currency", + "width": 140 + }, + { + "label": _("Total Outstanding Amt"), + "fieldname": "total_outstanding_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _("0-" + str(self.filters.range1)), + "fieldname": scrub("0-" + str(self.filters.range1)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldname": scrub(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldname": scrub(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range3) + _("-Above")), + "fieldname": scrub(str(self.filters.range3) + _("-Above")), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + } + ] if args.get("party_type") == "Customer": - columns += [ - _("Territory") + ":Link/Territory:80", - _("Customer Group") + ":Link/Customer Group:120" - ] + columns += [{ + "label": _("Territory"), + "fieldname": "territory", + "fieldtype": "Link", + "options": "Territory", + "width": 80 + }, + { + "label": _("Customer Group"), + "fieldname": "customer_group", + "fieldtype": "Link", + "options": "Customer Group", + "width": 80 + }] + if args.get("party_type") == "Supplier": - columns += [_("Supplier Type") + ":Link/Supplier Type:80"] - + columns += [{ + "label": _("Supplier Group"), + "fieldname": "supplier_group", + "fieldtype": "Link", + "options": "Supplier Group", + "width": 80 + }] + columns.append({ "fieldname": "currency", "label": _("Currency"), @@ -67,7 +135,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): row += [self.get_territory(party), self.get_customer_group(party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(party)] - + row.append(party_dict.currency) data.append(row) @@ -91,7 +159,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): for k in party_total[d.party].keys(): if k != "currency": party_total[d.party][k] += flt(d.get(k, 0)) - + party_total[d.party].currency = d.currency return party_total From 3893ba302c8086c3fc63e1214de4b3d7aed88193 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 26 Nov 2018 14:03:23 +0530 Subject: [PATCH 06/10] If is pos and no pos profile use the item's default warehouse for packing materials --- erpnext/stock/doctype/packed_item/packed_item.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py index 0c55b433a1..e0ad7ac9df 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.py +++ b/erpnext/stock/doctype/packed_item/packed_item.py @@ -49,8 +49,9 @@ def update_packing_list_item(doc, packing_item_code, qty, main_item_row, descrip pi.qty = flt(qty) pi.description = description if not pi.warehouse: - pi.warehouse = (main_item_row.warehouse - if (doc.get('is_pos') or not item.default_warehouse) else item.default_warehouse) + pi.warehouse = (main_item_row.warehouse if ((doc.get('is_pos') + or not item.default_warehouse) and main_item_row.warehouse) else item.default_warehouse) + if not pi.batch_no: pi.batch_no = cstr(main_item_row.get("batch_no")) if not pi.target_warehouse: From 5281fe8e500c3abfbd049c572fe59be1ea8c0af6 Mon Sep 17 00:00:00 2001 From: "shreyashah115@gmail.com" Date: Tue, 27 Nov 2018 13:11:30 +0530 Subject: [PATCH 07/10] fix: Element selector --- erpnext/public/js/projects/timer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js index 8b1d1b158b..26be997d48 100644 --- a/erpnext/public/js/projects/timer.js +++ b/erpnext/public/js/projects/timer.js @@ -44,8 +44,8 @@ erpnext.timesheet.timer = function(frm, row, timestamp=0) { }; erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) { - var $btn_start = $(".playpause .btn-start"); - var $btn_complete = $(".playpause .btn-complete"); + var $btn_start = dialog.$wrapper.find(".playpause .btn-start"); + var $btn_complete = dialog.$wrapper.find(".playpause .btn-complete"); var interval = null; var currentIncrement = timestamp; var initialised = row ? true : false; From 10bcd5113cf03e55f1d86ca2f11744a2d8f2eb60 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 27 Nov 2018 16:25:35 +0530 Subject: [PATCH 08/10] [Fix] Accounts receivable summary print is not working --- .../report/accounts_receivable/accounts_receivable.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 933c6ddf89..ae8141e9f0 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -228,10 +228,10 @@ {% } else { %} {%= __("Total") %} {% } %} - {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} - {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Invoiced Amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Paid Amt")], data[i]["currency"]) %} {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Outstanding Amt")], data[i]["currency"]) %} {% } %} {% } %} From e3136c38e1c1ee10211a7606da4e15f97336347b Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 28 Nov 2018 07:57:27 +0000 Subject: [PATCH 09/10] bumped to version 10.1.73 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d6bb2d7aab..97359ede97 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.72' +__version__ = '10.1.73' def get_default_company(user=None): '''Get default company for user''' From 5780e865b7a072c55599fc70df76ed9e877d176e Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 28 Nov 2018 08:28:36 +0000 Subject: [PATCH 10/10] bumped to version 11.0.3-beta.25 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 43afa2ae28..cbd3939b7b 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.24' +staging_version = '11.0.3-beta.25' error_report_email = "support@erpnext.com"