diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 96a6424295a..ab2728eb6ee 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.2.31' +__version__ = '7.2.32' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 3c622972c4c..f9e51acf27f 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -117,7 +117,7 @@ def apply_pricing_rule(args): args_copy = copy.deepcopy(args) args_copy.update(item) out.append(get_pricing_rule_for_item(args_copy)) - if set_serial_nos_based_on_fifo: + if set_serial_nos_based_on_fifo and not args.get('is_return'): out.append(get_serial_no_for_item(args_copy)) return out diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index bf6d9868a2c..4f10875f8e9 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -1216,6 +1216,7 @@ "collapsible": 1, "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no", "columns": 0, + "depends_on": "eval: parent.update_stock", "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", "hidden": 0, @@ -1910,7 +1911,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-02-07 01:21:47.142162", + "modified": "2017-03-29 16:26:36.507924", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index df6cb3c33a6..887d5f8c8d6 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _, scrub from erpnext.stock.utils import get_incoming_rate +from erpnext.stock.stock_ledger import get_valuation_rate from frappe.utils import flt @@ -220,7 +221,10 @@ class GrossProfitGenerator(object): from `tabPurchase Invoice Item` where item_code = %s and docstatus=1""", item_code)[0][0]) else: - self.average_buying_rate[item_code] = get_incoming_rate(row) + average_buying_rate = get_incoming_rate(row) + if not average_buying_rate: + average_buying_rate = get_valuation_rate(item_code, row.warehouse, allow_zero_rate=True) + self.average_buying_rate[item_code] = average_buying_rate return self.average_buying_rate[item_code] diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index feecae08ebd..2e087f5c011 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -32,6 +32,8 @@ class Attendance(Document): def validate_att_date(self): if getdate(self.att_date) > getdate(nowdate()): frappe.throw(_("Attendance can not be marked for future dates")) + elif getdate(self.att_date) < frappe.db.get_value("Employee", self.employee, "date_of_joining"): + frappe.throw(_("Attendance date can not be less than employee's joining date")) def validate_employee(self): emp = frappe.db.sql("select name from `tabEmployee` where name = %s and status = 'Active'", diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index aaa0e95ec08..bc166aa0c99 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -42,7 +42,7 @@ class ProductionPlanningTool(Document): select distinct so.name, so.transaction_date, so.customer, so.base_grand_total from `tabSales Order` so, `tabSales Order Item` so_item where so_item.parent = so.name - and so.docstatus = 1 and so.status != "Stopped" + and so.docstatus = 1 and so.status not in ("Stopped", "Closed") and so.company = %(company)s and so_item.qty > so_item.delivered_qty {0} {1} and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index f8aa7cff577..908b8693e29 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -728,7 +728,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ "sales_partner": me.frm.doc.sales_partner, "ignore_pricing_rule": me.frm.doc.ignore_pricing_rule, "doctype": me.frm.doc.doctype, - "name": me.frm.doc.name + "name": me.frm.doc.name, + "is_return": cint(me.frm.doc.is_return) }; },