From afef9c1cc7cfa32da5fdc190762c2b9e47ec714f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Feb 2019 11:28:20 +0530 Subject: [PATCH 01/16] fix: Ignore tds account while creating tax withholding category --- erpnext/regional/india/setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index a6d723a824..c5498c7770 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -345,13 +345,14 @@ def set_tax_withholding_category(company): if company and tds_account: accounts = [dict(company=company, account=tds_account)] - fiscal_year = get_fiscal_year(today(), company=accounts[0].get('company'))[0] + fiscal_year = get_fiscal_year(today(), company=company)[0] docs = get_tds_details(accounts, fiscal_year) for d in docs: try: doc = frappe.get_doc(d) doc.flags.ignore_permissions = True + doc.flags.ignore_mandatory = True doc.insert() except frappe.DuplicateEntryError: doc = frappe.get_doc("Tax Withholding Category", d.get("name")) From e0412a177c22da443a0d88168d01909dcffc234f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 12 Feb 2019 11:47:16 +0530 Subject: [PATCH 02/16] fix: validation message for work order --- erpnext/stock/doctype/stock_entry/stock_entry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 5d3c6c4adc..5772c67cf9 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -293,8 +293,9 @@ class StockEntry(StockController): total_completed_qty = flt(self.fg_completed_qty) + flt(prod_order.produced_qty) completed_qty = d.completed_qty + (allowance_percentage/100 * d.completed_qty) if total_completed_qty > flt(completed_qty): - frappe.throw(_("Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order # {3}. Please update operation status via Time Logs") - .format(d.idx, d.operation, total_completed_qty, self.work_order), OperationsNotCompleteError) + job_card = frappe.db.get_value('Job Card', {'operation_id': d.name}, 'name') + frappe.throw(_("Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order # {3}. Please update operation status via Job Card # {4}") + .format(d.idx, d.operation, total_completed_qty, self.work_order, job_card), OperationsNotCompleteError) def check_duplicate_entry_for_work_order(self): other_ste = [t[0] for t in frappe.db.get_values("Stock Entry", { From 6447069e50403a9493b7f6a1e5dfdf47a451cf0b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Feb 2019 16:41:20 +0530 Subject: [PATCH 03/16] fix: show values in account/party currency based in actual entry, no conversion --- erpnext/accounts/report/general_ledger/general_ledger.py | 2 +- erpnext/accounts/report/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 8c3deaff48..be6633282a 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -101,7 +101,7 @@ def set_account_currency(filters): frappe.db.get_value(filters.party_type, filters.party[0], "default_currency")) filters["account_currency"] = account_currency or filters.company_currency - if filters.account_currency != filters.company_currency: + if filters.account_currency != filters.company_currency and not filters.presentation_currency: filters.presentation_currency = filters.account_currency return filters diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py index a8ae94f879..8a39744738 100644 --- a/erpnext/accounts/report/utils.py +++ b/erpnext/accounts/report/utils.py @@ -104,7 +104,7 @@ def convert_to_presentation_currency(gl_entries, currency_info): credit_in_account_currency = flt(entry['credit_in_account_currency']) account_currency = entry['account_currency'] - if account_currency != presentation_currency or (account_currency == presentation_currency and not is_p_or_l_account(account)): + if account_currency != presentation_currency: value = debit or credit date = currency_info['report_date'] if not is_p_or_l_account(account) else entry['posting_date'] From 5631ffca683ff3175dce52c2a95e6ad5fb592ca5 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 12 Feb 2019 17:12:48 +0530 Subject: [PATCH 04/16] fix: Barcode scanning UX --- erpnext/public/js/controllers/transaction.js | 69 ++++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 20e1098806..cf62af7b70 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -276,13 +276,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ scan_barcode: function() { let scan_barcode_field = this.frm.fields_dict["scan_barcode"]; - let show_description = function(idx, item_code, exist=null) { - if(exist) { - scan_barcode_field.set_new_description(__('Row : ') + idx + ' ' + - item_code + __(' Qty increased by 1')); + let show_description = function(idx, exist = null) { + if (exist) { + scan_barcode_field.set_new_description(__('Row #{0}: Qty increased by 1', [idx])); } else { - scan_barcode_field.set_new_description(__('New row : ') + idx + ' ' + - item_code + __(' Created')); + scan_barcode_field.set_new_description(__('Row #{0}: Item added', [idx])); } } @@ -291,38 +289,39 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ method: "erpnext.selling.page.point_of_sale.point_of_sale.search_serial_or_batch_or_barcode_number", args: { search_value: this.frm.doc.scan_barcode } }).then(r => { - - if(r && r.message && r.message.item_code) { - let child = ""; - let add_row_index = -1; - let cur_grid= this.frm.fields_dict["items"].grid; - - this.frm.doc.items.map(d => { - if(d.item_code==r.message.item_code){ - add_row_index = d.idx; - return; - } else if(!d.item_code && add_row_index==-1) { - add_row_index = d.idx; - } - }); - - if(add_row_index == -1) { - child = frappe.model.add_child(this.frm.doc, cur_grid.doctype, "items", add_row_index); - } else { - child = cur_grid.get_grid_row(add_row_index-1).doc; - } - show_description(child.idx, r.message.item_code, child.item_code); - - frappe.model.set_value(child.doctype, child.name, { - "item_code": r.message.item_code, - "qty": (child.qty || 0) + 1 - }); + const data = r && r.message; + if (!data) { + scan_barcode_field.set_new_description(__('Cannot find Item with this barcode')); + return; } - else{ - scan_barcode_field.set_new_description(this.frm.doc.scan_barcode +__(' does not exist!')); + + let cur_grid = this.frm.fields_dict.items.grid; + + let row_to_modify = null; + const existing_item_row = this.frm.doc.items.find(d => d.item_code === data.item_code); + const blank_item_row = this.frm.doc.items.find(d => !d.item_code); + + if (existing_item_row) { + row_to_modify = existing_item_row; + } else if (blank_item_row) { + row_to_modify = blank_item_row; } + + if (!row_to_modify) { + // add new row + row_to_modify = frappe.model.add_child(this.frm.doc, cur_grid.doctype, 'items'); + } + + show_description(row_to_modify.idx, row_to_modify.item_code); + + frappe.model.set_value(row_to_modify.doctype, row_to_modify.name, { + item_code: data.item_code, + qty: (row_to_modify.qty || 0) + 1 + }); + + this.frm.refresh_field('items'); }); - scan_barcode_field.set_value(""); + scan_barcode_field.set_value(''); } return false; }, From 1a3c27bbeae137d616c1641d3bd82cf744dbe25a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Feb 2019 17:38:37 +0530 Subject: [PATCH 05/16] fix: Make work order from production plan considering already ordered qty --- .../manufacturing/doctype/production_plan/production_plan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index d17adf6369..97a8ea7e3c 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -276,8 +276,8 @@ class ProductionPlan(Document): item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details else: item_details.update({ - "qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{}) - .get("qty")) + flt(d.planned_qty) + "qty": flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{}) + .get("qty")) + (flt(d.planned_qty) - flt(d.ordered_qty)) }) item_dict[(d.item_code, d.sales_order, d.warehouse)] = item_details From db527bfb245a628b1963b2bc9b0aba60540bfc69 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Feb 2019 18:30:00 +0530 Subject: [PATCH 06/16] fix: Enqueued item variants updation if there are more than 30 variants --- erpnext/stock/doctype/item/item.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 566b6386fe..bd06688caa 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -700,15 +700,14 @@ class Item(WebsiteGenerator): frappe.db.get_single_value('Item Variant Settings', 'do_not_update_variants'): return if self.has_variants: - updated = [] variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name}) - for d in variants: - variant = frappe.get_doc("Item", d) - copy_attributes_to_variant(self, variant) - variant.save() - updated.append(d.item_code) - if updated: - frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated))) + if variants: + if len(variants) <= 30: + update_variants(variants, self, publish_progress=False) + frappe.msgprint(_("Item Variants updated")) + else: + frappe.enqueue("erpnext.stock.doctype.item.item.update_variants", + variants=variants, template=self, now=frappe.flags.in_test, timeout=600) def validate_has_variants(self): if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"): @@ -997,3 +996,13 @@ def get_item_attribute(parent, attribute_value=''): return frappe.get_all("Item Attribute Value", fields = ["attribute_value"], filters = {'parent': parent, 'attribute_value': ("like", "%%%s%%" % attribute_value)}) + +def update_variants(variants, template, publish_progress=True): + count=0 + for d in variants: + variant = frappe.get_doc("Item", d) + copy_attributes_to_variant(template, variant) + variant.save() + count+=1 + if publish_progress: + frappe.publish_progress(count*100/len(variants), title = _("Updating Variants...")) \ No newline at end of file From 4d1bc0ca853030bdbcaec5a6ca4fcd4063fe399e Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Wed, 13 Feb 2019 16:58:46 +0530 Subject: [PATCH 07/16] fix: Add total row in analytics report (#16648) --- .../buying/report/purchase_analytics/purchase_analytics.json | 5 +++-- .../report/production_analytics/production_analytics.json | 5 +++-- erpnext/selling/report/sales_analytics/sales_analytics.json | 5 +++-- erpnext/stock/report/stock_analytics/stock_analytics.json | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/report/purchase_analytics/purchase_analytics.json b/erpnext/buying/report/purchase_analytics/purchase_analytics.json index 996e3eef45..7ce779d773 100644 --- a/erpnext/buying/report/purchase_analytics/purchase_analytics.json +++ b/erpnext/buying/report/purchase_analytics/purchase_analytics.json @@ -1,12 +1,13 @@ { - "add_total_row": 0, + "add_total_row": 1, "creation": "2018-10-05 16:08:24.156448", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2018-10-05 16:08:33.272201", + "modified": "2019-02-12 14:32:29.107109", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Analytics", diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.json b/erpnext/manufacturing/report/production_analytics/production_analytics.json index 023e0a8929..946cd33a1a 100644 --- a/erpnext/manufacturing/report/production_analytics/production_analytics.json +++ b/erpnext/manufacturing/report/production_analytics/production_analytics.json @@ -1,13 +1,14 @@ { - "add_total_row": 0, + "add_total_row": 1, "creation": "2018-10-11 19:28:37.085066", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", "letter_head": "", - "modified": "2018-10-11 19:28:37.085066", + "modified": "2019-02-12 14:32:16.392521", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Analytics", diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.json b/erpnext/selling/report/sales_analytics/sales_analytics.json index 5c95f28410..bd8230230b 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.json +++ b/erpnext/selling/report/sales_analytics/sales_analytics.json @@ -1,12 +1,13 @@ { - "add_total_row": 0, + "add_total_row": 1, "creation": "2018-09-21 12:46:29.451048", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2018-09-21 12:46:29.451048", + "modified": "2019-02-12 14:30:40.043652", "modified_by": "Administrator", "module": "Selling", "name": "Sales Analytics", diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.json b/erpnext/stock/report/stock_analytics/stock_analytics.json index efd5e99cbc..7a2ed2bfc2 100644 --- a/erpnext/stock/report/stock_analytics/stock_analytics.json +++ b/erpnext/stock/report/stock_analytics/stock_analytics.json @@ -1,12 +1,13 @@ { - "add_total_row": 0, + "add_total_row": 1, "creation": "2018-10-08 12:11:32.133020", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2018-10-08 12:18:42.834270", + "modified": "2019-02-12 14:32:22.874082", "modified_by": "Administrator", "module": "Stock", "name": "Stock Analytics", From 29fcb14c42130f87817f0da028cd1e3435b2a672 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 13 Feb 2019 17:18:12 +0530 Subject: [PATCH 08/16] fix: errors in deferred revenue booking --- erpnext/accounts/deferred_revenue.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py index 9ff8b04281..ae0b2593a1 100644 --- a/erpnext/accounts/deferred_revenue.py +++ b/erpnext/accounts/deferred_revenue.py @@ -60,7 +60,7 @@ def get_booking_dates(doc, item, start_date=None, end_date=None): deferred_account = "deferred_revenue_account" if doc.doctype=="Sales Invoice" else "deferred_expense_account" last_gl_entry, skip = False, False - booking_end_date = getdate(add_days(today(), -1)) if not end_date else end_date + booking_end_date = getdate(add_days(today(), -1) if not end_date else end_date) if booking_end_date < item.service_start_date or \ (item.service_stop_date and booking_end_date.month > item.service_stop_date.month): return None, None, None, True @@ -71,7 +71,7 @@ def get_booking_dates(doc, item, start_date=None, end_date=None): last_gl_entry = True booking_end_date = item.service_stop_date - booking_start_date = getdate(add_months(today(), -1)) if not start_date else start_date + booking_start_date = getdate(add_months(today(), -1) if not start_date else start_date) booking_start_date = booking_start_date \ if booking_start_date > item.service_start_date else item.service_start_date @@ -113,7 +113,6 @@ def calculate_amount_and_base_amount(doc, item, last_gl_entry, total_days, total group by voucher_detail_no '''.format(total_credit_debit, total_credit_debit_currency), (doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True) - already_booked_amount = gl_entries_details[0].total_credit if gl_entries_details else 0 base_amount = flt(item.base_net_amount - already_booked_amount, item.precision("base_net_amount")) if account_currency==doc.company_currency: @@ -136,7 +135,7 @@ def book_deferred_income_or_expense(doc, start_date=None, end_date=None): get_booking_dates(doc, item, start_date, end_date) if skip: continue - total_days = date_diff(item.service_end_date, item.service_start_date) + total_days = date_diff(item.service_end_date, item.service_start_date) + 1 total_booking_days = date_diff(booking_end_date, booking_start_date) + 1 account_currency = get_account_currency(item.expense_account) @@ -175,6 +174,10 @@ def book_deferred_income_or_expense(doc, start_date=None, end_date=None): 'project': project }, account_currency) ) - if gl_entries: - make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True) + try: + make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True) + frappe.db.commit() + except: + frappe.db.rollback() + frappe.log_error(message = frappe.get_traceback(), title = _("Error while processing deferred accounting for {0}").format(doc.name)) \ No newline at end of file From 34f4f24e214f99c9c075eb72eb26cfac573a7bf6 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 14 Feb 2019 17:26:49 +0530 Subject: [PATCH 09/16] fix: Address and contact report --- .../report/address_and_contacts/address_and_contacts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/report/address_and_contacts/address_and_contacts.py b/erpnext/selling/report/address_and_contacts/address_and_contacts.py index a9e43034b4..eb242d0a73 100644 --- a/erpnext/selling/report/address_and_contacts/address_and_contacts.py +++ b/erpnext/selling/report/address_and_contacts/address_and_contacts.py @@ -102,7 +102,8 @@ def get_party_details(party_type, party_list, doctype, party_details): records = frappe.get_list(doctype, filters=filters, fields=fields, as_list=True) for d in records: details = party_details.get(d[0]) - details.setdefault(frappe.scrub(doctype), []).append(d[1:]) + if details: + details.setdefault(frappe.scrub(doctype), []).append(d[1:]) return party_details From 4902f7b2a05d4a54a6089f40f8b31af5e4877795 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Thu, 14 Feb 2019 17:32:52 +0530 Subject: [PATCH 10/16] fix: Show tasks in timesheet with status as Closed (#16660) --- erpnext/projects/doctype/timesheet/timesheet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index e890befd1a..8811ab9543 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -18,7 +18,7 @@ frappe.ui.form.on("Timesheet", { return{ filters: { 'project': child.project, - 'status': ["!=", "Closed"] + 'status': ["!=", "Cancelled"] } } } From 867ca63750f04cd6dcc081e31e682c55207bdf92 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 14 Feb 2019 18:08:37 +0530 Subject: [PATCH 11/16] fix: Purchase order item description fix --- erpnext/buying/doctype/purchase_order/purchase_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 3c4ef2b17f..a4a636d6ba 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -456,7 +456,7 @@ def make_rm_stock_entry(purchase_order, rm_items): items_dict = { rm_item_code: { "item_name": rm_item_data["item_name"], - "description": item_wh[rm_item_code].get('description'), + "description": item_wh.get(rm_item_code, {}).get('description', ""), 'qty': rm_item_data["qty"], 'from_warehouse': rm_item_data["warehouse"], 'stock_uom': rm_item_data["stock_uom"], From 0d1ccc357f522528e59511f431ccb3ca7ce42cb3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 14 Feb 2019 18:30:10 +0530 Subject: [PATCH 12/16] fix: get item details --- erpnext/stock/get_item_details.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index ec1031c70f..74f35953e2 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -16,6 +16,9 @@ from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults from six import string_types, iteritems +sales_doctypes = ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'] +purchase_doctypes = ['Material Request', 'Supplier Quotation', 'Purchase Order', 'Purchase Receipt', 'Purchase Invoice'] + @frappe.whitelist() def get_item_details(args): """ @@ -228,7 +231,7 @@ def get_basic_details(args, item): #Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master if not args.uom: - if args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']: + if args.get('doctype') in sales_doctypes: args.uom = item.sales_uom if item.sales_uom else item.stock_uom elif (args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']) or \ (args.get('doctype') == 'Material Request' and args.get('material_request_type') == 'Purchase'): @@ -281,14 +284,15 @@ def get_basic_details(args, item): out.conversion_factor = 1.0 else: out.conversion_factor = args.conversion_factor or \ - get_conversion_factor(item.item_code, args.uom).get("conversion_factor") + get_conversion_factor(item.name, args.uom).get("conversion_factor") args.conversion_factor = out.conversion_factor out.stock_qty = out.qty * out.conversion_factor # calculate last purchase rate - from erpnext.buying.doctype.purchase_order.purchase_order import item_last_purchase_rate - out.last_purchase_rate = item_last_purchase_rate(args.name, args.conversion_rate, item.item_code, out.conversion_factor) + if args.get('doctype') in purchase_doctypes: + from erpnext.buying.doctype.purchase_order.purchase_order import item_last_purchase_rate + out.last_purchase_rate = item_last_purchase_rate(args.name, args.conversion_rate, item.name, out.conversion_factor) # if default specified in item is for another company, fetch from company for d in [ From 6f7a4d94cefb2458c4ec973e35d13d93510c0b0f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 14 Feb 2019 19:34:43 +0530 Subject: [PATCH 13/16] fix: Consider parenttype while updating total qty in transactions --- erpnext/patches/v11_0/update_total_qty_field.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py index fcb76af459..cc8524f3c2 100644 --- a/erpnext/patches/v11_0/update_total_qty_field.py +++ b/erpnext/patches/v11_0/update_total_qty_field.py @@ -19,9 +19,10 @@ def execute(): SELECT parent, SUM(qty) as qty FROM - `tab%s Item` + `tab{0} Item` + where parenttype = %s GROUP BY parent - ''' % (doctype), as_dict = True) + '''.format(doctype), doctype, as_dict = True) # Query to update total_qty might become too big, Update in batches # batch_size is chosen arbitrarily, Don't try too hard to reason about it From 4df7679c65b8b1ebe07d9d02cee6c72b01319507 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 15 Feb 2019 13:08:04 +0530 Subject: [PATCH 14/16] fix: Get outstanding invoices --- erpnext/accounts/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 58e3e8793d..d4e1840eb9 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -615,7 +615,7 @@ def get_held_invoices(party_type, party): return held_invoices -def get_outstanding_invoices(party_type, party, account, condition=None, limit=1000): +def get_outstanding_invoices(party_type, party, account, condition=None, limit=None): outstanding_invoices = [] precision = frappe.get_precision("Sales Invoice", "outstanding_amount") or 2 @@ -628,7 +628,7 @@ def get_outstanding_invoices(party_type, party, account, condition=None, limit=1 invoice = 'Sales Invoice' if erpnext.get_party_account_type(party_type) == 'Receivable' else 'Purchase Invoice' held_invoices = get_held_invoices(party_type, party) - limit_cond = "limit %s" % (limit or 1000) + limit_cond = "limit %s" % limit if limit else "" invoice_list = frappe.db.sql(""" select From a0c9c7501b7aa378cf1001b1bc1c41f61db8bbd9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 15 Feb 2019 14:24:08 +0530 Subject: [PATCH 15/16] Update update_total_qty_field.py --- erpnext/patches/v11_0/update_total_qty_field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py index cc8524f3c2..992454ac7c 100644 --- a/erpnext/patches/v11_0/update_total_qty_field.py +++ b/erpnext/patches/v11_0/update_total_qty_field.py @@ -20,9 +20,9 @@ def execute(): parent, SUM(qty) as qty FROM `tab{0} Item` - where parenttype = %s + where parenttype = '{0}' GROUP BY parent - '''.format(doctype), doctype, as_dict = True) + '''.format(doctype), as_dict = True) # Query to update total_qty might become too big, Update in batches # batch_size is chosen arbitrarily, Don't try too hard to reason about it From acf26c8569f8c34354cdc2c15935beaaa558e19a Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Fri, 15 Feb 2019 10:22:32 +0000 Subject: [PATCH 16/16] bumped to version 11.1.6 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 40e094d1ba..465c283ad9 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__ = '11.1.5' +__version__ = '11.1.6' def get_default_company(user=None): '''Get default company for user'''