From efc89f4395e2abdb792cfb174e7e8e26d82d54fc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 20 Aug 2015 11:30:44 +0530 Subject: [PATCH 1/7] [fix] payment amt against invoice outstanding --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 9f38696915..4b25a88112 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -236,7 +236,7 @@ class JournalEntry(AccountsController): if voucher_properties[0] != 1: frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name)) - if flt(voucher_properties[1]) < total: + if total and flt(voucher_properties[1]) < total: frappe.throw(_("Payment against {0} {1} cannot be greater \ than Outstanding Amount {2}").format(reference_type, reference_name, voucher_properties[1])) From d7ed197131d95d820609968213e0d32c4970a5cd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Aug 2015 12:00:32 +0530 Subject: [PATCH 2/7] [fix] UOM Conversion factor mandatory in stock entry --- erpnext/stock/doctype/stock_entry/stock_entry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 59a68b7f19..cdfdc78725 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -80,7 +80,8 @@ class StockEntry(StockController): for item in self.get("items"): if not flt(item.qty): frappe.throw(_("Row {0}: Qty is mandatory").format(item.idx)) - + if not flt(item.conversion_factor): + frappe.throw(_("Row {0}: UOM Conversion Factor is mandatory").format(item.idx)) item.transfer_qty = flt(item.qty * item.conversion_factor, self.precision("transfer_qty", item)) def validate_item(self): From 046db626a2e4292480ddd9afd7e92e3f91c22db4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Aug 2015 12:34:41 +0530 Subject: [PATCH 3/7] [fix] Fetch advances in Sales/Purchase Invoice --- erpnext/controllers/accounts_controller.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 2c9e7d4f61..c7600dfaea 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -215,14 +215,15 @@ class AccountsController(TransactionBase): """Returns list of advances against Account, Party, Reference""" order_list = list(set([d.get(against_order_field) for d in self.get("items") if d.get(against_order_field)])) - if not order_list: - return - - in_placeholder = ', '.join(['%s'] * len(order_list)) - # conver sales_order to "Sales Order" reference_type = against_order_field.replace("_", " ").title() - + + condition = "" + if order_list: + in_placeholder = ', '.join(['%s'] * len(order_list)) + condition = "or (t2.reference_type = '{0}' and ifnull(t2.reference_name, '') in ({1}))"\ + .format(reference_type, in_placeholder) + res = frappe.db.sql(""" select t1.name as jv_no, t1.remark, t2.{0} as amount, t2.name as jv_detail_no, @@ -233,11 +234,9 @@ class AccountsController(TransactionBase): t1.name = t2.parent and t2.account = %s and t2.party_type = %s and t2.party = %s and t2.is_advance = 'Yes' and t1.docstatus = 1 - and ( - ifnull(t2.reference_type, '')='' - or (t2.reference_type = %s and ifnull(t2.reference_name, '') in ({1}))) - order by t1.posting_date""".format(dr_or_cr, in_placeholder), - [account_head, party_type, party, reference_type] + order_list, as_dict=1) + and (ifnull(t2.reference_type, '')='' {1}) + order by t1.posting_date""".format(dr_or_cr, condition), + [account_head, party_type, party] + order_list, as_dict=1) self.set(parentfield, []) for d in res: From 1b6fd1ba5b902282f970405cac0b9292ea3c4076 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Aug 2015 13:04:15 +0530 Subject: [PATCH 4/7] [fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation --- .../stock_uom_replace_utility/stock_uom_replace_utility.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py index 5b5419dc59..4ac440826c 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py +++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py @@ -88,7 +88,10 @@ def update_stock_ledger_entry(item_code, new_stock_uom, conversion_factor): if flt(conversion_factor) != flt(1): frappe.db.sql("""update `tabStock Ledger Entry` - set stock_uom = %s, actual_qty = ifnull(actual_qty,0) * %s + set + stock_uom = %s, + actual_qty = ifnull(actual_qty,0) * %s, + qty_after_transaction = ifnull(qty_after_transaction, 0) * %s where item_code = %s""", (new_stock_uom, conversion_factor, item_code)) else: From 597a402dffa8774dac069ac5cbff325245a215fe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Aug 2015 14:13:55 +0530 Subject: [PATCH 5/7] Divisonal loss adjustment in purchase receipt --- .../purchase_receipt/purchase_receipt.py | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 53233ce777..2979c12452 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -291,7 +291,7 @@ class PurchaseReceipt(BuyingController): if warehouse_account.get(d.warehouse): val_rate_db_precision = 6 if cint(d.precision("valuation_rate")) <= 6 else 9 - + # warehouse account gl_entries.append(self.get_gl_dict({ "account": warehouse_account[d.warehouse], @@ -334,22 +334,21 @@ class PurchaseReceipt(BuyingController): })) # divisional loss adjustment - if not self.get("taxes"): - sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor), - self.precision("base_net_amount", d)) + sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor), + self.precision("base_net_amount", d)) - distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \ - flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \ + flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount) - divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d)) - if divisional_loss: - gl_entries.append(self.get_gl_dict({ - "account": stock_rbnb, - "against": warehouse_account[d.warehouse], - "cost_center": d.cost_center, - "remarks": self.get("remarks") or _("Accounting Entry for Stock"), - "debit": divisional_loss - })) + divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d)) + if divisional_loss: + gl_entries.append(self.get_gl_dict({ + "account": stock_rbnb, + "against": warehouse_account[d.warehouse], + "cost_center": d.cost_center, + "remarks": self.get("remarks") or _("Accounting Entry for Stock"), + "debit": divisional_loss + })) elif d.warehouse not in warehouse_with_no_account or \ d.rejected_warehouse not in warehouse_with_no_account: From 7c2901fb560477f1ce93e1c4662fe0ff02ffd7d0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 21 Aug 2015 13:04:15 +0530 Subject: [PATCH 6/7] [fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation --- .../stock_uom_replace_utility/stock_uom_replace_utility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py index 4ac440826c..267649359b 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py +++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py @@ -93,7 +93,7 @@ def update_stock_ledger_entry(item_code, new_stock_uom, conversion_factor): actual_qty = ifnull(actual_qty,0) * %s, qty_after_transaction = ifnull(qty_after_transaction, 0) * %s where item_code = %s""", - (new_stock_uom, conversion_factor, item_code)) + (new_stock_uom, conversion_factor, conversion_factor, item_code)) else: frappe.db.sql("""update `tabStock Ledger Entry` set stock_uom=%s where item_code=%s""", (new_stock_uom, item_code)) From d7a6c11a92dfd3f437900f026fc47ecda1ddba01 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 21 Aug 2015 15:27:19 +0600 Subject: [PATCH 7/7] bumped to version 5.7.6 --- 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 0246af21a0..084a3886db 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '5.7.5' +__version__ = '5.7.6' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 2a116ca3d6..3ae43fa169 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -27,7 +27,7 @@ blogs. """ app_icon = "icon-th" app_color = "#e74c3c" -app_version = "5.7.5" +app_version = "5.7.6" github_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" diff --git a/setup.py b/setup.py index 9ef03d2eb7..7d4b20bc48 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "5.7.5" +version = "5.7.6" with open("requirements.txt", "r") as f: install_requires = f.readlines()