From d793fc944604a5f81b8092bc9c3af01676164211 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 1 Dec 2015 17:26:35 +0530 Subject: [PATCH 1/4] [fix] Mapping allowed for negative quantity --- erpnext/buying/doctype/purchase_order/purchase_order.py | 5 ++--- erpnext/selling/doctype/sales_order/sales_order.py | 4 ++-- erpnext/stock/doctype/delivery_note/delivery_note.py | 2 +- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index af144003ce..feb144d0dd 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -8,7 +8,6 @@ from frappe.utils import cstr, flt from frappe import msgprint, _, throw from frappe.model.mapper import get_mapped_doc from erpnext.controllers.buying_controller import BuyingController -from erpnext.stock.doctype.item.item import get_last_purchase_details from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty from frappe.desk.notifications import clear_doctype_notifications @@ -282,7 +281,7 @@ def make_purchase_receipt(source_name, target_doc=None): "parenttype": "prevdoc_doctype", }, "postprocess": update_item, - "condition": lambda doc: doc.received_qty < doc.qty and doc.delivered_by_supplier!=1 + "condition": lambda doc: abs(doc.received_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1 }, "Purchase Taxes and Charges": { "doctype": "Purchase Taxes and Charges", @@ -318,7 +317,7 @@ def make_purchase_invoice(source_name, target_doc=None): "parent": "purchase_order", }, "postprocess": update_item, - "condition": lambda doc: (doc.base_amount==0 or doc.billed_amt < doc.amount) + "condition": lambda doc: (doc.base_amount==0 or abs(doc.billed_amt) < abs(doc.amount)) }, "Purchase Taxes and Charges": { "doctype": "Purchase Taxes and Charges", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index d2b165398d..66ca31e916 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -384,7 +384,7 @@ def make_delivery_note(source_name, target_doc=None): "parent": "against_sales_order", }, "postprocess": update_item, - "condition": lambda doc: doc.delivered_qty < doc.qty and doc.delivered_by_supplier!=1 + "condition": lambda doc: abs(doc.delivered_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1 }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges", @@ -430,7 +430,7 @@ def make_sales_invoice(source_name, target_doc=None): "parent": "sales_order", }, "postprocess": update_item, - "condition": lambda doc: doc.qty and (doc.base_amount==0 or doc.billed_amt < doc.amount) + "condition": lambda doc: doc.qty and (doc.base_amount==0 or abs(doc.billed_amt) < abs(doc.amount)) }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index fd3742e1f1..c5fd34f80a 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -332,7 +332,7 @@ def make_sales_invoice(source_name, target_doc=None): "serial_no": "serial_no" }, "postprocess": update_item, - "filter": lambda d: d.qty - invoiced_qty_map.get(d.name, 0)<=0 + "filter": lambda d: abs(d.qty) - abs(invoiced_qty_map.get(d.name, 0))<=0 }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index a640e6e88b..b20617e95f 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -469,7 +469,7 @@ def make_purchase_invoice(source_name, target_doc=None): "prevdoc_docname": "purchase_order", }, "postprocess": update_item, - "filter": lambda d: d.qty - invoiced_qty_map.get(d.name, 0)<=0 + "filter": lambda d: abs(d.qty) - abs(invoiced_qty_map.get(d.name, 0))<=0 }, "Purchase Taxes and Charges": { "doctype": "Purchase Taxes and Charges", From 20abc2d0e8fe8231a39893fe65a63cd202fa0000 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 1 Dec 2015 18:07:28 +0530 Subject: [PATCH 2/4] [fix] Reorder Qty mandatory if reorder level entered --- erpnext/stock/doctype/item/item.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index b11603eaa7..dfd281a9aa 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -378,6 +378,13 @@ class Item(WebsiteGenerator): if not (self.is_purchase_item or self.is_pro_applicable): frappe.throw(_("""To set reorder level, item must be a Purchase Item or Manufacturing Item""")) + if self.re_order_level and not self.re_order_qty: + frappe.throw(_("Please set reorder quantity")) + for d in self.get("reorder_levels"): + if d.warehouse_reorder_level and not d.warehouse_reorder_qty: + frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx)) + + def validate_warehouse_for_reorder(self): warehouse = [] for i in self.get("reorder_levels"): From 8df5900f98029ad9c0a71b076d67047d29b1ef2f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 2 Dec 2015 14:50:08 +0530 Subject: [PATCH 3/4] [fix] Inactive salary structure validation --- erpnext/hr/doctype/salary_slip/salary_slip.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 88d1402c9e..ea7c96e499 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -29,10 +29,15 @@ class SalarySlip(TransactionBase): def check_sal_struct(self): m = get_month_details(self.fiscal_year, self.month) + + joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, + ["date_of_joining", "relieving_date"]) + struct = frappe.db.sql("""select name from `tabSalary Structure` where employee=%s and is_active = 'Yes' - and from_date <= %s and (to_date is null or to_date >= %s)""", - (self.employee, m.month_start_date, m.month_end_date)) + and (from_date <= %s or from_date <= %s) + and (to_date is null or to_date >= %s or to_date >= %s)""", + (self.employee, m.month_start_date, joining_date, m.month_end_date, relieving_date)) if not struct: msgprint(_("No active Salary Structure found for employee {0} and the month") From 5dd1aa9f3132868542b669e7c641efe6ccd130a5 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 2 Dec 2015 15:24:45 +0600 Subject: [PATCH 4/4] bumped to version 6.12.2 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 1d96984a3e..4220bc7e6c 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.12.1' +__version__ = '6.12.2' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index f4d24d8c5c..bb689783db 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = """ERP made simple""" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.12.1" +app_version = "6.12.2" app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" diff --git a/setup.py b/setup.py index 8ef1565e5c..ffaee6b7e7 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "6.12.1" +version = "6.12.2" with open("requirements.txt", "r") as f: install_requires = f.readlines()