Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index fcbc3f1..231dd1a 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'''
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 38cef31..adc30e2 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -302,6 +302,9 @@
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 a5028c5..2b64d17 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -491,6 +491,8 @@
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/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
index a4f8fa6..f2e65d3 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 @@
<div class="page-break">
{%- 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)),
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 0c6a978..dfc926d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -316,3 +316,4 @@
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/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 8de92b7..e0e3f70 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 @@
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 695c552..7f3b755 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 @@
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
diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py
index 978c363..0a302b1 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
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 0379f90..a30a21b 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -8,6 +8,7 @@
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
@@ -20,12 +21,17 @@
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
@@ -305,7 +311,8 @@
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
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index 46d4034..c55c7cb 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -20,7 +20,13 @@
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 5375db0..12899cd 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -60,13 +60,15 @@
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 b546df4..454fc70 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -455,16 +455,18 @@
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/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 6c2a14b..a9d978a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -40,14 +40,6 @@
}
}
}
- 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 b5efc90..0ab80c2 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -847,33 +847,6 @@
{
"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,
"collapsible": 1,
"collapsible_depends_on": "total_additional_costs",
"fieldname": "additional_costs_section",
@@ -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 e35f3d2..b1f8c9c 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -71,9 +71,6 @@
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 @@
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 b75eeea..cb3bb7b 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 @@
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')
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index b9926d6..674143d 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -31,10 +31,10 @@
</div>
<div class="text-center item-group-nav-buttons">
{% if frappe.form_dict.start|int > 0 %}
- <a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int - 24 }}">Prev</a>
+ <a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">Prev</a>
{% endif %}
- {% if items|length == 24 %}
- <a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int + 24 }}">Next</a>
+ {% if items|length == page_length %}
+ <a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">Next</a>
{% endif %}
</div>
{% else %}