From 74458a93bb46ca2b94d7e16bbfc6fdadee101dcd Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 12:10:09 +0530 Subject: [PATCH 01/14] [minor] [issue] webnotes/erpnext#405 - removed chat link for self-hosted instances --- public/js/toolbar.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/js/toolbar.js b/public/js/toolbar.js index c50f1ed14b..f54996942b 100644 --- a/public/js/toolbar.js +++ b/public/js/toolbar.js @@ -24,11 +24,14 @@ erpnext.toolbar.setup = function() { +wn._("My Settings")+'...'); $user.append('
  • '); $user.append('
  • \ - '+wn._('Documentation')+'
  • ') + '+wn._('Documentation')+''); $user.append('
  • \ - '+wn._('Forum')+'
  • ') - $user.append('
  • \ - '+wn._('Live Chat')+'
  • ') + '+wn._('Forum')+''); + + if(wn.boot.expires_on) { + $user.append('
  • \ + '+wn._('Live Chat')+'
  • '); + } erpnext.toolbar.set_new_comments(); From 97fd52278887503b688928fe33aed961f13f4963 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 12:25:23 +0530 Subject: [PATCH 02/14] [fix] material request - no_copy=0 for schedule_date so that it could be mapped to purchase order --- stock/doctype/material_request_item/material_request_item.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock/doctype/material_request_item/material_request_item.txt b/stock/doctype/material_request_item/material_request_item.txt index 86cc168613..0fb994d53c 100644 --- a/stock/doctype/material_request_item/material_request_item.txt +++ b/stock/doctype/material_request_item/material_request_item.txt @@ -2,7 +2,7 @@ { "creation": "2013-02-22 01:28:02", "docstatus": 0, - "modified": "2013-07-10 14:54:10", + "modified": "2013-08-01 12:23:40", "modified_by": "Administrator", "owner": "Administrator" }, @@ -47,7 +47,7 @@ "fieldtype": "Date", "in_list_view": 1, "label": "Required Date", - "no_copy": 1, + "no_copy": 0, "oldfieldname": "schedule_date", "oldfieldtype": "Date", "print_hide": 0, From 482f34302e26f2e6e012e2890cb27e292a8239e8 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 12:28:21 +0530 Subject: [PATCH 03/14] [minor] purchase order - no_copy=0 for purchase other charges, so that the field could be mapped --- buying/doctype/purchase_order/purchase_order.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt index a79d98e2b9..95386bc8c3 100644 --- a/buying/doctype/purchase_order/purchase_order.txt +++ b/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-07-23 15:26:28", + "modified": "2013-08-01 12:27:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -313,7 +313,7 @@ "fieldname": "purchase_other_charges", "fieldtype": "Link", "label": "Purchase Taxes and Charges", - "no_copy": 1, + "no_copy": 0, "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Master", From 49154c790e8bc48afcd26065063d1b4149c4090e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 15:43:28 +0530 Subject: [PATCH 04/14] [fix] if no valid territory for price list, try adding the user's default territory --- setup/doctype/price_list/price_list.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup/doctype/price_list/price_list.py b/setup/doctype/price_list/price_list.py index a5f22d9da0..051f54a323 100644 --- a/setup/doctype/price_list/price_list.py +++ b/setup/doctype/price_list/price_list.py @@ -19,6 +19,7 @@ import webnotes from webnotes import msgprint, _ from webnotes.utils import comma_or, cint from webnotes.model.controller import DocListController +import webnotes.defaults class DocType(DocListController): def onload(self): @@ -30,8 +31,17 @@ class DocType(DocListController): msgprint(_(self.meta.get_label("buying_or_selling")) + " " + _("must be one of") + " " + comma_or(["Buying", "Selling"]), raise_exception=True) - # at least one territory - self.validate_table_has_rows("valid_for_territories") + if not self.doclist.get({"parentfield": "valid_for_territories"}): + # if no territory, set default territory + if webnotes.defaults.get_user_default("territory"): + self.doclist.append({ + "doctype": "For Territory", + "parentfield": "valid_for_territories", + "territory": webnotes.defaults.get_user_default("territory") + }) + else: + # at least one territory + self.validate_table_has_rows("valid_for_territories") def on_update(self): cart_settings = webnotes.get_obj("Shopping Cart Settings") From 17350b899f4b8501034ffeacf1da8bd9a0c44c25 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 15:45:23 +0530 Subject: [PATCH 05/14] [fix] [mapper] from delivery note to sales invoice, only map unbilled items --- .../doctype/sales_invoice/sales_invoice.js | 16 +++++++---- .../doctype/sales_invoice/sales_invoice.py | 10 ++++--- controllers/accounts_controller.py | 1 - controllers/queries.py | 20 ++++++++++++-- public/js/transaction.js | 6 +++-- stock/doctype/delivery_note/delivery_note.py | 27 +++++++++++++++++++ 6 files changed, 66 insertions(+), 14 deletions(-) diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 345dbc9403..d8d06dd957 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -93,12 +93,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte wn.model.map_current_doc({ method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice", source_doctype: "Delivery Note", - get_query_filters: { - docstatus: 1, - customer: cur_frm.doc.customer || undefined, - company: cur_frm.doc.company + get_query: function() { + var filters = { + docstatus: 1, + company: cur_frm.doc.company + }; + if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer; + return { + query: "controllers.queries.get_delivery_notes_to_be_billed", + filters: filters + }; } - }) + }); }); // cur_frm.add_custom_button(wn._("POS View"), function() { diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index ca93786054..09df5f6512 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -1001,10 +1001,12 @@ def make_delivery_note(source_name, target_doclist=None): bean = webnotes.bean(target) bean.run_method("onload_post_render") - def update_item(obj, target, source_parent): - target.amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate) - target.export_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate) - target.qty = flt(obj.qty) - flt(obj.delivered_qty) + def update_item(source_doc, target_doc, source_parent): + target_doc.amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \ + flt(source_doc.basic_rate) + target_doc.export_amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \ + flt(source_doc.export_rate) + target_doc.qty = flt(source_doc.qty) - flt(source_doc.delivered_qty) doclist = get_mapped_doclist("Sales Invoice", source_name, { "Sales Invoice": { diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 725fdb3279..3d72e6ff1b 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -394,7 +394,6 @@ class AccountsController(TransactionBase): total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), self.precision(based_on, item)) - webnotes.errprint([max_allowed_amt, total_billed_amt]) if max_allowed_amt and total_billed_amt - max_allowed_amt > 0.02: webnotes.msgprint(_("Row ")+ cstr(item.idx) + ": " + cstr(item.item_code) + diff --git a/controllers/queries.py b/controllers/queries.py index caa2f6f065..462c22d914 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -23,7 +23,7 @@ def get_filters_cond(doctype, filters, conditions): filters = filters.items() flt = [] for f in filters: - if f[1][0] == '!': + if isinstance(f[1], basestring) and f[1][0] == '!': flt.append([doctype, f[0], '!=', f[1][1:]]) else: flt.append([doctype, f[0], '=', f[1]]) @@ -204,4 +204,20 @@ def get_price_list_currency(doctype, txt, searchfield, start, page_len, filters) and `%s` like %s order by ref_currency asc limit %s, %s""" % ("%s", "%s", searchfield, "%s", "%s", "%s"), (filters["price_list_name"], filters['buying_or_selling'], "%%%s%%" % txt, - start, page_len)) \ No newline at end of file + start, page_len)) + +def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters): + return webnotes.conn.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name + from `tabDelivery Note` + where `tabDelivery Note`.`%(key)s` like %(txt)s %(fcond)s and + (ifnull((select sum(qty) from `tabDelivery Note Item` where + `tabDelivery Note Item`.parent=`tabDelivery Note`.name), 0) > + ifnull((select sum(qty) from `tabSales Invoice Item` where + `tabSales Invoice Item`.delivery_note=`tabDelivery Note`.name), 0)) + %(mcond)s order by `tabDelivery Note`.`%(key)s` asc + limit %(start)s, %(page_len)s""" % { + "key": searchfield, + "fcond": get_filters_cond(doctype, filters, []), + "mcond": get_match_cond(doctype), + "start": "%(start)s", "page_len": "%(page_len)s", "txt": "%(txt)s" + }, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) }, debug=True) \ No newline at end of file diff --git a/public/js/transaction.js b/public/js/transaction.js index 2cee8437a9..4a647adc1c 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -75,8 +75,10 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ company: function() { if(this.frm.doc.company && this.frm.fields_dict.currency) { - var company_currency = this.get_company_currency(); - this.frm.set_value("currency", company_currency); + if(!this.frm.doc.currency) { + this.frm.set_value("currency", this.get_company_currency()); + } + this.frm.script_manager.trigger("currency"); } }, diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py index 81c4b6cedb..25a70b6c66 100644 --- a/stock/doctype/delivery_note/delivery_note.py +++ b/stock/doctype/delivery_note/delivery_note.py @@ -369,11 +369,37 @@ class DocType(SellingController): from accounts.general_ledger import make_gl_entries make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2)) +def get_invoiced_qty_map(delivery_note): + """returns a map: {dn_detail: invoiced_qty}""" + invoiced_qty_map = {} + + for dn_detail, qty in webnotes.conn.sql("""select dn_detail, qty from `tabSales Invoice Item` + where delivery_note=%s and docstatus=1""", delivery_note): + if not invoiced_qty_map.get(dn_detail): + invoiced_qty_map[dn_detail] = 0 + invoiced_qty_map[dn_detail] += qty + + return invoiced_qty_map + @webnotes.whitelist() def make_sales_invoice(source_name, target_doclist=None): + invoiced_qty_map = get_invoiced_qty_map(source_name) + def update_accounts(source, target): si = webnotes.bean(target) si.run_method("onload_post_render") + + si.set_doclist(si.doclist.get({"parentfield": ["!=", "entries"]}) + + si.doclist.get({"parentfield": "entries", "qty": [">", 0]})) + + if len(si.doclist.get({"parentfield": "entries"})) == 0: + webnotes.msgprint(_("Hey! All these items have already been invoiced."), + raise_exception=True) + + return si.doclist + + def update_item(source_doc, target_doc, source_parent): + target_doc.qty = source_doc.qty - invoiced_qty_map.get(source_doc.name, 0) doclist = get_mapped_doclist("Delivery Note", source_name, { "Delivery Note": { @@ -391,6 +417,7 @@ def make_sales_invoice(source_name, target_doclist=None): "prevdoc_docname": "sales_order", "serial_no": "serial_no" }, + "postprocess": update_item }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges", From 078129f58fb975fc39bb35cd7bfd8de90669c654 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 16:54:28 +0530 Subject: [PATCH 06/14] [fix] [minor] removed default from conversion_rate --- accounts/doctype/pos_setting/pos_setting.txt | 3 +-- accounts/doctype/purchase_invoice/purchase_invoice.txt | 3 +-- buying/doctype/purchase_order/purchase_order.txt | 3 +-- buying/doctype/supplier_quotation/supplier_quotation.txt | 3 +-- controllers/accounts_controller.py | 8 +++++++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt index d82749011a..9f5b246ff3 100755 --- a/accounts/doctype/pos_setting/pos_setting.txt +++ b/accounts/doctype/pos_setting/pos_setting.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 12:15:51", "docstatus": 0, - "modified": "2013-07-26 11:16:53", + "modified": "2013-08-01 16:50:05", "modified_by": "Administrator", "owner": "Administrator" }, @@ -81,7 +81,6 @@ "reqd": 1 }, { - "default": "1", "doctype": "DocField", "fieldname": "conversion_rate", "fieldtype": "Float", diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt index 6ed049e86f..47958cf9fb 100755 --- a/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-07-25 16:08:44", + "modified": "2013-08-01 16:49:49", "modified_by": "Administrator", "owner": "Administrator" }, @@ -223,7 +223,6 @@ "read_only": 0 }, { - "default": "1", "description": "The rate at which Bill Currency is converted into company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt index 95386bc8c3..8f69a349fe 100644 --- a/buying/doctype/purchase_order/purchase_order.txt +++ b/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-08-01 12:27:13", + "modified": "2013-08-01 16:49:16", "modified_by": "Administrator", "owner": "Administrator" }, @@ -191,7 +191,6 @@ "reqd": 1 }, { - "default": "1", "description": "Rate at which supplier's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/buying/doctype/supplier_quotation/supplier_quotation.txt b/buying/doctype/supplier_quotation/supplier_quotation.txt index e18e0111c7..8ac5060b48 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.txt +++ b/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:45", "docstatus": 0, - "modified": "2013-07-23 15:27:23", + "modified": "2013-08-01 16:49:33", "modified_by": "Administrator", "owner": "Administrator" }, @@ -186,7 +186,6 @@ "reqd": 1 }, { - "default": "1", "description": "Rate at which supplier's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 3d72e6ff1b..e3e5d5eaf3 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -67,6 +67,7 @@ class AccountsController(TransactionBase): self.doc.doctype + _(" can not be made."), raise_exception=1) def set_price_list_currency(self, buying_or_selling): + company_currency = get_company_currency(self.doc.company) # TODO - change this, since price list now has only one currency allowed if self.meta.get_field("price_list_name") and self.doc.price_list_name and \ not self.doc.price_list_currency: @@ -74,7 +75,6 @@ class AccountsController(TransactionBase): if self.doc.price_list_currency: if not self.doc.plc_conversion_rate: - company_currency = get_company_currency(self.doc.company) if self.doc.price_list_currency == company_currency: self.doc.plc_conversion_rate = 1.0 else: @@ -86,6 +86,12 @@ class AccountsController(TransactionBase): self.doc.currency = self.doc.price_list_currency self.doc.conversion_rate = self.doc.plc_conversion_rate + if self.meta.get_field("currency") and self.doc.currency != company_currency and \ + not self.doc.conversion_rate: + exchange = self.doc.currency + "-" + company_currency + self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange", + exchange, "exchange_rate")) + def set_missing_item_details(self, get_item_details): """set missing item values""" for item in self.doclist.get({"parentfield": self.fname}): From 5edd570b493b1aca8a62071abdb36ae7142dfa01 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 17:21:53 +0530 Subject: [PATCH 07/14] [fix] [minor] features setup - hide company currency fields if export is disabled --- public/js/feature_setup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/feature_setup.js b/public/js/feature_setup.js index add4bfda9a..4ce50f0a8b 100644 --- a/public/js/feature_setup.js +++ b/public/js/feature_setup.js @@ -127,12 +127,12 @@ pscript.feature_dict = { 'Sales Order': {'sales_order_details':['page_break']} }, 'fs_exports': { - 'Delivery Note': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','amount','basic_rate']}, + 'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['base_ref_rate','amount','basic_rate']}, 'POS Setting': {'fields':['conversion_rate','currency']}, - 'Quotation': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','amount','basic_rate']}, - 'Sales Invoice': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','amount','basic_rate']}, + 'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'quotation_details':['base_ref_rate','amount','basic_rate']}, + 'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'entries':['base_ref_rate','amount','basic_rate']}, 'Sales BOM': {'fields':['currency']}, - 'Sales Order': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','amount','basic_rate']} + 'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_ref_rate','amount','basic_rate']} }, 'fs_imports': { From c4a54fe24e40de1f6ada6644471718a7c9cd3f9e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 18:19:51 +0530 Subject: [PATCH 08/14] [usability] [issue] webnotes/erpnext#346 - hide packing list if it is empty --- selling/doctype/sales_common/sales_common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 0f19fa2f02..e59a7474f9 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -121,10 +121,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }, - refresh: function(doc) { + refresh: function() { + this._super(); this.frm.toggle_display("customer_name", (this.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer)); - this._super(); + if(this.frm.fields_dict.packing_details) { + var packing_list_exists = this.frm.get_doclist({parentfield: "packing_details"}).length; + this.frm.toggle_display("packing_list", packing_list_exists ? true : false); + } }, customer: function() { From 5cd58dc38737fdadc642c6f7f0ff0d1ae2a0286f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 18:58:35 +0530 Subject: [PATCH 09/14] [usability] [issue] webnotes/erpnext#606 - disable default currency after a transaction is created for a company --- setup/doctype/company/company.js | 4 ++++ setup/doctype/company/company.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index dfe8e2ae87..4859464309 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -17,6 +17,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.abbr && !doc.__islocal) cur_frm.set_df_property("abbr", "read_only", 1) + + if(!doc.__islocal) { + cur_frm.toggle_enable("default_currency", !cur_frm.doc.__transactions_exist); + } } cur_frm.cscript.has_special_chars = function(t) { diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 8a10587a1a..ee432c00e4 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -29,10 +29,30 @@ class DocType: def __init__(self,d,dl): self.doc, self.doclist = d,dl + def onload(self): + self.doc.fields["__transactions_exist"] = self.check_if_transactions_exist() + + def check_if_transactions_exist(self): + exists = False + for doctype in ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation", + "Purchase Invoice", "Purchase Receipt", "Purchase Order", "Supplier Quotation"]: + if webnotes.conn.sql("""select name from `tab%s` where company=%s and docstatus=1 + limit 1""" % (doctype, "%s"), self.doc.name): + exists = True + break + + return exists + def validate(self): if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5: webnotes.msgprint("Abbreviation cannot have more than 5 characters", raise_exception=1) + + self.previous_default_currency = webnotes.conn.get_value("Company", self.doc.name, "default_currency") + if self.doc.default_currency and self.previous_default_currency and \ + self.doc.default_currency != self.previous_default_currency and \ + self.check_if_transactions_exist(): + msgprint(_("Sorry! You cannot change company's default currency, because there are existing transactions against it. You will need to cancel those transactions if you want to change the default currency."), raise_exception=True) def on_update(self): if not webnotes.conn.sql("""select name from tabAccount From 7baa7fd12904432bd9c5ee3c462834d24643109a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 19:10:34 +0530 Subject: [PATCH 10/14] [fix] [minor] [issue] webnotes/erpnext#658 - adjust expiry warning banner --- public/js/startup.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/startup.css b/public/js/startup.css index 835e2bd8b6..d15b7a4791 100644 --- a/public/js/startup.css +++ b/public/js/startup.css @@ -20,8 +20,8 @@ span, div, td, input, textarea, button, select { } .expiry-info { - margin-top: 40px; - margin-bottom: -40px; + margin-top: -20px; + margin-bottom: 20px; text-align: center; background-color: rgb(255, 255, 204); padding: 7px; From 8762cdaf53459c27353438b7f04b2b4982524597 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 1 Aug 2013 19:55:29 +0530 Subject: [PATCH 11/14] [fix] [minor] [issue] webnotes/erpnext#661 - remove script and style tags from communication content --- support/doctype/support_ticket/support_ticket.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js index 34cc5ef497..4b39631b60 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -39,9 +39,6 @@ $.extend(cur_frm.cscript, { cur_frm.footer.help_area.innerHTML = '

    Email Settings
    \ Integrate incoming support emails to Support Ticket

    '; } - - if(doc.description) - doc.description = wn.utils.escape_script_and_style(doc.description); }, refresh: function(doc) { From dbe4d1930b9b66df70a94418c051b05b3d12b64e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 2 Aug 2013 11:20:02 +0530 Subject: [PATCH 12/14] [minor] added customer/supplier id and name in sales/purchase register --- accounts/report/purchase_register/purchase_register.py | 9 +++++---- accounts/report/sales_register/sales_register.py | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py index 0a4711ffb8..91525fbc4e 100644 --- a/accounts/report/purchase_register/purchase_register.py +++ b/accounts/report/purchase_register/purchase_register.py @@ -43,7 +43,7 @@ def execute(filters=None): purchase_receipt = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", []))) project_name = list(set(invoice_po_pr_map.get(inv.name, {}).get("project_name", []))) - row = [inv.name, inv.posting_date, inv.supplier_name, inv.credit_to, + row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name, inv.credit_to, account_map.get(inv.credit_to), ", ".join(project_name), inv.bill_no, inv.bill_date, inv.remarks, ", ".join(purchase_order), ", ".join(purchase_receipt)] @@ -76,9 +76,10 @@ 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::120", - "Supplier Account:Link/Account:120", "Account Group:LInk/Account:120", - "Project:Link/Project:80", "Bill No::120", "Bill Date:Date:80", "Remarks::150", + "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier Id::120", + "Supplier Name::120", "Supplier Account:Link/Account:120", + "Account Group: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" ] expense_accounts = tax_accounts = expense_columns = tax_columns = [] diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index 87c58164bc..0c96684aa3 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -43,7 +43,7 @@ def execute(filters=None): sales_order = list(set(invoice_so_dn_map.get(inv.name, {}).get("sales_order", []))) delivery_note = list(set(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", []))) - row = [inv.name, inv.posting_date, inv.customer_name, inv.debit_to, + row = [inv.name, inv.posting_date, inv.customer, inv.customer_name, inv.debit_to, account_map.get(inv.debit_to), customer_map.get(inv.customer), inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)] @@ -76,10 +76,10 @@ def execute(filters=None): def get_columns(invoice_list): """return columns based on filters""" columns = [ - "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer::120", - "Customer Account:Link/Account:120", "Account Group:LInk/Account:120", - "Territory:Link/Territory:80", "Project:Link/Project:80", - "Remarks::150", "Sales Order:Link/Sales Order:100", "Delivery Note:Link/Delivery Note:100" + "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer Id::120", + "Customer Name::120", "Customer Account:Link/Account:120", "Account Group:LInk/Account:120", + "Territory:Link/Territory:80", "Project:Link/Project:80", "Remarks::150", + "Sales Order:Link/Sales Order:100", "Delivery Note:Link/Delivery Note:100" ] income_accounts = tax_accounts = income_columns = tax_columns = [] From 33fe86777c6de18e2f98bbb73962a2ec3772357c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 2 Aug 2013 12:39:10 +0530 Subject: [PATCH 13/14] [usability] Allow user to edit Price List if this option is checked in Selling Settings [issue] webnotes/erpnext#707 --- selling/doctype/sales_common/sales_common.js | 10 ++++++++++ selling/doctype/selling_settings/selling_settings.py | 5 +++-- selling/doctype/selling_settings/selling_settings.txt | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index e59a7474f9..b3ae0fe17a 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -29,6 +29,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this._super(); this.toggle_rounded_total(); this.setup_queries(); + this.toggle_editable_price_list_rate(); }, setup_queries: function() { @@ -317,6 +318,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }, + toggle_editable_price_list_rate: function() { + var df = wn.meta.get_docfield(this.tname, "ref_rate", this.frm.doc.name); + var editable_price_list_rate = cint(wn.defaults.get_default("editable_price_list_rate")); + + if(df && editable_price_list_rate) { + df.read_only = 0; + } + }, + calculate_taxes_and_totals: function() { this._super(); this.calculate_total_advance("Sales Invoice", "advance_adjustment_details"); diff --git a/selling/doctype/selling_settings/selling_settings.py b/selling/doctype/selling_settings/selling_settings.py index febf3754ef..b25e987c3f 100644 --- a/selling/doctype/selling_settings/selling_settings.py +++ b/selling/doctype/selling_settings/selling_settings.py @@ -8,5 +8,6 @@ class DocType: self.doc, self.doclist = d, dl def validate(self): - for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate"]: - webnotes.conn.set_default(key, self.doc.fields.get(key, "")) + for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate", + "editable_price_list_rate"]: + webnotes.conn.set_default(key, self.doc.fields.get(key, "")) diff --git a/selling/doctype/selling_settings/selling_settings.txt b/selling/doctype/selling_settings/selling_settings.txt index 934cd41d27..97a339a486 100644 --- a/selling/doctype/selling_settings/selling_settings.txt +++ b/selling/doctype/selling_settings/selling_settings.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-25 10:25:16", "docstatus": 0, - "modified": "2013-07-18 12:03:39", + "modified": "2013-08-02 12:09:20", "modified_by": "Administrator", "owner": "Administrator" }, @@ -94,6 +94,12 @@ "fieldtype": "Check", "label": "Maintain Same Rate Throughout Sales Cycle" }, + { + "doctype": "DocField", + "fieldname": "editable_price_list_rate", + "fieldtype": "Check", + "label": "Allow user to edit Price List Rate in transactions" + }, { "doctype": "DocPerm" } From e5c69133a84f07a0568be5b6ea84bdb0fba110bc Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 2 Aug 2013 12:45:00 +0530 Subject: [PATCH 14/14] [minor] moved delivered items to be billed to accounts module --- .../delivered_items_to_be_billed.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt index 05983b072d..a42bcbd74f 100644 --- a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt +++ b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt @@ -2,7 +2,7 @@ { "creation": "2013-07-30 17:28:49", "docstatus": 0, - "modified": "2013-07-30 18:41:28", + "modified": "2013-08-02 18:41:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -10,7 +10,7 @@ "doctype": "Report", "is_standard": "Yes", "name": "__common__", - "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`amount` - ifnull((select sum(amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.status != \"Stopped\" and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc", + "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`amount` - ifnull((select sum(amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc", "ref_doctype": "Sales Invoice", "report_name": "Delivered Items To Be Billed", "report_type": "Query Report"