From 9a5cf6000ed2689821fb08c2e99d77e0f856286d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 31 May 2016 19:11:48 +0530 Subject: [PATCH] [fix] Test cases and editable fields settings for request for quotation --- .../accounts/report/balance_sheet/balance_sheet.py | 4 +++- .../doctype/purchase_common/purchase_common.js | 2 +- .../request_for_quotation/request_for_quotation.js | 13 +++++++++++++ .../request_for_quotation_supplier.json | 2 +- .../test_shopping_cart_settings.py | 2 ++ erpnext/shopping_cart/test_shopping_cart.py | 5 ++++- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py index d471da6d38..4efd098f76 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py @@ -64,7 +64,9 @@ def get_provisional_profit_loss(asset, liability, equity, period_list, company): def check_opening_balance(asset, liability, equity): # Check if previous year balance sheet closed - opening_balance = flt(asset[0].get("opening_balance", 0)) + opening_balance = 0 + if asset: + opening_balance = flt(asset[0].get("opening_balance", 0)) if liability: opening_balance -= flt(liability[0].get("opening_balance", 0)) if equity: diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index dbfda210b1..6416a239d2 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -12,7 +12,7 @@ cur_frm.email_field = "contact_email"; erpnext.buying.BuyingController = erpnext.TransactionController.extend({ setup: function() { this._super(); - if(!this.frm.get_field('items').grid.editable_fields){ + if(!in_list(["Material Request", "Request for Quotation"], this.frm.doc.doctype)){ this.frm.get_field('items').grid.editable_fields = [ {fieldname: 'item_code', columns: 4}, {fieldname: 'qty', columns: 2}, diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index 72185315f1..5fb8b80335 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -14,6 +14,19 @@ frappe.ui.form.on("Request for Quotation",{ filters: {'supplier': d.supplier} } } + + frm.get_field('items').grid.editable_fields = [ + {fieldname: 'item_code', columns: 4}, + {fieldname: 'qty', columns: 2}, + {fieldname: 'schedule_date', columns: 2}, + {fieldname: 'warehouse', columns: 3}, + ]; + + frm.get_field('suppliers').grid.editable_fields = [ + {fieldname: 'supplier', columns: 5}, + {fieldname: 'contact', columns: 3}, + {fieldname: 'email_id', columns: 3} + ]; }, onload: function(frm){ diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json index d9b34eb556..3399b51aef 100644 --- a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json +++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json @@ -147,7 +147,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-05-10 11:36:04.171180", + "modified": "2016-05-31 19:08:15.397706", "modified_by": "Administrator", "module": "Buying", "name": "Request for Quotation Supplier", diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py index 10bbcfe85a..390bc27568 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py @@ -36,4 +36,6 @@ class TestShoppingCartSettings(unittest.TestCase): cart_settings.enabled = 1 if not frappe.db.get_value("Tax Rule", {"use_for_shopping_cart": 1}, "name"): self.assertRaises(ShoppingCartSetupError, cart_settings.validate_tax_rule) + + frappe.db.sql("update `tabTax Rule` set use_for_shopping_cart = 1") diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index a51852a454..6eb8e49789 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -101,7 +101,7 @@ class TestShoppingCart(unittest.TestCase): quotation = self.create_quotation() from erpnext.accounts.party import set_taxes - + tax_rule_master = set_taxes(quotation.customer, "Customer", \ quotation.transaction_date, quotation.company, None, None, \ quotation.customer_address, quotation.shipping_address_name, 1) @@ -131,6 +131,9 @@ class TestShoppingCart(unittest.TestCase): "taxes": frappe.get_doc("Sales Taxes and Charges Template", "_Test Tax 1").taxes, "company": "_Test Company" } + + for d in values["taxes"]: + d.name = None quotation.update(values)