From aaa6d1f1bc65890d50203ac9f0e8a4533284a8bf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 8 Sep 2016 01:27:16 +0530 Subject: [PATCH 1/8] patch fix --- erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py | 4 ++-- ...gbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py index 8de92b7f59..e0e3f7075a 100644 --- a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py +++ b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py @@ -29,8 +29,8 @@ def execute(): row.db_update() si_doc.set_paid_amount() - si_doc.db_set("paid_amount", si_doc.paid_amount) - si_doc.db_set("base_paid_amount", si_doc.base_paid_amount) + si_doc.db_set("paid_amount", si_doc.paid_amount, update_modified = False) + si_doc.db_set("base_paid_amount", si_doc.base_paid_amount, update_modified = False) count +=1 diff --git a/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py b/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py index 695c552f06..7f3b755428 100644 --- a/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py +++ b/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py @@ -9,6 +9,6 @@ def execute(): ts = si_doc.append('timesheets',{}) ts.time_sheet = time_sheet.name ts.billing_amount = time_sheet.total_billing_amount - si_doc.update_time_sheet(time_sheet.sales_invoice) - si_doc.flags.ignore_validate_update_after_submit = True - si_doc.save() \ No newline at end of file + ts.db_update() + si_doc.calculate_billing_amount_from_timesheet() + si_doc.db_set("total_billing_amount", si_doc.total_billing_amount, update_modified = False) \ No newline at end of file From 3aa315040fc2a016230fb87127f4b4aeb793ff40 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sun, 11 Sep 2016 16:48:24 +0530 Subject: [PATCH 2/8] [fix] paging for item group --- .../setup/doctype/item_group/item_group.js | 8 +++++++- .../setup/doctype/item_group/item_group.py | 4 +++- erpnext/stock/doctype/item/item.py | 20 ++++++++++--------- erpnext/templates/generators/item_group.html | 6 +++--- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index 46d403417d..c55c7cbf12 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -20,7 +20,13 @@ frappe.ui.form.on("Item Group", { frm.trigger("set_root_readonly"); frm.add_custom_button(__("Item Group Tree"), function() { frappe.set_route("Tree", "Item Group"); - }, "icon-sitemap"); + }); + + if(!frm.is_new()) { + frm.add_custom_button(__("Items"), function() { + frappe.set_route("List", "Item", {"item_group": frm.doc.name}); + }); + } }, set_root_readonly: function(frm) { diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 5375db0b60..12899cddd0 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -60,13 +60,15 @@ class ItemGroup(NestedSet, WebsiteGenerator): def get_context(self, context): context.show_search=True + context.page_length = 6 context.search_link = '/product_search' start = int(frappe.form_dict.start or 0) if start < 0: start = 0 context.update({ - "items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("search")), + "items": get_product_list_for_group(product_group = self.name, start=start, + limit=context.page_length, search=frappe.form_dict.get("search")), "parent_groups": get_parent_item_groups(self.name), "title": self.name, "products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list')) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index b546df4126..454fc70981 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -455,16 +455,18 @@ class Item(WebsiteGenerator): def cant_change(self): if not self.get("__islocal"): - vals = frappe.db.get_value("Item", self.name, ["has_serial_no", "is_stock_item", - "valuation_method", "has_batch_no", "is_fixed_asset"], as_dict=True) + to_check = ("has_serial_no", "is_stock_item", + "valuation_method", "has_batch_no", "is_fixed_asset") - if vals and ((self.is_stock_item != vals.is_stock_item) or - vals.has_serial_no != self.has_serial_no or - vals.has_batch_no != self.has_batch_no or - cstr(vals.valuation_method) != cstr(self.valuation_method)): - if self.check_if_linked_document_exists(): - frappe.throw(_("As there are existing transactions for this item, \ - you can not change the values of 'Has Serial No', 'Has Batch No', 'Is Stock Item' and 'Valuation Method'")) + vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True) + + if vals: + for key in to_check: + if self.get(key) != vals.get(key): + if not self.check_if_linked_document_exists(): + break # no linked document, allowed + else: + frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key)))) if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset: asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1) diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html index b9926d6433..674143d087 100644 --- a/erpnext/templates/generators/item_group.html +++ b/erpnext/templates/generators/item_group.html @@ -31,10 +31,10 @@
{% if frappe.form_dict.start|int > 0 %} - Prev + Prev {% endif %} - {% if items|length == 24 %} - Next + {% if items|length == page_length %} + Next {% endif %}
{% else %} From a36a88b6de2a625d1041c860a182230cdd214b11 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 12 Sep 2016 13:15:44 +0530 Subject: [PATCH 3/8] Remove Difference Account field from Stock Entry parent form --- .../purchase_invoice/purchase_invoice.py | 3 ++ .../doctype/sales_invoice/sales_invoice.py | 2 ++ .../stock/doctype/stock_entry/stock_entry.js | 8 ----- .../doctype/stock_entry/stock_entry.json | 29 +------------------ .../stock/doctype/stock_entry/stock_entry.py | 6 ---- .../doctype/stock_entry/stock_entry_utils.py | 2 -- 6 files changed, 6 insertions(+), 44 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 38cef3134e..adc30e2de7 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -302,6 +302,9 @@ class PurchaseInvoice(BuyingController): asset.save() def make_gl_entries(self, repost_future_gle=True): + if not self.grand_total: + return + self.auto_accounting_for_stock = \ cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a5028c5ee5..2b64d17046 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -491,6 +491,8 @@ class SalesInvoice(SellingController): throw(_("Delivery Note {0} is not submitted").format(d.delivery_note)) def make_gl_entries(self, repost_future_gle=True): + if not self.grand_total: + return gl_entries = self.get_gl_entries() if gl_entries: diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6c2a14b50c..a9d978a9c7 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -40,14 +40,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } } } - this.frm.set_query("difference_account", function() { - return { - "filters": { - "company": me.frm.doc.company, - "is_group": 0 - } - }; - }); } this.frm.get_field('items').grid.editable_fields = [ diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json index b5efc90010..0ab80c28fe 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.json +++ b/erpnext/stock/doctype/stock_entry/stock_entry.json @@ -844,33 +844,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "description": "", - "fieldname": "difference_account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Difference Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -1431,7 +1404,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-04-07 06:40:03.284036", + "modified": "2016-09-08 06:40:03.284036", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index e35f3d2965..b1f8c9c676 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -71,9 +71,6 @@ class StockEntry(StockController): if self.purpose not in valid_purposes: frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes))) - if self.purpose in ("Manufacture", "Repack") and not self.difference_account: - self.difference_account = frappe.db.get_value("Company", self.company, "default_expense_account") - def set_transfer_qty(self): for item in self.get("items"): if not flt(item.qty): @@ -97,9 +94,6 @@ class StockEntry(StockController): if f in ["stock_uom", "conversion_factor"] or not item.get(f): item.set(f, item_details.get(f)) - if self.difference_account and not item.expense_account: - item.expense_account = self.difference_account - if not item.transfer_qty and item.qty: item.transfer_qty = item.qty * item.conversion_factor diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py index b75eeeadd7..cb3bb7bc5e 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py @@ -57,8 +57,6 @@ def make_stock_entry(**args): s.purchase_receipt_no = args.purchase_receipt_no s.delivery_note_no = args.delivery_note_no s.sales_invoice_no = args.sales_invoice_no - if args.difference_account: - s.difference_account = args.difference_account if not args.cost_center: args.cost_center = frappe.get_value('Company', s.company, 'cost_center') From 03e5e68a7a1a37cc95882762189ea24317383712 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 12 Sep 2016 16:14:06 +0530 Subject: [PATCH 4/8] [Fix] Employee name is missing in timesheet --- erpnext/patches.txt | 1 + erpnext/projects/doctype/timesheet/timesheet.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0c6a978a9b..dfc926dc66 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -316,3 +316,4 @@ erpnext.patches.v7_0.repost_gle_for_pos_sales_return 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 +execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null") diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 0379f906de..0c49353931 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -20,12 +20,17 @@ class OverProductionLoggedError(frappe.ValidationError): pass class Timesheet(Document): def validate(self): + self.set_employee_name() self.set_status() self.validate_dates() self.validate_time_logs() self.update_cost() self.calculate_total_amounts() + def set_employee_name(self): + if self.employee and not self.employee_name: + self.employee_name = frappe.db.get_value('Employee', self.employee, 'employee_name') + def calculate_total_amounts(self): self.total_hours = 0.0 self.total_billing_amount = 0.0 From daee44906392c5a1ce4e5d0792e6507fb95ee6ee Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 12 Sep 2016 16:42:36 +0530 Subject: [PATCH 5/8] [fix] for print format draft (#6346) --- .../payment_receipt_voucher/payment_receipt_voucher.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html index a4f8fa6e9f..f2e65d3334 100644 --- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html +++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html @@ -2,7 +2,7 @@
{%- if not doc.get("print_heading") and not doc.get("select_print_heading") and doc.set("select_print_heading", _("Payment Receipt Note")) -%}{%- endif -%} - {{ add_header(0, 1, doc, letter_head, no_letterhead) }} + {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} {%- for label, value in ( (_("Received On"), frappe.utils.formatdate(doc.voucher_date)), From a5de83351e02bc2168da71bb3fe013968cdda6de Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 13 Sep 2016 12:36:37 +0530 Subject: [PATCH 6/8] [Fix] Timesheet patch --- erpnext/patches/v7_0/remove_doctypes_and_reports.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py index 978c363562..0a302b1441 100644 --- a/erpnext/patches/v7_0/remove_doctypes_and_reports.py +++ b/erpnext/patches/v7_0/remove_doctypes_and_reports.py @@ -1,9 +1,10 @@ import frappe def execute(): - for doctype in ['Time Log Batch', 'Time Log Batch Detail', 'Time Log']: - frappe.delete_doc('DocType', doctype) - + if frappe.db.table_exists("Time Log"): + frappe.db.sql("""delete from `tabDocType` + where name in('Time Log Batch', 'Time Log Batch Detail', 'Time Log')""") + report = "Daily Time Log Summary" if frappe.db.exists("Report", report): frappe.delete_doc('Report', report) \ No newline at end of file From 4bd08182acc90859f66cd685707337a9cae09107 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 13 Sep 2016 13:35:53 +0530 Subject: [PATCH 7/8] [Fix] Timesheet calendar permission issue --- erpnext/projects/doctype/timesheet/timesheet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 0379f906de..968974469c 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -8,6 +8,7 @@ from frappe import _ import json from datetime import timedelta +from erpnext.controllers.queries import get_match_cond from frappe.utils import flt, time_diff_in_hours, get_datetime, getdate, cint, get_datetime_str from frappe.model.document import Document from frappe.model.mapper import get_mapped_doc @@ -305,7 +306,8 @@ def get_events(start, end, filters=None): return frappe.db.sql("""select `tabTimesheet Detail`.name as name, `tabTimesheet Detail`.parent as parent, from_time, hours, activity_type, project, to_time from `tabTimesheet Detail`, `tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and - (from_time between %(start)s and %(end)s) {conditions}""".format(conditions=conditions), + (from_time between %(start)s and %(end)s) {conditions} + {match_cond}""".format(conditions=conditions, match_cond = get_match_cond('Timesheet')), { "start": start, "end": end From 72801043f1095717be7991aaaf7626557e78f79d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 14 Sep 2016 16:14:25 +0600 Subject: [PATCH 8/8] bumped to version 7.0.43 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index fcbc3f1fe2..231dd1aeed 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.42' +__version__ = '7.0.43' def get_default_company(user=None): '''Get default company for user'''