From 76625b359eb93e91ccd4a16c3b3bc1c7485e84c1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 3 Jan 2018 14:03:53 +0530 Subject: [PATCH 01/12] Removed naming series from set_only_once in pos profile --- erpnext/accounts/doctype/pos_profile/pos_profile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json index e2a6b53f28..2cb8e1024a 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.json +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -130,7 +130,7 @@ "report_hide": 0, "reqd": 1, "search_index": 0, - "set_only_once": 1, + "set_only_once": 0, "unique": 0 }, { @@ -1476,7 +1476,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-11 17:30:45.198147", + "modified": "2018-01-03 17:30:45.198147", "modified_by": "Administrator", "module": "Accounts", "name": "POS Profile", From 941d0af13a91eaf82b43c42e657ec9a7a5a92a08 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 3 Jan 2018 14:12:56 +0530 Subject: [PATCH 02/12] Fixed organization lead error --- erpnext/crm/doctype/lead/lead.py | 2 +- erpnext/crm/doctype/lead/test_records.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 85bbf2aa13..fe1e911adf 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -101,7 +101,7 @@ class Lead(SellingController): def set_lead_name(self): if not self.lead_name: - frappe.db.set_value("Lead", self.name, "lead_name", self.organization_name) + frappe.db.set_value("Lead", self.name, "lead_name", self.company_name) @frappe.whitelist() def make_customer(source_name, target_doc=None): diff --git a/erpnext/crm/doctype/lead/test_records.json b/erpnext/crm/doctype/lead/test_records.json index 590e200cf9..39864e2e3e 100644 --- a/erpnext/crm/doctype/lead/test_records.json +++ b/erpnext/crm/doctype/lead/test_records.json @@ -29,7 +29,7 @@ "email_id": "test_lead4@example.com", "organization_lead": 1, "lead_name": "_Test Lead 4", - "organization_name": "_Test Lead 4", + "company_name": "_Test Lead 4", "status": "Open" } ] From 42688f0636c8c29b927a73cfe936512f0239b1fc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 Jan 2018 18:12:21 +0530 Subject: [PATCH 03/12] Minor fix --- erpnext/accounts/doctype/account/account.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 36f8ce2c3b..b0a59d00cd 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -53,14 +53,12 @@ class Account(NestedSet): def set_root_and_report_type(self): if self.parent_account: par = frappe.db.get_value("Account", self.parent_account, - ["report_type", "root_type", "account_type"], as_dict=1) + ["report_type", "root_type"], as_dict=1) if par.report_type: self.report_type = par.report_type if par.root_type: self.root_type = par.root_type - if par.account_type and not self.account_type: - self.account_type = par.account_type if self.is_group: db_value = frappe.db.get_value("Account", self.name, ["report_type", "root_type"], as_dict=1) From c5c6f82623f608829739f141d161dafae98ac505 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 5 Jan 2018 12:16:16 +0530 Subject: [PATCH 04/12] [Hotfix] Tax rate not showing in the report (#12324) --- .../item_wise_sales_register/item_wise_sales_register.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 205d43fde4..ab5251f292 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -6,6 +6,7 @@ import frappe, erpnext from frappe import _ from frappe.utils import flt from frappe.model.meta import get_field_precision +from frappe.utils.xlsxutils import handle_html from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments def execute(filters=None): @@ -188,10 +189,10 @@ def get_tax_accounts(item_list, columns, company_currency, tuple([doctype] + invoice_item_row.keys())) for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details: + description = handle_html(description) if description not in tax_columns and tax_amount: # as description is text editor earlier and markup can break the column convention in reports - from frappe.utils.xlsxutils import handle_html - tax_columns.append(handle_html(description)) + tax_columns.append(description) if item_wise_tax_detail: try: From 1f39feb12fd3493cdcdfc48df091f9ca30db119c Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 5 Jan 2018 12:25:45 +0530 Subject: [PATCH 05/12] [Fix] PO -> PI non default taxes not fetched (#12313) --- erpnext/public/js/controllers/transaction.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 483736e938..503f1526ed 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -236,7 +236,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var taxes_and_charges_field = frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges", me.frm.doc.name); - if(taxes_and_charges_field) { + if (!this.frm.doc.taxes_and_charges && this.frm.doc.taxes) { + return; + } + + if (taxes_and_charges_field) { return frappe.call({ method: "erpnext.controllers.accounts_controller.get_default_taxes_and_charges", args: { From 3f784a7a493b8528ad350305d057a95c0afc79aa Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 5 Jan 2018 12:26:33 +0530 Subject: [PATCH 06/12] [minor] POS profile mandatory, to set as default (#12307) --- erpnext/selling/page/point_of_sale/point_of_sale.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 386e18d44a..e2fc10cba7 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -360,6 +360,7 @@ erpnext.pos.PointOfSale = class PointOfSale { fieldtype: 'Link', label: __('POS Profile'), options: 'POS Profile', + reqd: 1, get_query: () => { return { query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query', @@ -1211,6 +1212,7 @@ class POSItems { return new Promise(res => { frappe.call({ method: "erpnext.selling.page.point_of_sale.point_of_sale.get_items", + freeze: true, args: { start, page_length, From bc2c83ee3c2c31e766fc04619edadc7d2e387dbd Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 5 Jan 2018 12:42:02 +0530 Subject: [PATCH 07/12] Companywise default tax template (#12290) * Companywise default tax template * Fix test cases --- .../purchase_invoice/test_purchase_invoice.js | 4 +- .../purchase_taxes_and_charges_template.py | 6 +++ ...est_purchase_taxes_and_charges_template.js | 7 ++- .../sales_invoice/test_sales_invoice.js | 4 +- .../sales_invoice/tests/test_sales_invoice.js | 4 +- .../tests/test_sales_invoice_with_payment.js | 4 +- ...test_sales_invoice_with_payment_request.js | 4 +- .../test_sales_invoice_with_serialize_item.js | 4 +- .../sales_taxes_and_charges_template.py | 7 ++- .../test_sales_taxes_and_charges_template.js | 7 ++- .../doctype/tax_rule/test_records.json | 4 +- .../doctype/tax_rule/test_tax_rule.py | 52 +++++++++---------- ...t_purchase_order_with_taxes_and_charges.js | 2 +- ...upplier_quotation_for_taxes_and_charges.js | 2 +- .../test_quotation_with_taxes_and_charges.js | 4 +- .../sales_order/tests/test_sales_order.js | 4 +- ...test_sales_order_with_taxes_and_charges.js | 4 +- erpnext/setup/doctype/company/company.js | 32 +++++++++++- erpnext/setup/doctype/company/company.py | 7 +++ .../setup_wizard/operations/taxes_setup.py | 52 +++++++++++-------- erpnext/shopping_cart/test_shopping_cart.py | 4 +- .../delivery_note/test_delivery_note.js | 2 +- .../purchase_receipt/test_purchase_receipt.js | 4 +- 23 files changed, 141 insertions(+), 83 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js index db71a17680..8fac32d95e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js @@ -18,7 +18,7 @@ QUnit.test("test purchase invoice", function(assert) { {update_stock:1}, {supplier_address: 'Test1-Billing'}, {contact_person: 'Contact 3-Test Supplier'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'}, {payment_terms_template: '_Test Payment Term Template UI'} @@ -29,7 +29,7 @@ QUnit.test("test purchase invoice", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); // grand_total Calculated diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py index bffa8e6d74..bd66aa54eb 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py @@ -3,6 +3,7 @@ # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals +import frappe from frappe.model.document import Document from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template \ import valdiate_taxes_and_charges_template @@ -10,3 +11,8 @@ from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_c class PurchaseTaxesandChargesTemplate(Document): def validate(self): valdiate_taxes_and_charges_template(self) + + def autoname(self): + if self.company and self.title: + abbr = frappe.db.get_value('Company', self.company, 'abbr') + self.name = '{0} - {1}'.format(self.title, abbr) diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js index 5e357ca2ad..c73f03b57b 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js @@ -1,7 +1,7 @@ QUnit.module('Sales Taxes and Charges Template'); QUnit.test("test sales taxes and charges template", function(assert) { - assert.expect(1); + assert.expect(2); let done = assert.async(); frappe.run_serially([ () => { @@ -19,7 +19,10 @@ QUnit.test("test sales taxes and charges template", function(assert) { ]} ]); }, - () => {assert.ok(cur_frm.doc.title=='TEST In State GST');}, + () => { + assert.ok(cur_frm.doc.title=='TEST In State GST'); + assert.ok(cur_frm.doc.name=='TEST In State GST - FT'); + }, () => done() ]); }); diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js index b4be3ba67c..0c92c3739a 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.js @@ -17,7 +17,7 @@ QUnit.test("test sales Invoice", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'}, {payment_terms_template: '_Test Payment Term Template UI'} @@ -28,7 +28,7 @@ QUnit.test("test sales Invoice", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); // grand_total Calculated diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js index 35b255875e..e12ac03850 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js @@ -17,7 +17,7 @@ QUnit.test("test sales Invoice", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test sales Invoice", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); // grand_total Calculated diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js index 890fb68600..651bf0aa4c 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js @@ -17,7 +17,7 @@ QUnit.test("test sales Invoice with payment", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'}, {payment_terms_template: '_Test Payment Term Template UI'} @@ -28,7 +28,7 @@ QUnit.test("test sales Invoice with payment", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // grand_total Calculated assert.ok(cur_frm.doc.grand_total==590, "Grad Total correct"); diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js index 7abfb415ca..b959cf961b 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js @@ -17,7 +17,7 @@ QUnit.test("test sales Invoice with payment request", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test sales Invoice with payment request", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // grand_total Calculated assert.ok(cur_frm.doc.grand_total==590, "Grad Total correct"); diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js index 60059841cd..2697758d7a 100644 --- a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js +++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_serialize_item.js @@ -17,7 +17,7 @@ QUnit.test("test sales Invoice with serialize item", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test sales Invoice with serialize item", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); // get batch number diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py index 3947450d5b..9dee1f9460 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py @@ -11,7 +11,12 @@ from erpnext.controllers.accounts_controller import validate_taxes_and_charges, class SalesTaxesandChargesTemplate(Document): def validate(self): valdiate_taxes_and_charges_template(self) - + + def autoname(self): + if self.company and self.title: + abbr = frappe.db.get_value('Company', self.company, 'abbr') + self.name = '{0} - {1}'.format(self.title, abbr) + def set_missing_values(self): for data in self.taxes: if data.charge_type == 'On Net Total' and flt(data.rate) == 0.0: diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js index 2667ee62d7..d02e70b541 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js @@ -1,7 +1,7 @@ QUnit.module('Sales Taxes and Charges Template'); QUnit.test("test sales taxes and charges template", function(assert) { - assert.expect(1); + assert.expect(2); let done = assert.async(); frappe.run_serially([ () => { @@ -19,7 +19,10 @@ QUnit.test("test sales taxes and charges template", function(assert) { ]} ]); }, - () => {assert.ok(cur_frm.doc.title=='TEST In State GST');}, + () => { + assert.ok(cur_frm.doc.title=='TEST In State GST'); + assert.ok(cur_frm.doc.name=='TEST In State GST - FT'); + }, () => done() ]); }); diff --git a/erpnext/accounts/doctype/tax_rule/test_records.json b/erpnext/accounts/doctype/tax_rule/test_records.json index 0913fba4fb..e80b12f73e 100644 --- a/erpnext/accounts/doctype/tax_rule/test_records.json +++ b/erpnext/accounts/doctype/tax_rule/test_records.json @@ -2,7 +2,7 @@ { "doctype": "Tax Rule", "tax_type" : "Sales", - "sales_tax_template": "_Test Tax 1", + "sales_tax_template": "_Test Tax 1 - _TC", "use_for_shopping_cart": 1, "billing_city": "_Test City", "billing_state": "Test State", @@ -15,7 +15,7 @@ { "doctype": "Tax Rule", "tax_type" : "Sales", - "sales_tax_template": "_Test Tax 2", + "sales_tax_template": "_Test Tax 2 - _TC", "use_for_shopping_cart": 0, "billing_city": "_Test City", "billing_country": "India", diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index ee5b3c9d6a..54a7520e5a 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -18,40 +18,40 @@ class TestTaxRule(unittest.TestCase): def test_conflict(self): tax_rule1 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1) tax_rule1.save() tax_rule2 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1) self.assertRaises(ConflictingTaxRule, tax_rule2.save) def test_conflict_with_non_overlapping_dates(self): tax_rule1 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01") + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01") tax_rule1.save() tax_rule2 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, to_date = "2013-01-01") + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, to_date = "2013-01-01") tax_rule2.save() self.assertTrue(tax_rule2.name) def test_for_parent_customer_group(self): tax_rule1 = make_tax_rule(customer_group= "All Customer Groups", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01") + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01") tax_rule1.save() self.assertEquals(get_tax_template("2015-01-01", {"customer_group" : "Commercial", "use_for_shopping_cart":0}), - "_Test Sales Taxes and Charges Template") + "_Test Sales Taxes and Charges Template - _TC") def test_conflict_with_overlapping_dates(self): tax_rule1 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01", to_date = "2015-01-05") + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-01", to_date = "2015-01-05") tax_rule1.save() tax_rule2 = make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-03", to_date = "2015-01-09") + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority = 1, from_date = "2015-01-03", to_date = "2015-01-09") self.assertRaises(ConflictingTaxRule, tax_rule2.save) @@ -62,66 +62,66 @@ class TestTaxRule(unittest.TestCase): def test_select_tax_rule_based_on_customer(self): make_tax_rule(customer= "_Test Customer", - sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1) make_tax_rule(customer= "_Test Customer 1", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1) make_tax_rule(customer= "_Test Customer 2", - sales_tax_template = "_Test Sales Taxes and Charges Template 2", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 2 - _TC", save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer 2"}), - "_Test Sales Taxes and Charges Template 2") + "_Test Sales Taxes and Charges Template 2 - _TC") def test_select_tax_rule_based_on_better_match(self): make_tax_rule(customer= "_Test Customer", billing_city = "Test City", billing_state = "Test State", - sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1) make_tax_rule(customer= "_Test Customer", billing_city = "Test City1", billing_state = "Test State", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City", "billing_state": "Test State"}), - "_Test Sales Taxes and Charges Template") + "_Test Sales Taxes and Charges Template - _TC") def test_select_tax_rule_based_on_state_match(self): make_tax_rule(customer= "_Test Customer", shipping_state = "Test State", - sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1) make_tax_rule(customer= "_Test Customer", shipping_state = "Test State12", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", priority=2, save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", priority=2, save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "shipping_state": "Test State"}), - "_Test Sales Taxes and Charges Template") + "_Test Sales Taxes and Charges Template - _TC") def test_select_tax_rule_based_on_better_priority(self): make_tax_rule(customer= "_Test Customer", billing_city = "Test City", - sales_tax_template = "_Test Sales Taxes and Charges Template", priority=1, save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", priority=1, save=1) make_tax_rule(customer= "_Test Customer", billing_city = "Test City", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", priority=2, save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", priority=2, save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City"}), - "_Test Sales Taxes and Charges Template 1") + "_Test Sales Taxes and Charges Template 1 - _TC") def test_select_tax_rule_based_cross_matching_keys(self): make_tax_rule(customer= "_Test Customer", billing_city = "Test City", - sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1) make_tax_rule(customer= "_Test Customer 1", billing_city = "Test City 1", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}), None) def test_select_tax_rule_based_cross_partially_keys(self): make_tax_rule(customer= "_Test Customer", billing_city = "Test City", - sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1) make_tax_rule(billing_city = "Test City 1", - sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1) + sales_tax_template = "_Test Sales Taxes and Charges Template 1 - _TC", save=1) self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}), - "_Test Sales Taxes and Charges Template 1") + "_Test Sales Taxes and Charges Template 1 - _TC") def make_tax_rule(**args): diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js index 27129fb3b8..39716ed560 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js @@ -24,7 +24,7 @@ QUnit.test("test: purchase order with taxes and charges", function(assert) { ] ]}, - {taxes_and_charges: 'TEST In State GST'} + {taxes_and_charges: 'TEST In State GST - FT'} ]); }, diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js index c4b341952c..e37731eb57 100644 --- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js +++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_taxes_and_charges.js @@ -17,7 +17,7 @@ QUnit.test("test: supplier quotation with taxes and charges", function(assert) { {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, ] ]}, - {taxes_and_charges:'TEST In State GST'}, + {taxes_and_charges:'TEST In State GST - FT'}, ]); }, () => {supplier_quotation_name = cur_frm.doc.name;}, diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js index 6cc3604bab..ac7ed65ec0 100644 --- a/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js +++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_taxes_and_charges.js @@ -17,7 +17,7 @@ QUnit.test("test quotation with taxes and charges", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test quotation with taxes and charges", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js index 939261c0c5..c99f9ef2a9 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js @@ -17,7 +17,7 @@ QUnit.test("test sales order", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'}, {payment_terms_template: '_Test Payment Term Template UI'} @@ -34,7 +34,7 @@ QUnit.test("test sales order", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 3', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); }, diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_taxes_and_charges.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_taxes_and_charges.js index c9464435ab..a3668ab2af 100644 --- a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_taxes_and_charges.js +++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_taxes_and_charges.js @@ -17,7 +17,7 @@ QUnit.test("test sales order with taxes and charges", function(assert) { {customer_address: 'Test1-Billing'}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test sales order with taxes and charges", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 8b7e641e3a..29077dce20 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -34,24 +34,52 @@ frappe.ui.form.on("Company", { frm.add_custom_button(__('Cost Centers'), function() { frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name}) - }) + }, __("View")); frm.add_custom_button(__('Chart of Accounts'), function() { frappe.set_route('Tree', 'Account', {'company': frm.doc.name}) - }) + }, __("View")); + + frm.add_custom_button(__('Sales Tax Template'), function() { + frappe.set_route('List', 'Sales Taxes and Charges Template', {'company': frm.doc.name}); + }, __("View")); + + frm.add_custom_button(__('Purchase Tax Template'), function() { + frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name}); + }, __("View")); + + frm.add_custom_button(__('Default Tax Template'), function() { + frm.trigger("make_default_tax_template"); + }, __("Make")); + + frm.page.set_inner_btn_group_as_primary(__("View")); + frm.page.set_inner_btn_group_as_primary(__("Make")); } erpnext.company.set_chart_of_accounts_options(frm.doc); }, + make_default_tax_template: function(frm) { + frm.call({ + method: "create_default_tax_template", + doc: frm.doc, + freeze: true, + callback: function() { + frappe.msgprint(__("Default tax templates for sales and purchase are created.")); + } + }) + }, + onload_post_render: function(frm) { if(frm.get_field("delete_company_transactions").$input) frm.get_field("delete_company_transactions").$input.addClass("btn-danger"); }, + country: function(frm) { erpnext.company.set_chart_of_accounts_options(frm.doc); }, + delete_company_transactions: function(frm) { frappe.verify_password(function() { var d = frappe.prompt({ diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 0a8d504424..a36810f6fe 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -50,6 +50,13 @@ class Company(Document): if frappe.db.sql("select abbr from tabCompany where name!=%s and abbr=%s", (self.name, self.abbr)): frappe.throw(_("Abbreviation already used for another company")) + def create_default_tax_template(self): + from erpnext.setup.setup_wizard.operations.taxes_setup import create_sales_tax + create_sales_tax({ + 'country': self.country, + 'company_name': self.name + }) + def validate_default_accounts(self): for field in ["default_bank_account", "default_cash_account", "default_receivable_account", "default_payable_account", diff --git a/erpnext/setup/setup_wizard/operations/taxes_setup.py b/erpnext/setup/setup_wizard/operations/taxes_setup.py index a2466fe19c..dd5c0372e4 100644 --- a/erpnext/setup/setup_wizard/operations/taxes_setup.py +++ b/erpnext/setup/setup_wizard/operations/taxes_setup.py @@ -16,38 +16,44 @@ def create_sales_tax(args): tax_data.get('tax_rate'), sales_tax) def make_tax_account_and_template(company, account_name, tax_rate, template_name=None): + if not isinstance(account_name, (list, tuple)): + account_name = [account_name] + tax_rate = [tax_rate] + + accounts = [] + for i, name in enumerate(account_name): + tax_account = make_tax_account(company, account_name[i], tax_rate[i]) + if tax_account: + accounts.append(tax_account) + try: - if not isinstance(account_name, (list, tuple)): - account_name = [account_name] - tax_rate = [tax_rate] - - accounts = [] - for i, name in enumerate(account_name): - tax_account = make_tax_account(company, account_name[i], tax_rate[i]) - if tax_account: - accounts.append(tax_account) - if accounts: make_sales_and_purchase_tax_templates(accounts, template_name) except frappe.NameError: - pass + frappe.message_log.pop() except RootNotEditable: pass def make_tax_account(company, account_name, tax_rate): tax_group = get_tax_account_group(company) if tax_group: - return frappe.get_doc({ - "doctype":"Account", - "company": company, - "parent_account": tax_group, - "account_name": account_name, - "is_group": 0, - "report_type": "Balance Sheet", - "root_type": "Liability", - "account_type": "Tax", - "tax_rate": flt(tax_rate) if tax_rate else None - }).insert(ignore_permissions=True, ignore_mandatory=True) + try: + return frappe.get_doc({ + "doctype":"Account", + "company": company, + "parent_account": tax_group, + "account_name": account_name, + "is_group": 0, + "report_type": "Balance Sheet", + "root_type": "Liability", + "account_type": "Tax", + "tax_rate": flt(tax_rate) if tax_rate else None + }).insert(ignore_permissions=True, ignore_mandatory=True) + except frappe.NameError: + frappe.message_log.pop() + abbr = frappe.db.get_value('Company', company, 'abbr') + account = '{0} - {1}'.format(account_name, abbr) + return frappe.get_doc('Account', account) def make_sales_and_purchase_tax_templates(accounts, template_name=None): if not template_name: @@ -62,7 +68,7 @@ def make_sales_and_purchase_tax_templates(accounts, template_name=None): for account in accounts: sales_tax_template['taxes'].append({ - "category": "Valuation and Total", + "category": "Total", "charge_type": "On Net Total", "account_head": account.name, "description": "{0} @ {1}".format(account.account_name, account.tax_rate), diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index 0c94cd87dc..5578546a1e 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -128,7 +128,7 @@ class TestShoppingCart(unittest.TestCase): "contact_email": frappe.session.user, "selling_price_list": "_Test Price List Rest of the World", "currency": "USD", - "taxes_and_charges" : "_Test Tax 1", + "taxes_and_charges" : "_Test Tax 1 - _TC", "conversion_rate":1, "transaction_date" : nowdate(), "valid_till" : add_months(nowdate(), 1), @@ -136,7 +136,7 @@ class TestShoppingCart(unittest.TestCase): "item_code": "_Test Item", "qty": 1 }], - "taxes": frappe.get_doc("Sales Taxes and Charges Template", "_Test Tax 1").taxes, + "taxes": frappe.get_doc("Sales Taxes and Charges Template", "_Test Tax 1 - _TC").taxes, "company": "_Test Company" } diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.js b/erpnext/stock/doctype/delivery_note/test_delivery_note.js index bbc97b8d40..3f6e8d1503 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.js @@ -15,7 +15,7 @@ QUnit.test("test delivery note", function(assert) { ]}, {shipping_address_name: 'Test1-Shipping'}, {contact_person: 'Contact 1-Test Customer 1'}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {transporter_name:'TEST TRANSPORT'}, {lr_no:'MH-04-FG 1111'} diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js index 0b3fcc9898..d1f448536b 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.js @@ -17,7 +17,7 @@ QUnit.test("test Purchase Receipt", function(assert) { {'rejected_warehouse':'Work In Progress - '+frappe.get_abbr(frappe.defaults.get_default('Company'))}, ] ]}, - {taxes_and_charges: 'TEST In State GST'}, + {taxes_and_charges: 'TEST In State GST - FT'}, {tc_name: 'Test Term 1'}, {terms: 'This is Test'} ]); @@ -27,7 +27,7 @@ QUnit.test("test Purchase Receipt", function(assert) { // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); // get tax details - assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); + assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct"); // get tax account head details assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); // grand_total Calculated From 171157f1b3783a16fbd5781a96304dcbacb7c2e2 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 5 Jan 2018 12:42:39 +0530 Subject: [PATCH 08/12] Fix + Enhancement in Program Enrollment Tool (#12291) * Fix + Enhancement in Program Enrollment Tool * updated the docs --- .../admission/program-enrollment-tool.md | 13 +- .../program_enrollment_tool.js | 17 +- .../program_enrollment_tool.json | 205 +++++++++++++++++- .../program_enrollment_tool.py | 43 ++-- .../program_enrollment_tool_student.json | 33 ++- .../student_applicant/student_applicant.json | 33 ++- 6 files changed, 307 insertions(+), 37 deletions(-) diff --git a/erpnext/docs/user/manual/en/education/admission/program-enrollment-tool.md b/erpnext/docs/user/manual/en/education/admission/program-enrollment-tool.md index 53d9d9c84d..97a26c73ce 100644 --- a/erpnext/docs/user/manual/en/education/admission/program-enrollment-tool.md +++ b/erpnext/docs/user/manual/en/education/admission/program-enrollment-tool.md @@ -1,16 +1,21 @@ # Program Enrollment Tool -The Program Enrollment tool allows the bulk enrollment of the **Student Applicants** in a Program. +The Program Enrollment tool allows the bulk enrollment of the new and old students in a Program. If you are enrolling a new student, you can fetch the students from the **Student Applicant** or if you are promoting the older students you can fetch them from the **Program Enrollment** itself +> Note: Academic Term is optional in the Program Enrollment Tool -You can create the the Program Enrollment for : +You can create the Program Enrollment for : -1. **Student Applicants** >> List of Student Applicants will be fetched for the selected **Program** and **Academic year**. +1. **Student Applicants**: List of Student Applicants will be fetched for the selected **Program**, **Academic year** and **Academic Term** (if provided). Student Applicant Enrollment -2. **Program Enrollment** >> You can bulk update the **Program** for the students from one academic year to another in the same **Program** or a new **Program**. +2. **Program Enrollment**: List of students already enrolled in selected **Program** for the given **Academic Year**, **Academic Term** (if provided) and **Student Batch** will be fetched and can be used to enroll students from one academic year/term to another in the same **Program** or a new **Program**. Student Applicant Enrollment +**New Student Batch**: This can be selected for the entire students fetched in the table. Priority will be given to the Batch selected in the table (for individual students). + +For promoting the students, the new academic year, academic term and program can also be selected for the enrollment of the fetched students list. + {next} \ No newline at end of file diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js index bf6f3e0938..4f8ce6d19c 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.js @@ -1,11 +1,19 @@ // Copyright (c) 2016, Frappe and contributors // For license information, please see license.txt -cur_frm.add_fetch("student", "title", "student_name"); -cur_frm.add_fetch("student_applicant", "title", "student_name"); frappe.ui.form.on("Program Enrollment Tool", { + setup: function(frm) { + frm.add_fetch("student", "title", "student_name"); + frm.add_fetch("student_applicant", "title", "student_name"); + }, + "refresh": function(frm) { frm.disable_save(); + frm.fields_dict.enroll_students.$input.addClass(' btn btn-primary'); + frappe.realtime.on("program_enrollment_tool", function(data) { + frappe.hide_msgprint(true); + frappe.show_progress(__("Enrolling students"), data.progress[0], data.progress[1]); + }); }, "get_students": function(frm) { @@ -18,7 +26,7 @@ frappe.ui.form.on("Program Enrollment Tool", { frm.set_value("students", r.message); } } - }) + }); }, "enroll_students": function(frm) { @@ -27,7 +35,8 @@ frappe.ui.form.on("Program Enrollment Tool", { doc:frm.doc, callback: function(r) { frm.set_value("students", []); + frappe.hide_msgprint(true); } - }) + }); } }); diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json index 71071cdbdc..d611a6f270 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.json @@ -29,7 +29,7 @@ "label": "Get Students From", "length": 0, "no_copy": 0, - "options": "\nStudent Applicants\nProgram Enrollments", + "options": "\nStudent Applicant\nProgram Enrollment", "permlevel": 0, "precision": "", "print_hide": 0, @@ -73,6 +73,67 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.get_students_from==\"Program Enrollment\"", + "fieldname": "student_batch", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student Batch", + "length": 0, + "no_copy": 0, + "options": "Student Batch Name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -110,8 +171,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "get_students", - "fieldtype": "Button", + "fieldname": "academic_term", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -119,9 +180,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Get Students", + "label": "Academic Term", "length": 0, "no_copy": 0, + "options": "Academic Term", "permlevel": 0, "precision": "", "print_hide": 0, @@ -163,6 +225,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "get_students", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Get Students", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -209,6 +301,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Enrollment Details", "length": 0, "no_copy": 0, "permlevel": 0, @@ -229,7 +322,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.get_students_from==\"Program Enrollments\"", + "depends_on": "eval:doc.get_students_from==\"Program Enrollment\"", "fieldname": "new_program", "fieldtype": "Link", "hidden": 0, @@ -261,8 +354,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.get_students_from==\"Program Enrollments\"", - "fieldname": "new_academic_year", + "fieldname": "new_student_batch", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -271,10 +363,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "New Academic Year", + "label": "New Student Batch", "length": 0, "no_copy": 0, - "options": "Academic Year", + "options": "Student Batch Name", "permlevel": 0, "precision": "", "print_hide": 0, @@ -316,6 +408,99 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.get_students_from==\"Program Enrollment\"", + "fieldname": "new_academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "New Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.get_students_from==\"Program Enrollment\"", + "fieldname": "new_academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "New Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "has_web_view": 0, @@ -328,7 +513,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-12-27 09:35:45.002469", + "modified": "2018-01-02 11:59:40.230689", "modified_by": "Administrator", "module": "Education", "name": "Program Enrollment Tool", diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py index d989d9f1d2..824a29582e 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py @@ -17,21 +17,26 @@ class ProgramEnrollmentTool(Document): elif not self.academic_year: frappe.throw(_("Mandatory field - Academic Year")) else: - if self.get_students_from == "Student Applicants": - students = frappe.db.sql("select name as student_applicant, title as student_name from \ - `tabStudent Applicant` where program = %s and academic_year = %s",(self.program, self.academic_year), as_dict=1) - else: - students = frappe.db.sql("select student, student_name, student_batch_name from \ - `tabProgram Enrollment` where program = %s and academic_year = %s",(self.program, self.academic_year), as_dict=1) + condition = 'and academic_term=%(academic_term)s' if self.academic_term else " " + if self.get_students_from == "Student Applicant": + students = frappe.db.sql('''select name as student_applicant, title as student_name from `tabStudent Applicant` + where application_status="Approved" and program=%(program)s and academic_year=%(academic_year)s {0}''' + .format(condition), self.as_dict(), as_dict=1) + elif self.get_students_from == "Program Enrollment": + condition2 = 'and student_batch_name=%(student_batch)s' if self.student_batch else " " + students = frappe.db.sql('''select student, student_name, student_batch_name from `tabProgram Enrollment` + where program=%(program)s and academic_year=%(academic_year)s {0} {1}''' + .format(condition, condition2), self.as_dict(), as_dict=1) + student_list = [d.student for d in students] + if student_list: + inactive_students = frappe.db.sql(''' + select name as student, title as student_name from `tabStudent` where name in (%s) and enabled = 0''' % + ', '.join(['%s']*len(student_list)), tuple(student_list), as_dict=1) - inactive_students = frappe.db.sql(''' - select name as student, title as student_name from `tabStudent` where name in (%s) and enabled = 0''' % - ', '.join(['%s']*len(student_list)), tuple(student_list), as_dict=1) - - for student in students: - if student.student in [d.student for d in inactive_students]: - students.remove(student) + for student in students: + if student.student in [d.student for d in inactive_students]: + students.remove(student) if students: return students @@ -39,18 +44,22 @@ class ProgramEnrollmentTool(Document): frappe.throw(_("No students Found")) def enroll_students(self): - for stud in self.students: + total = len(self.students) + for i, stud in enumerate(self.students): + frappe.publish_realtime("program_enrollment_tool", dict(progress=[i+1, total]), user=frappe.session.user) if stud.student: prog_enrollment = frappe.new_doc("Program Enrollment") prog_enrollment.student = stud.student prog_enrollment.student_name = stud.student_name - prog_enrollment.student_batch_name = stud.student_batch_name prog_enrollment.program = self.new_program prog_enrollment.academic_year = self.new_academic_year + prog_enrollment.academic_term = self.new_academic_term + prog_enrollment.student_batch_name = stud.student_batch_name if stud.student_batch_name else self.new_student_batch prog_enrollment.save() elif stud.student_applicant: prog_enrollment = enroll_student(stud.student_applicant) prog_enrollment.academic_year = self.academic_year + prog_enrollment.academic_term = self.academic_term + prog_enrollment.student_batch_name = stud.student_batch_name if stud.student_batch_name else self.new_student_batch prog_enrollment.save() - frappe.msgprint("Students have been enrolled.") - \ No newline at end of file + frappe.msgprint("{0} Students have been enrolled.".format(total)) diff --git a/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json b/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json index 0dbe1b87a9..9be292b65e 100644 --- a/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json +++ b/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json @@ -133,6 +133,37 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student_batch_name", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Student Batch Name", + "length": 0, + "no_copy": 0, + "options": "Student Batch Name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "has_web_view": 0, @@ -145,7 +176,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-11-10 19:09:59.530615", + "modified": "2018-01-02 12:03:53.890741", "modified_by": "Administrator", "module": "Education", "name": "Program Enrollment Tool Student", diff --git a/erpnext/education/doctype/student_applicant/student_applicant.json b/erpnext/education/doctype/student_applicant/student_applicant.json index 9c8423494b..1140984a83 100644 --- a/erpnext/education/doctype/student_applicant/student_applicant.json +++ b/erpnext/education/doctype/student_applicant/student_applicant.json @@ -320,6 +320,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1058,7 +1089,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-10 19:08:55.049625", + "modified": "2018-01-02 11:47:14.944338", "modified_by": "Administrator", "module": "Education", "name": "Student Applicant", From a521efc990c863437502790e0a10f575b0abffe3 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 5 Jan 2018 12:47:20 +0530 Subject: [PATCH 09/12] fix for the non stock items for the shopping cart (#12294) --- erpnext/setup/doctype/item_group/item_group.py | 2 +- erpnext/shopping_cart/product_info.py | 4 ++-- erpnext/templates/includes/product_page.js | 2 +- erpnext/templates/includes/products_as_grid.html | 2 +- erpnext/utilities/product.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 5d3ef78f1c..39172d7d11 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -82,7 +82,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non # base query query = """select I.name, I.item_name, I.item_code, I.route, I.image, I.website_image, I.thumbnail, I.item_group, - I.description, I.web_long_description as website_description, + I.description, I.web_long_description as website_description, I.is_stock_item, case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock from `tabItem` I left join tabBin S on I.item_code = S.item_code and I.website_warehouse = S.warehouse diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py index 8015c4818f..6f9c8acf17 100644 --- a/erpnext/shopping_cart/product_info.py +++ b/erpnext/shopping_cart/product_info.py @@ -30,10 +30,10 @@ def get_product_info_for_website(item_code): product_info = { "price": price, "stock_qty": stock_status.stock_qty, - "in_stock": stock_status.in_stock, + "in_stock": stock_status.in_stock if stock_status.is_stock_item else 1, "qty": 0, "uom": frappe.db.get_value("Item", item_code, "stock_uom"), - "show_stock_qty": show_quantity_in_website() + "show_stock_qty": show_quantity_in_website() if stock_status.is_stock_item else 0 } if product_info["price"]: diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index 93dadaa589..9f9d6ac412 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -64,7 +64,7 @@ frappe.ready(function() { // then chose the closest available one var attribute = $(this).attr("data-attribute"); - var attribute_value = $(this).val() + var attribute_value = $(this).val(); var item_code = find_closest_match(attribute, attribute_value); if (!item_code) { diff --git a/erpnext/templates/includes/products_as_grid.html b/erpnext/templates/includes/products_as_grid.html index b2437d3393..4a9692aff6 100644 --- a/erpnext/templates/includes/products_as_grid.html +++ b/erpnext/templates/includes/products_as_grid.html @@ -5,7 +5,7 @@
{{ product_image_square(thumbnail or website_image) }}
{{ item_name }}
- {% if in_stock %} + {% if in_stock or not is_stock_item %}
{{ _("In stock") }}
{% else %}
{{ _("Not in stock") }}
diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py index 10366be6ec..9d5c056ba7 100644 --- a/erpnext/utilities/product.py +++ b/erpnext/utilities/product.py @@ -9,7 +9,7 @@ from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_ def get_qty_in_stock(item_code, item_warehouse_field): in_stock, stock_qty = 0, '' - template_item_code = frappe.db.get_value("Item", item_code, "variant_of") + template_item_code, is_stock_item = frappe.db.get_value("Item", item_code, ["variant_of", "is_stock_item"]) warehouse = frappe.db.get_value("Item", item_code, item_warehouse_field) if not warehouse and template_item_code and template_item_code != item_code: @@ -21,7 +21,7 @@ def get_qty_in_stock(item_code, item_warehouse_field): if stock_qty: in_stock = stock_qty[0][0] > 0 and 1 or 0 - return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty}) + return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty, "is_stock_item": is_stock_item}) def get_price(item_code, price_list, customer_group, company, qty=1): template_item_code = frappe.db.get_value("Item", item_code, "variant_of") From eac2e369cf808fecf52859687930e1928699504e Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 5 Jan 2018 12:48:08 +0530 Subject: [PATCH 10/12] [fix] setup alias for ifnull condition (#12327) --- .../report/sales_payment_summary/sales_payment_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py index 93c03087d7..f38f28d901 100644 --- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py @@ -66,12 +66,12 @@ def get_mode_of_payments(filters): invoice_list = get_invoices(filters) invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list]) if invoice_list: - inv_mop = frappe.db.sql("""select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') + inv_mop = frappe.db.sql("""select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment from `tabSales Invoice` a, `tabSales Invoice Payment` b where a.name = b.parent and a.name in ({invoice_list_names}) union - select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') + select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c where a.name = c.reference_name and b.name = c.parent From 28d0230e56957e8ea7dede8b0a2dc3dddccd8e29 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Jan 2018 13:14:14 +0530 Subject: [PATCH 11/12] Multiple small fixes --- .../hr/doctype/expense_claim/expense_claim.js | 43 ++++++++++--------- .../doctype/packing_slip/packing_slip.py | 4 +- .../item_price_stock/item_price_stock.py | 11 +++-- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 65d1065fc6..f40e77c53c 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -262,27 +262,30 @@ frappe.ui.form.on("Expense Claim", { }, get_advances: function(frm) { - return frappe.call({ - method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances", - args: { - employee: frm.doc.employee - }, - callback: function(r, rt) { - frappe.model.clear_table(frm.doc, "advances"); - if(r.message) { - $.each(r.message, function(i, d) { - var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances"); - row.employee_advance = d.name; - row.posting_date = d.posting_date; - row.advance_account = d.advance_account; - row.advance_paid = d.paid_amount; - row.unclaimed_amount = flt(d.paid_amount) - flt(d.claimed_amount); - row.allocated_amount = flt(d.paid_amount) - flt(d.claimed_amount); - }); - refresh_field("advances"); + frappe.model.clear_table(frm.doc, "advances"); + if (frm.doc.employee) { + return frappe.call({ + method: "erpnext.hr.doctype.expense_claim.expense_claim.get_advances", + args: { + employee: frm.doc.employee + }, + callback: function(r, rt) { + + if(r.message) { + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances"); + row.employee_advance = d.name; + row.posting_date = d.posting_date; + row.advance_account = d.advance_account; + row.advance_paid = d.paid_amount; + row.unclaimed_amount = flt(d.paid_amount) - flt(d.claimed_amount); + row.allocated_amount = flt(d.paid_amount) - flt(d.claimed_amount); + }); + refresh_field("advances"); + } } - } - }); + }); + } } }); diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py index ec5392f99e..b99215c426 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/packing_slip.py @@ -137,10 +137,10 @@ class PackingSlip(Document): for d in self.get("items"): res = frappe.db.get_value("Item", d.item_code, - ["net_weight", "weight_uom"], as_dict=True) + ["weight_per_unit", "weight_uom"], as_dict=True) if res and len(res)>0: - d.net_weight = res["net_weight"] + d.net_weight = res["weight_per_unit"] d.weight_uom = res["weight_uom"] def get_recommended_case_no(self): diff --git a/erpnext/stock/report/item_price_stock/item_price_stock.py b/erpnext/stock/report/item_price_stock/item_price_stock.py index 95cf3db485..4cd8fddccd 100644 --- a/erpnext/stock/report/item_price_stock/item_price_stock.py +++ b/erpnext/stock/report/item_price_stock/item_price_stock.py @@ -37,9 +37,10 @@ def get_item_price_qty_data(filters): from `tabItem Price` a left join `tabBin` b ON a.item_code = b.item_code {conditions}""" - .format(conditions=conditions),filters,as_dict=1) + .format(conditions=conditions), filters, as_dict=1) - price_list_names = ",".join(['"' + item['price_list_name'] + '"' for item in item_results]) + price_list_names = ",".join(['"' + frappe.db.escape(item['price_list_name']) + '"' + for item in item_results]) buying_price_map = get_buying_price_map(price_list_names) selling_price_map = get_selling_price_map(price_list_names) @@ -66,7 +67,8 @@ def get_buying_price_map(price_list_names): `tabItem Price` where name in ({price_list_names}) and buying=1 - """.format(price_list_names=price_list_names),as_dict=1) + """.format(price_list_names=price_list_names), as_dict=1) + buying_price_map = {} for d in buying_price: name = d["name"] @@ -84,7 +86,8 @@ def get_selling_price_map(price_list_names): `tabItem Price` where name in ({price_list_names}) and selling=1 - """.format(price_list_names=price_list_names),as_dict=1) + """.format(price_list_names=price_list_names), as_dict=1) + selling_price_map = {} for d in selling_price: name = d["name"] From c98cfbdab403899543bc3518bed0f7646713971c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 5 Jan 2018 13:46:59 +0600 Subject: [PATCH 12/12] bumped to version 10.0.6 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d871cd58ae..85ad4367bf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.0.5' +__version__ = '10.0.6' def get_default_company(user=None): '''Get default company for user'''