From 6677fd58ef4aa4a88f14afb4cf0187b0b3b3c483 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 7 Apr 2016 18:19:56 +0530 Subject: [PATCH 01/13] [fix] bench init using correct frappe branch --- .travis.yml | 2 +- ci/fix-mariadb.sh | 11 ----------- ci/my_config.h.patch | 22 ---------------------- travis/bench_init.sh | 8 ++++++++ 4 files changed, 9 insertions(+), 34 deletions(-) delete mode 100755 ci/fix-mariadb.sh delete mode 100644 ci/my_config.h.patch create mode 100755 travis/bench_init.sh diff --git a/.travis.yml b/.travis.yml index 12a73c9b85..966dfd37d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis - sudo pip install --upgrade pip - rm $TRAVIS_BUILD_DIR/.git/shallow - - cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch develop + - bash $TRAVIS_BUILD_DIR/travis/bench_init.sh - cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/ script: diff --git a/ci/fix-mariadb.sh b/ci/fix-mariadb.sh deleted file mode 100755 index 886ec5e0d0..0000000000 --- a/ci/fix-mariadb.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# stolen from http://cgit.drupalcode.org/octopus/commit/?id=db4f837 -includedir=`mysql_config --variable=pkgincludedir` -thiscwd=`pwd` -_THIS_DB_VERSION=`mysql -V 2>&1 | tr -d "\n" | cut -d" " -f6 | awk '{ print $1}' | cut -d"-" -f1 | awk '{ print $1}' | sed "s/[\,']//g"` -if [ "$_THIS_DB_VERSION" = "5.5.40" ] && [ ! -e "$includedir-$_THIS_DB_VERSION-fixed.log" ] ; then - cd $includedir - sudo patch -p1 < $thiscwd/ci/my_config.h.patch &> /dev/null - sudo touch $includedir-$_THIS_DB_VERSION-fixed.log -fi diff --git a/ci/my_config.h.patch b/ci/my_config.h.patch deleted file mode 100644 index 5247b5b39b..0000000000 --- a/ci/my_config.h.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -burp a/my_config.h b/my_config.h ---- a/my_config.h 2014-10-09 19:32:46.000000000 -0400 -+++ b/my_config.h 2014-10-09 19:35:12.000000000 -0400 -@@ -641,17 +641,4 @@ - #define SIZEOF_TIME_T 8 - /* #undef TIME_T_UNSIGNED */ - --/* -- stat structure (from ) is conditionally defined -- to have different layout and size depending on the defined macros. -- The correct macro is defined in my_config.h, which means it MUST be -- included first (or at least before - so, practically, -- before including any system headers). -- -- __GLIBC__ is defined in --*/ --#ifdef __GLIBC__ --#error MUST be included first! --#endif -- - #endif - diff --git a/travis/bench_init.sh b/travis/bench_init.sh new file mode 100755 index 0000000000..a8bb492ae9 --- /dev/null +++ b/travis/bench_init.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cd ~/ +curl -I https://github.com/frappe/frappe/tree/$TRAVIS_BRANCH | head -n 1 | cut -d $' ' -f2 | ( + read response; + [ $response == '200' ] && branch=$TRAVIS_BRANCH || branch='develop'; + bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch $branch +) From ce893499d75b6f87b7b2cf5a98a651063ab27872 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Fri, 8 Apr 2016 16:52:53 +0530 Subject: [PATCH 02/13] Removed education as a domain in ERPNext setup wizard --- erpnext/public/js/setup_wizard.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 5e16dd89d2..2eb73a3e98 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -28,7 +28,6 @@ function load_erpnext_slides() { {"label": __("Manufacturing"), "value": "Manufacturing"}, {"label": __("Retail"), "value": "Retail"}, {"label": __("Services"), "value": "Services"}, - {"label": __("Education"), "value": "Education"}, {"label": __("Other"), "value": "Other"}, ], reqd:1}, {fieldname:'chart_of_accounts', label: __('Chart of Accounts'), From 79a415e3b87fb7c312863b76b5052349ca06b537 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 8 Apr 2016 17:05:49 +0530 Subject: [PATCH 03/13] [fix] Use for shopping cart validation in Tax Rule --- erpnext/accounts/doctype/tax_rule/tax_rule.js | 15 +------------- erpnext/accounts/doctype/tax_rule/tax_rule.py | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.js b/erpnext/accounts/doctype/tax_rule/tax_rule.js index 4c35370eae..935ea62b67 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.js +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.js @@ -19,19 +19,6 @@ frappe.ui.form.on("Tax Rule", "refresh", function(frm) { frappe.ui.form.trigger("Tax Rule", "tax_type"); }) -frappe.ui.form.on("Tax Rule", "use_for_shopping_cart", function(frm) { - if(!frm.doc.use_for_shopping_cart && - (frappe.get_list("Tax Rule", {"use_for_shopping_cart":1}).length == 0)) { - frappe.model.get_value("Shopping Cart Settings", "Shopping Cart Settings", - "enabled", function(docfield) { - if(docfield.enabled){ - frm.set_value("use_for_shopping_cart", 1); - frappe.throw(__("Shopping Cart is enabled")); - } - }); - } -}) - frappe.ui.form.on("Tax Rule", "customer", function(frm) { frappe.call({ method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details", @@ -64,4 +51,4 @@ frappe.ui.form.on("Tax Rule", "supplier", function(frm) { } } }); -}); \ No newline at end of file +}); diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index 7b6208293a..ce20d3a3d5 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document -from frappe.utils import cstr +from frappe.utils import cstr, cint class IncorrectCustomerGroup(frappe.ValidationError): pass class IncorrectSupplierType(frappe.ValidationError): pass @@ -20,15 +20,16 @@ class TaxRule(Document): self.validate_tax_template() self.validate_date() self.validate_filters() + self.validate_use_for_shopping_cart() def validate_tax_template(self): if self.tax_type== "Sales": - self.purchase_tax_template = self.supplier = self.supplier_type= None + self.purchase_tax_template = self.supplier = self.supplier_type = None if self.customer: self.customer_group = None else: - self.sales_tax_template= self.customer = self.customer_group= None + self.sales_tax_template = self.customer = self.customer_group = None if self.supplier: self.supplier_type = None @@ -81,6 +82,15 @@ class TaxRule(Document): if tax_rule[0].priority == self.priority: frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule) + def validate_use_for_shopping_cart(self): + '''If shopping cart is enabled and no tax rule exists for shopping cart, enable this one''' + if (not self.use_for_shopping_cart + and cint(frappe.db.get_single_value('Shopping Cart Settings', 'enabled')) + and not frappe.db.get_value('Tax Rule', {'use_for_shopping_cart': 1, 'name': ['!=', self.name]})): + + self.use_for_shopping_cart = 1 + frappe.msgprint(_("Enabling 'Use for Shopping Cart', as Shopping Cart is enabled and there should be at least one Tax Rule for Shopping Cart")) + @frappe.whitelist() def get_party_details(party, party_type, args=None): out = {} @@ -109,11 +119,11 @@ def get_party_details(party, party_type, args=None): def get_tax_template(posting_date, args): """Get matching tax rule""" args = frappe._dict(args) - conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}') + conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}') and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)] for key, value in args.iteritems(): - if key in "use_for_shopping_cart": + if key=="use_for_shopping_cart": conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0)) else: conditions.append("ifnull({0}, '') in ('', '{1}')".format(key, frappe.db.escape(cstr(value)))) From 7b46e5148a241de7e16e65413880086b865da7aa Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Fri, 8 Apr 2016 17:28:44 +0530 Subject: [PATCH 04/13] Fixed setup wizard --- erpnext/setup/setup_wizard/setup_wizard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index 864d2d0c04..98a601902b 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -426,7 +426,7 @@ def create_users(args): # create employee for self emp = frappe.get_doc({ "doctype": "Employee", - "full_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])), + "employee_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])), "user_id": frappe.session.user, "status": "Active", "company": args.get("company_name") @@ -470,7 +470,7 @@ def create_users(args): # create employee emp = frappe.get_doc({ "doctype": "Employee", - "full_name": fullname, + "employee_name": fullname, "user_id": email, "status": "Active", "company": args.get("company_name") From 2f957f27b0578620f2916eaa7f8696d28ba98b72 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 8 Apr 2016 17:36:10 +0530 Subject: [PATCH 05/13] [fix] apply Tax Rule for lead --- erpnext/accounts/party.py | 6 +- erpnext/controllers/selling_controller.py | 5 +- erpnext/crm/doctype/lead/lead.py | 10 ++- erpnext/public/js/utils/party.js | 72 ++++++++++++------- .../selling/doctype/quotation/quotation.js | 14 ++-- 5 files changed, 73 insertions(+), 34 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 0c8d999a98..2101a25230 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -299,8 +299,12 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup else: args.update(get_party_details(party, party_type)) - if party_type=="Customer": + if party_type in ("Customer", "Lead"): args.update({"tax_type": "Sales"}) + + if party_type=='Lead': + args['customer'] = None + del args['lead'] else: args.update({"tax_type": "Purchase"}) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index b8b2c31385..d12486d304 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -51,7 +51,10 @@ class SellingController(StockController): elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details - self.update_if_missing(get_lead_details(self.lead)) + self.update_if_missing(get_lead_details( + self.lead, + posting_date=self.get('transaction_date') or self.get('posting_date'), + company=self.company)) def set_price_list_and_item_details(self): self.set_price_list_currency("Selling") diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index ea06f53c3e..a743e56e91 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -10,6 +10,7 @@ from frappe.model.mapper import get_mapped_doc from erpnext.controllers.selling_controller import SellingController from erpnext.utilities.address_and_contact import load_address_and_contact +from erpnext.accounts.party import set_taxes sender_field = "email_id" @@ -58,7 +59,7 @@ class Lead(SellingController): def check_email_id_is_unique(self): if self.email_id: # validate email is unique - duplicate_leads = frappe.db.sql_list("""select name from tabLead + duplicate_leads = frappe.db.sql_list("""select name from tabLead where email_id=%s and name!=%s""", (self.email_id, self.name)) if duplicate_leads: @@ -138,7 +139,7 @@ def make_quotation(source_name, target_doc=None): return target_doc @frappe.whitelist() -def get_lead_details(lead): +def get_lead_details(lead, posting_date=None, company=None): if not lead: return {} from erpnext.accounts.party import set_address_details @@ -158,4 +159,9 @@ def get_lead_details(lead): set_address_details(out, lead, "Lead") + taxes_and_charges = set_taxes(None, 'Lead', posting_date, company, + billing_address=out.get('customer_address'), shipping_address=out.get('shipping_address_name')) + if taxes_and_charges: + out['taxes_and_charges'] = taxes_and_charges + return out diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 1896f88884..e57fbffa1d 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -69,37 +69,59 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field, if(r.message) { frm.set_value(display_field, r.message) } - - if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) { - if(!erpnext.utils.validate_mandatory(frm, "Customer/Supplier", - frm.doc.customer || frm.doc.supplier, address_field)) return; - if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date", - frm.doc.posting_date || frm.doc.transaction_date, address_field)) return; - } else return; - - frappe.call({ - method: "erpnext.accounts.party.set_taxes", - args: { - "party": frm.doc.customer || frm.doc.supplier, - "party_type": (frm.doc.customer ? "Customer" : "Supplier"), - "posting_date": frm.doc.posting_date || frm.doc.transaction_date, - "company": frm.doc.company, - "billing_address": ((frm.doc.customer) ? (frm.doc.customer_address) : (frm.doc.supplier_address)), - "shipping_address": frm.doc.shipping_address_name - }, - callback: function(r) { - if(r.message){ - frm.set_value("taxes_and_charges", r.message) - } - } - }); + erpnext.utils.set_taxes(frm, address_field, display_field, is_your_company_address); } }) } else { frm.set_value(display_field, null); } - + +}; + +erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_company_address) { + if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) { + if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier", + frm.doc.customer || frm.doc.supplier || frm.doc.lead, address_field)) { + return; + } + + if(!erpnext.utils.validate_mandatory(frm, "Posting/Transaction Date", + frm.doc.posting_date || frm.doc.transaction_date, address_field)) { + return; + } + } else { + return; + } + + var party_type, party; + if (frm.doc.lead) { + party_type = 'Lead'; + party = frm.doc.lead; + } else if (frm.doc.customer) { + party_type = 'Customer'; + party = frm.doc.customer; + } else if (frm.doc.supplier) { + party_type = 'Supplier'; + party = frm.doc.supplier; + } + + frappe.call({ + method: "erpnext.accounts.party.set_taxes", + args: { + "party": party, + "party_type": party_type, + "posting_date": frm.doc.posting_date || frm.doc.transaction_date, + "company": frm.doc.company, + "billing_address": ((frm.doc.customer || frm.doc.lead) ? (frm.doc.customer_address) : (frm.doc.supplier_address)), + "shipping_address": frm.doc.shipping_address_name + }, + callback: function(r) { + if(r.message){ + frm.set_value("taxes_and_charges", r.message) + } + } + }); } erpnext.utils.get_contact_details = function(frm) { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 3e90b97dd3..649faaf3b9 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -25,7 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ cur_frm.add_custom_button(__('Lost'), cur_frm.cscript['Declare Order Lost'], __("Status")); } - + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } @@ -47,7 +47,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ } this.toggle_reqd_lead_customer(); - + }, quotation_to: function() { @@ -96,7 +96,11 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ var me = this; frappe.call({ method: "erpnext.crm.doctype.lead.lead.get_lead_details", - args: { "lead": this.frm.doc.lead }, + args: { + 'lead': this.frm.doc.lead, + 'posting_date': this.frm.doc.transaction_date, + 'company': this.frm.doc.company, + }, callback: function(r) { if(r.message) { me.frm.updating_party_details = true; @@ -166,6 +170,6 @@ frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, frappe.ui.form.on("Quotation Item", "stock_balance", function(frm, cdt, cdn) { var d = frappe.model.get_doc(cdt, cdn); - frappe.route_options = {"item_code": d.item_code}; + frappe.route_options = {"item_code": d.item_code}; frappe.set_route("query-report", "Stock Balance"); -}) \ No newline at end of file +}) From f945e10cce7dfe16a91320b3b3be099b42916ec5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 11 Apr 2016 11:33:14 +0530 Subject: [PATCH 06/13] Currency column in AR/AP and sales/purchase register report --- .../accounts_receivable.html | 9 ++++-- .../accounts_receivable.py | 30 +++++++++--------- .../accounts_receivable_summary.py | 27 +++++++++++----- .../item_wise_purchase_register.py | 17 +++++++--- .../item_wise_sales_register.py | 17 +++++++--- .../purchase_register/purchase_register.py | 31 +++++++++++++------ .../report/sales_register/sales_register.py | 22 ++++++++----- 7 files changed, 100 insertions(+), 53 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 69c88ed3c4..712d35b38e 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -37,9 +37,12 @@
{%= data[i][__("Voucher No")] %} {%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %} - {%= format_currency(data[i][__("Invoiced Amount")]) %} - {%= format_currency(data[i][__("Paid Amount")]) %} - {%= format_currency(data[i][__("Outstanding Amount")]) %} + + {%= format_currency(data[i][__("Invoiced Amount")], data[i]["currency"]) %} + + {%= format_currency(data[i][__("Paid Amount")], data[i]["currency"]) %} + + {%= format_currency(data[i][__("Outstanding Amount")], data[i]["currency"]) %} {% } else { %} diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 39fe5c4ba7..365212a163 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -58,21 +58,19 @@ class ReceivablePayableReport(object): "width": 120 }) + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 100 + }) if args.get("party_type") == "Customer": columns += [_("Territory") + ":Link/Territory:80"] if args.get("party_type") == "Supplier": columns += [_("Supplier Type") + ":Link/Supplier Type:80"] - columns += [ - { - "fieldname": "currency", - "label": _("Currency"), - "fieldtype": "Data", - "width": 100, - "hidden": 1 - }, - _("Remarks") + "::200" - ] - + + columns.append(_("Remarks") + "::200") + return columns def get_data(self, party_naming_by, args): @@ -120,17 +118,17 @@ class ReceivablePayableReport(object): row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2), cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount) + if self.filters.get(scrub(args.get("party_type"))): + row.append(gle.account_currency) + else: + row.append(company_currency) + # customer territory / supplier type if args.get("party_type") == "Customer": row += [self.get_territory(gle.party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(gle.party)] - if self.filters.get(scrub(args.get("party_type"))): - row.append(gle.account_currency) - else: - row.append(company_currency) - row.append(gle.remarks) data.append(row) diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 60eade4706..36e97343e6 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -18,18 +18,25 @@ class AccountsReceivableSummary(ReceivablePayableReport): columns += [ args.get("party_type") + " Name::140"] columns += [ - _("Total Invoiced Amt") + ":Currency:140", - _("Total Paid Amt") + ":Currency:140", - _("Total Outstanding Amt") + ":Currency:160", - "0-" + str(self.filters.range1) + ":Currency:100", - str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency:100", - str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency:100", - str(self.filters.range3) + _("-Above") + ":Currency:100"] + _("Total Invoiced Amt") + ":Currency/currency:140", + _("Total Paid Amt") + ":Currency/currency:140", + _("Total Outstanding Amt") + ":Currency/currency:160", + "0-" + str(self.filters.range1) + ":Currency/currency:100", + str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100", + str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100", + str(self.filters.range3) + _("-Above") + ":Currency/currency:100"] if args.get("party_type") == "Customer": columns += [_("Territory") + ":Link/Territory:80"] if args.get("party_type") == "Supplier": columns += [_("Supplier Type") + ":Link/Supplier Type:80"] + + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) return columns @@ -53,6 +60,8 @@ class AccountsReceivableSummary(ReceivablePayableReport): row += [self.get_territory(party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(party)] + + row.append(party_dict.currency) data.append(row) return data @@ -73,6 +82,8 @@ class AccountsReceivableSummary(ReceivablePayableReport): ) for k in party_total[d.party].keys(): party_total[d.party][k] += d.get(k, 0) + + party_total[d.party].currency = d.currency return party_total @@ -90,7 +101,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): cols += ["bill_no", "bill_date"] cols += ["invoiced_amt", "paid_amt", - "outstanding_amt", "age", "range1", "range2", "range3", "range4"] + "outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"] if args.get("party_type") == "Supplier": cols += ["supplier_type", "remarks"] diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 7be5649aa2..f1e706e5d6 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -16,6 +16,14 @@ def execute(filters=None): if item_list: item_tax, tax_accounts = get_tax_accounts(item_list, columns) + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + print company_currency data = [] for d in item_list: purchase_receipt = None @@ -34,7 +42,7 @@ def execute(filters=None): row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0)) total_tax = sum(row[last_col:]) - row += [total_tax, d.base_net_amount + total_tax] + row += [total_tax, d.base_net_amount + total_tax, company_currency] data.append(row) @@ -48,7 +56,8 @@ def get_columns(): "Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140", - _("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"] + _("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120" + ] def get_conditions(filters): conditions = "" @@ -110,7 +119,7 @@ def get_tax_accounts(item_list, columns): (tax_amount * d.base_net_amount) / d.base_net_total tax_accounts.sort() - columns += [account_head + ":Currency:80" for account_head in tax_accounts] - columns += ["Total Tax:Currency:80", "Total:Currency:80"] + columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts] + columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"] return item_tax, tax_accounts 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 e3c475303e..2401202937 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 @@ -14,7 +14,14 @@ def execute(filters=None): item_list = get_items(filters) if item_list: item_tax, tax_accounts = get_tax_accounts(item_list, columns) - + columns.append({ + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + }) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") + data = [] for d in item_list: delivery_note = None @@ -32,7 +39,7 @@ def execute(filters=None): row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0)) total_tax = sum(row[last_col:]) - row += [total_tax, d.base_net_amount + total_tax] + row += [total_tax, d.base_net_amount + total_tax, company_currency] data.append(row) @@ -48,7 +55,7 @@ def get_columns(): _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120", - _("Rate") + ":Currency:120", _("Amount") + ":Currency:120" + _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120" ] def get_conditions(filters): @@ -108,7 +115,7 @@ def get_tax_accounts(item_list, columns): flt((tax_amount * d.base_net_amount) / d.base_net_total) tax_accounts.sort() - columns += [account_head + ":Currency:80" for account_head in tax_accounts] - columns += ["Total Tax:Currency:80", "Total:Currency:80"] + columns += [account_head + ":Currency/currency:80" for account_head in tax_accounts] + columns += ["Total Tax:Currency/currency:80", "Total:Currency/currency:80"] return item_tax, tax_accounts diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index c8698030e7..7934bf25cd 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -21,6 +21,8 @@ def execute(filters=None): invoice_expense_map, expense_accounts) invoice_po_pr_map = get_invoice_po_pr_map(invoice_list) supplier_details = get_supplier_deatils(invoice_list) + + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") data = [] for inv in invoice_list: @@ -32,7 +34,7 @@ def execute(filters=None): row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name, supplier_details.get(inv.supplier), inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks, - ", ".join(purchase_order), ", ".join(purchase_receipt)] + ", ".join(purchase_order), ", ".join(purchase_receipt), company_currency] # map expense values base_net_total = 0 @@ -62,10 +64,19 @@ def execute(filters=None): def get_columns(invoice_list): """return columns based on filters""" columns = [ - _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier Id") + "::120", - _("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120", - _("Project") + ":Link/Project:80", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", - _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100" + _("Invoice") + ":Link/Purchase Invoice:120", + _("Posting Date") + ":Date:80", _("Supplier Id") + "::120", + _("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", + _("Payable Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", + _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", + _("Purchase Order") + ":Link/Purchase Order:100", + _("Purchase Receipt") + ":Link/Purchase Receipt:100", + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + } ] expense_accounts = tax_accounts = expense_columns = tax_columns = [] @@ -84,14 +95,14 @@ def get_columns(invoice_list): ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) - expense_columns = [(account + ":Currency:120") for account in expense_accounts] + expense_columns = [(account + ":Currency/currency:120") for account in expense_accounts] for account in tax_accounts: if account not in expense_accounts: - tax_columns.append(account + ":Currency:120") + tax_columns.append(account + ":Currency/currency:120") - columns = columns + expense_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \ - [_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120", - _("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"] + columns = columns + expense_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \ + [_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120", + _("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"] return columns, expense_accounts, tax_accounts diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index f68adad7d9..d09cfc1924 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -22,6 +22,7 @@ def execute(filters=None): invoice_so_dn_map = get_invoice_so_dn_map(invoice_list) customer_map = get_customer_deatils(invoice_list) + company_currency = frappe.db.get_value("Company", filters.company, "default_currency") data = [] for inv in invoice_list: @@ -32,7 +33,8 @@ def execute(filters=None): row = [inv.name, inv.posting_date, inv.customer, inv.customer_name, customer_map.get(inv.customer, {}).get("customer_group"), customer_map.get(inv.customer, {}).get("territory"), - inv.debit_to, inv.project, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)] + inv.debit_to, inv.project, inv.remarks, + ", ".join(sales_order), ", ".join(delivery_note), company_currency] # map income values base_net_total = 0 @@ -66,7 +68,13 @@ def get_columns(invoice_list): _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120", _("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80", _("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150", - _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100" + _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", + { + "fieldname": "currency", + "label": _("Currency"), + "fieldtype": "Data", + "width": 80 + } ] income_accounts = tax_accounts = income_columns = tax_columns = [] @@ -83,14 +91,14 @@ def get_columns(invoice_list): and parent in (%s) order by account_head""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list])) - income_columns = [(account + ":Currency:120") for account in income_accounts] + income_columns = [(account + ":Currency/currency:120") for account in income_accounts] for account in tax_accounts: if account not in income_accounts: - tax_columns.append(account + ":Currency:120") + tax_columns.append(account + ":Currency/currency:120") - columns = columns + income_columns + [_("Net Total") + ":Currency:120"] + tax_columns + \ - [_("Total Tax") + ":Currency:120", _("Grand Total") + ":Currency:120", - _("Rounded Total") + ":Currency:120", _("Outstanding Amount") + ":Currency:120"] + columns = columns + income_columns + [_("Net Total") + ":Currency/currency:120"] + tax_columns + \ + [_("Total Tax") + ":Currency/currency:120", _("Grand Total") + ":Currency/currency:120", + _("Rounded Total") + ":Currency/currency:120", _("Outstanding Amount") + ":Currency/currency:120"] return columns, income_accounts, tax_accounts From 32b2a7795eeec59021b05dd81d5c25c312850371 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 11 Apr 2016 15:13:40 +0530 Subject: [PATCH 07/13] [fix] Set actual qty onload of the draft stock entry. Fixed #5172 --- erpnext/stock/doctype/stock_entry/stock_entry.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 0c0b582856..2fe3bb70e3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -27,9 +27,8 @@ class StockEntry(StockController): return _("From {0} to {1}").format(self.from_warehouse, self.to_warehouse) def onload(self): - if self.docstatus==1: - for item in self.get("items"): - item.update(get_bin_details(item.item_code, item.s_warehouse)) + for item in self.get("items"): + item.update(get_bin_details(item.item_code, item.s_warehouse)) def validate(self): self.pro_doc = None From b2e7a1f60520366481fa94d476b3ea0e3b349529 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 11 Apr 2016 12:10:20 +0530 Subject: [PATCH 08/13] [Fix] Default letter head --- .../doctype/purchase_common/purchase_common.js | 16 ++++------------ erpnext/public/js/controllers/transaction.js | 10 +++++++++- erpnext/public/js/utils/party.js | 10 +++++++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 9a9a865233..c67a30fb69 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -171,18 +171,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ erpnext.buying.get_items_from_product_bundle(me.frm); }, __("Get items from")); }, - - company: function() { - var me = this; - if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") - && !this.frm.doc.shipping_address) { - erpnext.utils.get_shipping_address(this.frm) - } - }, - + shipping_address: function(){ var me = this; - + this.frm.set_query("shipping_address", function(){ if(me.frm.doc.customer){ return{ @@ -200,8 +192,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } } }); - - erpnext.utils.get_address_display(this.frm, "shipping_address", + + erpnext.utils.get_address_display(this.frm, "shipping_address", "shipping_address_display", is_your_company_address=true) } }); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 6de5154817..a1b38467b0 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -308,7 +308,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; else var date = this.frm.doc.transaction_date; - set_party_account(set_pricing); + + if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") && + in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)){ + erpnext.utils.get_shipping_address(this.frm, function(){ + set_party_account(set_pricing); + }) + }else{ + set_party_account(set_pricing); + } if(this.frm.doc.company) { erpnext.last_selected_company = this.frm.doc.company; diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 1896f88884..a31d841c2b 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -69,7 +69,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field, if(r.message) { frm.set_value(display_field, r.message) } - + if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) { if(!erpnext.utils.validate_mandatory(frm, "Customer/Supplier", frm.doc.customer || frm.doc.supplier, address_field)) return; @@ -99,7 +99,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field, } else { frm.set_value(display_field, null); } - + } erpnext.utils.get_contact_details = function(frm) { @@ -127,7 +127,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) { return true; } -erpnext.utils.get_shipping_address = function(frm){ +erpnext.utils.get_shipping_address = function(frm, callback){ frappe.call({ method: "erpnext.utilities.doctype.address.address.get_shipping_address", args: {company: frm.doc.company}, @@ -136,6 +136,10 @@ erpnext.utils.get_shipping_address = function(frm){ frm.set_value("shipping_address", r.message[0]) //Address title or name frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page } + + if(callback){ + return callback(); + } } }); } From f509d13d2828af9f51023765a0ffc4abce140856 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Apr 2016 17:01:39 +0530 Subject: [PATCH 09/13] [fix] Get average selling rate based on group by --- erpnext/accounts/report/gross_profit/gross_profit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index ba87cf1c14..4ae0e6794d 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -145,11 +145,11 @@ class GrossProfitGenerator(object): self.data.append(row) if self.grouped: - self.collapse_group() + self.get_average_rate_based_on_group_by() else: self.grouped_data = [] - def collapse_group(self): + def get_average_rate_based_on_group_by(self): # sum buying / selling totals for group self.grouped_data = [] for key in self.grouped.keys(): @@ -166,6 +166,8 @@ class GrossProfitGenerator(object): if new_row.base_amount else 0 new_row.buying_rate = (new_row.buying_amount / new_row.qty) \ if new_row.qty else 0 + new_row.base_rate = (new_row.base_amount / new_row.qty) \ + if new_row.qty else 0 self.grouped_data.append(new_row) From 8a686ba9821f7aa7c08ac84eb2f9bd0aa4a8c510 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Apr 2016 17:02:15 +0530 Subject: [PATCH 10/13] [fix] Prevent from directly creating payment request --- .../accounts/doctype/payment_request/payment_request.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json index e916034d29..74a18fcf59 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.json +++ b/erpnext/accounts/doctype/payment_request/payment_request.json @@ -598,13 +598,13 @@ "hide_heading": 0, "hide_toolbar": 0, "idx": 0, - "in_create": 0, + "in_create": 1, "in_dialog": 0, "is_submittable": 1, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-02-24 16:49:46.832403", + "modified": "2016-04-12 15:26:22.756129", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Request", @@ -675,5 +675,6 @@ "read_only": 0, "read_only_onload": 0, "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "track_seen": 0 } \ No newline at end of file From 9fef3df6a057aa656c6e9e96473221efc3576699 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 12 Apr 2016 18:46:47 +0530 Subject: [PATCH 11/13] [fix] Fixed pending so items for material request report --- .../pending_so_items_for_purchase_request.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json index 6b19b6394b..a0a7505827 100644 --- a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json +++ b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json @@ -7,12 +7,12 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2015-10-06 12:43:48.259027", + "modified": "2016-04-12 18:45:49.733159", "modified_by": "Administrator", "module": "Selling", "name": "Pending SO Items For Purchase Request", "owner": "Administrator", - "query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc", + "query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Closed\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc", "ref_doctype": "Sales Order", "report_name": "Pending SO Items For Purchase Request", "report_type": "Query Report" From 7132bd36594ea03b02a531947715a384f2a95eee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 13 Apr 2016 15:19:37 +0530 Subject: [PATCH 12/13] [fix] Ignore closed sales order in credit limit validation --- erpnext/public/js/controllers/transaction.js | 2 +- erpnext/selling/doctype/customer/customer.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index a1b38467b0..acc70df8e6 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -118,7 +118,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ setup_sms: function() { var me = this; - if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped"], this.frm.doc.status) + if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status) && this.frm.doctype != "Purchase Invoice") { this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); }); } diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 8a7da63853..df91d63a18 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -199,7 +199,7 @@ def get_customer_outstanding(customer, company): select sum(base_grand_total*(100 - per_billed)/100) from `tabSales Order` where customer=%s and docstatus = 1 and company=%s - and per_billed < 100 and status != 'Stopped'""", (customer, company)) + and per_billed < 100 and status != 'Closed'""", (customer, company)) outstanding_based_on_so = flt(outstanding_based_on_so[0][0]) if outstanding_based_on_so else 0.0 @@ -210,7 +210,7 @@ def get_customer_outstanding(customer, company): where dn.name = dn_item.parent and dn.customer=%s and dn.company=%s - and dn.docstatus = 1 and dn.status != 'Stopped' + and dn.docstatus = 1 and dn.status not in ('Closed', 'Stopped') and ifnull(dn_item.against_sales_order, '') = '' and ifnull(dn_item.against_sales_invoice, '') = ''""", (customer, company), as_dict=True) From ba7d8b0cac7f2be34c2be2c38776d2f4bf359b2f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 13 Apr 2016 16:34:37 +0600 Subject: [PATCH 13/13] bumped to version 6.27.8 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 38183fb21c..ec6775d8c9 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.27.7' +__version__ = '6.27.8' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index cf418f6cd4..94751a1590 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = """ERP made simple""" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.27.7" +app_version = "6.27.8" app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" diff --git a/setup.py b/setup.py index ac55dcead6..eb7c1ef51a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages from pip.req import parse_requirements -version = "6.27.7" +version = "6.27.8" requirements = parse_requirements("requirements.txt", session="") setup(