From 61165127fcba1c62f2d568a7a94aa818bb992a03 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 2 May 2017 13:04:08 +0530 Subject: [PATCH 01/13] [fix] Default pos profile's customer not working for the POS --- erpnext/accounts/page/pos/pos.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 70067614b6..9c195f9512 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -327,6 +327,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.name = null; this.load_data(true); this.setup(); + this.set_default_customer() }, load_data: function (load_doc) { @@ -360,6 +361,16 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ } }, + set_default_customer: function() { + if (this.default_customer && !this.frm.doc.customer) { + this.party_field.$input.val(this.default_customer); + this.frm.doc.customer = this.default_customer; + this.numeric_keypad.show(); + this.toggle_list_customer(false) + this.toggle_item_cart(true) + } + }, + set_transaction_defaults: function (party) { var me = this; this.party = party; @@ -675,11 +686,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ me.toggle_delete_button(); } - if (this.default_customer && !this.frm.doc.customer) { - this.party_field.$input.val(this.default_customer); - this.frm.doc.customer = this.default_customer; - } - this.party_field.awesomeplete = new Awesomplete(this.party_field.$input.get(0), { minChars: 0, From c482aeda1a5f6f3a4263902702e2444d33520c81 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Tue, 2 May 2017 12:53:12 +0530 Subject: [PATCH 02/13] [fixes] added missing get_linked_material_requests method to buying utils --- erpnext/buying/utils.py | 23 +++++++++++++++++++++++ erpnext/public/js/controllers/buying.js | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py index 28c757948a..9146c58d0e 100644 --- a/erpnext/buying/utils.py +++ b/erpnext/buying/utils.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import flt, cstr, cint from frappe import _ +import json from erpnext.stock.doctype.item.item import get_last_purchase_details from erpnext.stock.doctype.item.item import validate_end_of_life @@ -78,3 +79,25 @@ def check_for_closed_status(doctype, docname): if status == "Closed": frappe.throw(_("{0} {1} status is {2}").format(doctype, docname, status), frappe.InvalidStatusError) +@frappe.whitelist() +def get_linked_material_requests(items): + items = json.loads(items) + mr_list = [] + for item in items: + material_request = frappe.db.sql("""SELECT distinct mr.name AS mr_name, + (mr_item.qty - mr_item.ordered_qty) AS qty, + mr_item.item_code AS item_code, + mr_item.name AS mr_item + FROM `tabMaterial Request` mr, `tabMaterial Request Item` mr_item + WHERE mr.name = mr_item.parent + AND mr_item.item_code = %(item)s + AND mr.material_request_type = 'Purchase' + AND mr.per_ordered < 99.99 + AND mr.docstatus = 1 + AND mr.status != 'Stopped' + ORDER BY mr_item.item_code ASC""",{"item": item}, as_dict=1) + if material_request: + mr_list.append(material_request) + + return mr_list + diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 108aac1af8..a8c80fe237 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -220,7 +220,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } } frappe.call({ - method: "erpnext.buying.doctype.purchase_common.purchase_common.get_linked_material_requests", + method: "erpnext.buying.utils.get_linked_material_requests", args:{ items: my_items }, From e15721df4844578ab8c8115103bba307f1d11387 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Apr 2017 16:28:00 +0530 Subject: [PATCH 03/13] Caluculate total interest and payable amount in Loan Application if fixed amount per period --- .../employee_loan_application.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py b/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py index 357571e2a3..0c29e0d4ef 100644 --- a/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py +++ b/erpnext/hr/doctype/employee_loan_application/employee_loan_application.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe, math from frappe import _ -from frappe.utils import flt +from frappe.utils import flt, rounded from frappe.model.mapper import get_mapped_doc from frappe.model.document import Document @@ -35,9 +35,21 @@ class EmployeeLoanApplication(Document): else: self.repayment_periods = self.loan_amount / self.repayment_amount - self.total_payable_amount = self.repayment_amount * self.repayment_periods - self.total_payable_interest = self.total_payable_amount - self.loan_amount + self.calculate_payable_amount() + + def calculate_payable_amount(self): + balance_amount = self.loan_amount + self.total_payable_amount = 0 + self.total_payable_interest = 0 + while(balance_amount > 0): + interest_amount = rounded(balance_amount * flt(self.rate_of_interest) / (12*100)) + balance_amount = rounded(balance_amount + interest_amount - self.repayment_amount) + + self.total_payable_interest += interest_amount + + self.total_payable_amount = self.loan_amount + self.total_payable_interest + @frappe.whitelist() def make_employee_loan(source_name, target_doc = None): doclist = get_mapped_doc("Employee Loan Application", source_name, { From 504eba7fb2865065f35ab31ae85ad5ad32167332 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 2 May 2017 13:59:26 +0530 Subject: [PATCH 04/13] Test case fixed for Employee Loan Application --- .../hr/doctype/employee_loan/employee_loan.js | 2 +- .../doctype/employee_loan/employee_loan.json | 35 +++++++++++++++++-- .../hr/doctype/employee_loan/employee_loan.py | 2 +- .../test_employee_loan_application.py | 8 ++--- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.js b/erpnext/hr/doctype/employee_loan/employee_loan.js index 2f87acf6e8..71b6356ef6 100644 --- a/erpnext/hr/doctype/employee_loan/employee_loan.js +++ b/erpnext/hr/doctype/employee_loan/employee_loan.js @@ -79,7 +79,7 @@ frappe.ui.form.on('Employee Loan', { }, employee_loan_application: function(frm) { - return frm.call({ + return frappe.call({ method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application", args: { "employee_loan_application": frm.doc.employee_loan_application diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.json b/erpnext/hr/doctype/employee_loan/employee_loan.json index 7606e924d5..35c735af88 100644 --- a/erpnext/hr/doctype/employee_loan/employee_loan.json +++ b/erpnext/hr/doctype/employee_loan/employee_loan.json @@ -14,6 +14,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -44,6 +45,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -74,6 +76,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -104,6 +107,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -134,6 +138,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -162,6 +167,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -192,6 +198,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -222,10 +229,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "default": "Sanctioned", "fieldname": "status", "fieldtype": "Select", "hidden": 0, @@ -237,7 +246,7 @@ "in_standard_filter": 0, "label": "Status", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Sanctioned\nPartially Disbursed\nFully Disbursed\nRepaid/Closed", "permlevel": 0, "precision": "", @@ -252,6 +261,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -281,6 +291,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -310,6 +321,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -340,6 +352,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -371,6 +384,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -400,6 +414,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -428,6 +443,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -459,6 +475,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -490,6 +507,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -522,6 +540,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -551,6 +570,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -581,6 +601,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -611,6 +632,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -639,6 +661,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -669,6 +692,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -699,6 +723,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -728,6 +753,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -758,6 +784,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -787,6 +814,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -818,6 +846,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -846,6 +875,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -877,6 +907,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -916,7 +947,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-03-30 12:59:40.650035", + "modified": "2017-05-02 13:52:30.884154", "modified_by": "Administrator", "module": "HR", "name": "Employee Loan", diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.py b/erpnext/hr/doctype/employee_loan/employee_loan.py index 7e16ec1c10..dadd7694bd 100644 --- a/erpnext/hr/doctype/employee_loan/employee_loan.py +++ b/erpnext/hr/doctype/employee_loan/employee_loan.py @@ -132,7 +132,7 @@ def get_monthly_repayment_amount(repayment_method, loan_amount, rate_of_interest def get_employee_loan_application(employee_loan_application): employee_loan = frappe.get_doc("Employee Loan Application", employee_loan_application) if employee_loan: - return employee_loan + return employee_loan.as_dict() @frappe.whitelist() def make_jv_entry(employee_loan, company, employee_loan_account, employee, loan_amount, payment_account): diff --git a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py index 1d157d6d81..789b5d4a02 100644 --- a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py +++ b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.py @@ -39,13 +39,13 @@ class TestEmployeeLoanApplication(unittest.TestCase): def test_loan_totals(self): loan_application = frappe.get_doc("Employee Loan Application", {"employee":self.employee}) self.assertEquals(loan_application.repayment_amount, 11445) - self.assertEquals(loan_application.total_payable_interest, 24680) - self.assertEquals(loan_application.total_payable_amount, 274680) + self.assertEquals(loan_application.total_payable_interest, 24657) + self.assertEquals(loan_application.total_payable_amount, 274657) loan_application.repayment_method = "Repay Fixed Amount per Period" loan_application.repayment_amount = 15000 loan_application.save() self.assertEquals(loan_application.repayment_periods, 18) - self.assertEquals(loan_application.total_payable_interest, 20000) - self.assertEquals(loan_application.total_payable_amount, 270000) \ No newline at end of file + self.assertEquals(loan_application.total_payable_interest, 18506) + self.assertEquals(loan_application.total_payable_amount, 268506) \ No newline at end of file From fd3751616519961f337277c7d6e1219047c595bc Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 2 May 2017 18:27:09 +0530 Subject: [PATCH 05/13] [fix] Contact not creating if only email id has entered in the POS --- erpnext/accounts/doctype/sales_invoice/pos.py | 25 +++++++++++++++++++ erpnext/accounts/page/pos/pos.js | 1 + 2 files changed, 26 insertions(+) diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py index f1f997a7f6..a899cde25d 100644 --- a/erpnext/accounts/doctype/sales_invoice/pos.py +++ b/erpnext/accounts/doctype/sales_invoice/pos.py @@ -325,8 +325,10 @@ def make_customer_and_address(customers): if not frappe.db.exists('Customer', name): name = add_customer(name) data = json.loads(data) + make_contact(data, name) make_address(data, name) customer_list.append(name) + frappe.db.commit() return customer_list def add_customer(name): @@ -340,6 +342,29 @@ def add_customer(name): frappe.db.commit() return customer_doc.name +def make_contact(args,customer): + if args.get('email_id') or args.get('phone'): + name = frappe.db.get_value('Dynamic Link', + {'link_doctype': 'Customer', 'link_name': customer, 'parenttype': 'Contact'}, 'parent') + + args = { + 'email_id': args.get('email_id'), + 'phone': args.get('phone') + } + + doc = frappe.new_doc('Contact') + if name: + doc = frappe.get_doc('Contact', name) + + doc.update(args) + if not name: + doc.first_name = customer + doc.append('links',{ + 'link_doctype': 'Customer', + 'link_name': customer + }) + doc.save(ignore_permissions=True) + def make_address(args, customer): if not args.get('address_line1'): return diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index 9c195f9512..c632e459e3 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -866,6 +866,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.customer_doc.set_primary_action(__("Save"), function () { me.make_offline_customer(new_customer); me.pos_bill.show(); + me.list_customers.hide(); }); }, From bd8c7d683bfb651038cdbc7df3b9bbcc51ebabae Mon Sep 17 00:00:00 2001 From: Aditya Duggal Date: Wed, 3 May 2017 10:02:10 +0530 Subject: [PATCH 06/13] Website related fields now consider show_variant_in_website field as well -Resolves issue #8635 --- erpnext/stock/doctype/item/item.json | 121 ++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 6a34ae6d95..d42e60d1bf 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -16,6 +16,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -46,6 +47,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -75,6 +77,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -106,6 +109,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -138,6 +142,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -168,6 +173,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -196,6 +202,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -228,6 +235,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -260,6 +268,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -287,6 +296,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -316,6 +326,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -349,6 +360,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -379,6 +391,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -409,6 +422,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -438,6 +452,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -467,6 +482,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -498,6 +514,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -528,6 +545,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -557,6 +575,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -588,6 +607,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -618,6 +638,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -650,6 +671,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -683,6 +705,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -715,6 +738,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -746,6 +770,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -776,6 +801,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -808,6 +834,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -838,6 +865,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -869,6 +897,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -899,6 +928,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -929,6 +959,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -960,6 +991,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -991,6 +1023,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1021,6 +1054,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1054,6 +1088,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1085,6 +1120,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1118,6 +1154,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1149,6 +1186,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1177,6 +1215,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1211,6 +1250,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1241,6 +1281,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1272,6 +1313,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1305,6 +1347,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1337,6 +1380,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1368,6 +1412,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1398,6 +1443,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1428,6 +1474,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1461,6 +1508,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1490,6 +1538,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1522,6 +1571,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1555,6 +1605,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1588,6 +1639,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1619,6 +1671,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1649,6 +1702,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1679,6 +1733,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1708,6 +1763,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1738,6 +1794,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1767,6 +1824,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1798,6 +1856,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1828,6 +1887,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1857,6 +1917,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1887,6 +1948,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1915,6 +1977,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1945,6 +2008,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1975,6 +2039,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2005,6 +2070,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2036,6 +2102,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2066,6 +2133,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2096,6 +2164,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2126,6 +2195,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2157,6 +2227,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2188,6 +2259,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2219,6 +2291,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -2249,6 +2322,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2281,6 +2355,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -2311,6 +2386,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2343,6 +2419,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2372,6 +2449,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2405,6 +2483,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -2436,6 +2515,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2468,6 +2548,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2501,6 +2582,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2529,6 +2611,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2557,6 +2640,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -2586,6 +2670,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2615,6 +2700,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2645,11 +2731,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "fieldname": "route", "fieldtype": "Small Text", "hidden": 0, @@ -2675,11 +2762,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "description": "Items with higher weightage will be shown higher", "fieldname": "weightage", "fieldtype": "Int", @@ -2705,11 +2793,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "description": "Show a slideshow at the top of the page", "fieldname": "slideshow", "fieldtype": "Link", @@ -2736,11 +2825,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "description": "Item Image (if not slideshow)", "fieldname": "website_image", "fieldtype": "Attach", @@ -2767,6 +2857,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2796,6 +2887,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2823,11 +2915,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", "fieldname": "website_warehouse", "fieldtype": "Link", @@ -2854,11 +2947,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "description": "List this Item in multiple groups on the website.", "fieldname": "website_item_groups", "fieldtype": "Table", @@ -2885,12 +2979,13 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, "collapsible_depends_on": "website_specifications", "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "fieldname": "sb72", "fieldtype": "Section Break", "hidden": 0, @@ -2915,11 +3010,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "fieldname": "copy_from_item_group", "fieldtype": "Button", "hidden": 0, @@ -2944,11 +3040,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "fieldname": "website_specifications", "fieldtype": "Table", "hidden": 0, @@ -2974,11 +3071,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "show_in_website", + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", "fieldname": "web_long_description", "fieldtype": "Text Editor", "hidden": 0, @@ -3003,6 +3101,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -3044,7 +3143,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2017-04-25 08:14:26.785497", + "modified": "2017-05-03 09:55:11.624283", "modified_by": "Administrator", "module": "Stock", "name": "Item", From ef027e9030c6ba4c7fc46fa29f569344ee44d581 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 3 May 2017 11:51:39 +0530 Subject: [PATCH 07/13] Correct args to the fmt_money function --- erpnext/accounts/doctype/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 11f376d68c..998fee9732 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -189,8 +189,8 @@ class Account(Document): if account_balance != stock_balance: frappe.throw(_('Account balance ({0}) and stock value ({1}) must be same')\ - .format(fmt_money(account_balance, self.account_currency), - fmt_money(stock_balance, self.account_currency))) + .format(fmt_money(account_balance, currency=self.account_currency), + fmt_money(stock_balance, currency=self.account_currency))) elif self.warehouse: self.warehouse = None From 470535ae9b899a2b623add1e00c46aa301d8d612 Mon Sep 17 00:00:00 2001 From: Javier Wong Date: Tue, 2 May 2017 18:59:45 +0800 Subject: [PATCH 08/13] Removed set_default_roles set_default_roles was removed in https://github.com/frappe/frappe/commit/7fff0908a44a2435aa2575c965b0d921ef07b038 It is not required anymore. It currently breaks the patch. --- erpnext/patches/v7_1/update_portal_roles.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/patches/v7_1/update_portal_roles.py b/erpnext/patches/v7_1/update_portal_roles.py index 506adb91fc..72e9434c26 100644 --- a/erpnext/patches/v7_1/update_portal_roles.py +++ b/erpnext/patches/v7_1/update_portal_roles.py @@ -13,7 +13,6 @@ def execute(): # set customer, supplier roles for c in frappe.get_all('Contact', fields=['user'], filters={'ifnull(user, "")': ('!=', '')}): user = frappe.get_doc('User', c.user) - user.set_default_roles() user.flags.ignore_validate = True user.flags.ignore_mandatory = True user.save() From 3ce41d6b1f72ce96c71747365e21698ab43516b3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 3 May 2017 18:22:24 +0530 Subject: [PATCH 09/13] Fixed related to auto fetching batch nos and date valiation in salary structure (#8666) * Fixed related to auto fetching batch nos and date valiation in salary structure * Update get_item_details.py --- erpnext/hr/doctype/salary_structure/salary_structure.py | 2 +- erpnext/stock/get_item_details.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py index 12f8335b4d..da69bccd59 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.py +++ b/erpnext/hr/doctype/salary_structure/salary_structure.py @@ -33,7 +33,7 @@ class SalaryStructure(Document): for employee in self.get('employees'): joining_date, relieving_date = frappe.db.get_value("Employee", employee.employee, ["date_of_joining", "relieving_date"]) - if employee.from_date and getdate(employee.from_date) < joining_date: + if employee.from_date and joining_date and getdate(employee.from_date) < joining_date: frappe.throw(_("From Date {0} for Employee {1} cannot be before employee's joining Date {2}") .format(employee.from_date, employee.employee, joining_date)) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 66ab6aceb6..35760fd7a1 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -74,7 +74,10 @@ def get_item_details(args): out.update(get_pricing_rule_for_item(args)) - if args.get("doctype") in ("Sales Invoice", "Delivery Note") and out.stock_qty > 0: + if (args.get("doctype") == "Delivery Note" or + (args.get("doctype") == "Sales Invoice" and args.get('update_stock'))) \ + and out.warehouse and out.stock_qty > 0: + if out.has_serial_no: out.serial_no = get_serial_no(out) From fcc0246b3820d59d87a3212346eed395e654fabb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 May 2017 12:11:48 +0530 Subject: [PATCH 10/13] Get mobile nos for customer contact (#8674) --- erpnext/public/js/sms_manager.js | 16 ++++++++-------- .../setup/doctype/sms_settings/sms_settings.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/erpnext/public/js/sms_manager.js b/erpnext/public/js/sms_manager.js index a06c43c6f5..d6293ea107 100644 --- a/erpnext/public/js/sms_manager.js +++ b/erpnext/public/js/sms_manager.js @@ -21,9 +21,9 @@ function SMSManager(doc) { } if (in_list(['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'], doc.doctype)) - this.show(doc.contact_person, 'customer', doc.customer, '', default_msg[doc.doctype]); + this.show(doc.contact_person, 'Customer', doc.customer, '', default_msg[doc.doctype]); else if (in_list(['Purchase Order', 'Purchase Receipt'], doc.doctype)) - this.show(doc.contact_person, 'supplier', doc.supplier, '', default_msg[doc.doctype]); + this.show(doc.contact_person, 'Supplier', doc.supplier, '', default_msg[doc.doctype]); else if (doc.doctype == 'Lead') this.show('', '', '', doc.mobile_no, default_msg[doc.doctype]); else if (doc.doctype == 'Opportunity') @@ -33,13 +33,13 @@ function SMSManager(doc) { }; - this.get_contact_number = function(contact, key, value) { + this.get_contact_number = function(contact, ref_doctype, ref_name) { frappe.call({ method: "erpnext.setup.doctype.sms_settings.sms_settings.get_contact_number", args: { - contact_name:contact, - value:value, - key:key + contact_name: contact, + ref_doctype: ref_doctype, + ref_name: ref_name }, callback: function(r) { if(r.exc) { msgprint(r.exc); return; } @@ -49,13 +49,13 @@ function SMSManager(doc) { }); }; - this.show = function(contact, key, value, mobile_nos, message) { + this.show = function(contact, ref_doctype, ref_name, mobile_nos, message) { this.message = message; if (mobile_nos) { me.number = mobile_nos; me.show_dialog(); } else if (contact){ - this.get_contact_number(contact, key, value) + this.get_contact_number(contact, ref_doctype, ref_name) } else { me.show_dialog(); } diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.py b/erpnext/setup/doctype/sms_settings/sms_settings.py index 2888942613..a8b59beffa 100644 --- a/erpnext/setup/doctype/sms_settings/sms_settings.py +++ b/erpnext/setup/doctype/sms_settings/sms_settings.py @@ -40,10 +40,15 @@ def get_sender_name(): return sender_name @frappe.whitelist() -def get_contact_number(contact_name, value, key): +def get_contact_number(contact_name, ref_doctype, ref_name): "returns mobile number of the contact" - number = frappe.db.sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" % - ('%s', frappe.db.escape(key), '%s'), (contact_name, value)) + number = frappe.db.sql("""select mobile_no, phone from tabContact + where name=%s + and exists( + select name from `tabDynamic Link` where link_doctype=%s and link_name=%s + ) + """, (contact_name, ref_doctype, ref_name)) + return number and (number[0][0] or number[0][1]) or '' @frappe.whitelist() From 1c09a991f3f690f218c7d8c763154561978c084a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 4 May 2017 12:12:14 +0530 Subject: [PATCH 11/13] Change beta_version to 8.x-beta (#8673) * Change beta_version to 8.x-beta * change to 8.x.x-beta --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 5b4e687b3b..af4dd3b68e 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" -develop_version = '8.0.0-beta' +develop_version = '8.x.x-beta' error_report_email = "support@erpnext.com" From 932423ecba5848dc2a19949c032006b90b92cc75 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 May 2017 12:12:29 +0530 Subject: [PATCH 12/13] Balance Sheet always shows accumulated values from previous fiscal year (#8668) --- .../report/balance_sheet/balance_sheet.js | 3 ++- .../report/balance_sheet/balance_sheet.py | 14 ++++++-------- erpnext/accounts/report/financial_statements.py | 17 ++++++++++------- erpnext/accounts/utils.py | 3 ++- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.js b/erpnext/accounts/report/balance_sheet/balance_sheet.js index 9cd92d4367..760fa649e6 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.js +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.js @@ -7,7 +7,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { frappe.query_reports["Balance Sheet"]["filters"].push({ "fieldname": "accumulated_values", "label": __("Accumulated Values"), - "fieldtype": "Check" + "fieldtype": "Check", + "default": 1 }); }); diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py index 9095d8619b..2db4ef8a26 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.py +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py @@ -9,22 +9,19 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c def execute(filters=None): period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, - filters.periodicity, filters.accumulated_values, filters.company) + filters.periodicity, company=filters.company) asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False, filters=filters, - accumulated_values=filters.accumulated_values, - ignore_closing_entries=True, ignore_accumulated_values_for_fy=True) + accumulated_values=filters.accumulated_values) liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False, filters=filters, - accumulated_values=filters.accumulated_values, - ignore_closing_entries=True, ignore_accumulated_values_for_fy=True) + accumulated_values=filters.accumulated_values) equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False, filters=filters, - accumulated_values=filters.accumulated_values, - ignore_closing_entries=True, ignore_accumulated_values_for_fy=True) + accumulated_values=filters.accumulated_values) provisional_profit_loss, total_credit = get_provisional_profit_loss(asset, liability, equity, period_list, filters.company) @@ -114,7 +111,8 @@ def check_opening_balance(asset, liability, equity): opening_balance -= flt(liability[0].get("opening_balance", 0), float_precision) if equity: opening_balance -= flt(equity[0].get("opening_balance", 0), float_precision) - + + opening_balance = flt(opening_balance, float_precision) if opening_balance: return _("Previous Financial Year is not closed"),opening_balance return None,None diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 9ba7711f0b..41d0e48a77 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -6,8 +6,11 @@ import frappe from frappe import _ from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff, add_months, add_days, formatdate, cint) +from erpnext.accounts.utils import get_fiscal_year -def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_values=False, company=None): + +def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_values=False, + company=None, reset_period_on_fy_change=True): """Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label} Periodicity can be (Yearly, Quarterly, Monthly)""" @@ -49,7 +52,8 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_v # if a fiscal year ends before a 12 month period period.to_date = year_end_date - period.to_date_fiscal_year = get_date_fiscal_year(period.to_date, company) + period.to_date_fiscal_year = get_fiscal_year(period.to_date, company=company)[0] + period.from_date_fiscal_year_start_date = get_fiscal_year(period.from_date, company=company)[1] period_list.append(period) @@ -65,7 +69,10 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_v if not accumulated_values: label = get_label(periodicity, opts["from_date"], opts["to_date"]) else: - label = get_label(periodicity, period_list[0]["from_date"], opts["to_date"]) + if reset_period_on_fy_change: + label = get_label(periodicity, opts.from_date_fiscal_year_start_date, opts["to_date"]) + else: + label = get_label(periodicity, period_list[0].from_date, opts["to_date"]) opts.update({ "key": key.replace(" ", "_").replace("-", "_"), @@ -150,10 +157,6 @@ def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accum if entry.posting_date < period_list[0].year_start_date: d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit) -def get_date_fiscal_year(date, company): - from erpnext.accounts.utils import get_fiscal_year - return get_fiscal_year(date, company=company)[0] - def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values): """accumulate children's values in parent accounts""" for d in reversed(accounts): diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 2c1448c8b3..1721fa996f 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -11,7 +11,6 @@ from frappe.utils import formatdate, get_number_format_info # imported to enable erpnext.accounts.utils.get_account_currency from erpnext.accounts.doctype.account.account import get_account_currency -from erpnext.accounts.report.financial_statements import sort_root_accounts class FiscalYearError(frappe.ValidationError): pass @@ -652,6 +651,8 @@ def get_companies(): @frappe.whitelist() def get_children(): + from erpnext.accounts.report.financial_statements import sort_root_accounts + args = frappe.local.form_dict doctype, company = args['doctype'], args['company'] fieldname = frappe.db.escape(doctype.lower().replace(' ','_')) From 8470b39d4c66e4c961f4a88b671ef0d2d9c19511 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 4 May 2017 12:50:31 +0600 Subject: [PATCH 13/13] bumped to version 8.0.22 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 0bf65d2105..d102c9e9cd 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.21' +__version__ = '8.0.22' def get_default_company(user=None): '''Get default company for user'''