From 18a0120fc184df3dd1ce87e49a3526f4bb322809 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 29 May 2019 14:20:24 +0530 Subject: [PATCH 01/19] fix: Customer and Lead dashboard fixes for opportunity and quotation --- erpnext/crm/doctype/lead/lead.js | 26 ++++++++++++++++++++ erpnext/selling/doctype/customer/customer.js | 25 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 8df7dab6f7d..de87100eb51 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -40,6 +40,32 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ if (!this.frm.doc.__islocal) { frappe.contacts.render_address_and_contact(cur_frm); + + let make_quotation = this.frm.dashboard.transactions_area.find('.btn-new[data-doctype="Quotation"]').unbind('click'); + let make_opportunity = this.frm.dashboard.transactions_area.find('.btn-new[data-doctype="Opportunity"]').unbind('click'); + + make_quotation.on('click', function() { + let doctype = $(this).attr('data-doctype'); + + frappe.model.with_doctype(doctype, function() { + var new_doc = frappe.model.get_new_doc(doctype); + new_doc['quotation_to'] = doc.doctype; + new_doc['party_name'] = doc.name; + frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + }); + }); + + make_opportunity.on('click', function() { + let doctype = $(this).attr('data-doctype'); + + frappe.model.with_doctype(doctype, function() { + var new_doc = frappe.model.get_new_doc(doctype); + new_doc['opportunity_from'] = doc.doctype; + new_doc['party_name'] = doc.name; + frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + }); + }); + } else { frappe.contacts.clear_address_and_contact(cur_frm); } diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 8d590a0c9d0..61a4fd487e5 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -113,6 +113,31 @@ frappe.ui.form.on("Customer", { // indicator erpnext.utils.set_party_dashboard_indicators(frm); + let make_quotation = frm.dashboard.transactions_area.find('.btn-new[data-doctype="Quotation"]').unbind('click'); + let make_opportunity = frm.dashboard.transactions_area.find('.btn-new[data-doctype="Opportunity"]').unbind('click'); + + make_quotation.on('click', function() { + let doctype = $(this).attr('data-doctype'); + + frappe.model.with_doctype(doctype, function() { + var new_doc = frappe.model.get_new_doc(doctype); + new_doc['quotation_to'] = frm.doc.doctype; + new_doc['party_name'] = frm.doc.name; + frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + }); + }); + + make_opportunity.on('click', function() { + let doctype = $(this).attr('data-doctype'); + + frappe.model.with_doctype(doctype, function() { + var new_doc = frappe.model.get_new_doc(doctype); + new_doc['opportunity_from'] = frm.doc.doctype; + new_doc['party_name'] = frm.doc.name; + frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + }); + }); + } else { frappe.contacts.clear_address_and_contact(frm); } From 95dc4e4dc5be9894c149b45fabad820a0d43bca2 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 15:28:15 +0530 Subject: [PATCH 02/19] fix: Use make methods to override --- erpnext/crm/doctype/lead/lead.js | 38 +++++++------------- erpnext/public/js/utils.js | 10 ++++++ erpnext/selling/doctype/customer/customer.js | 37 +++++++------------ 3 files changed, 34 insertions(+), 51 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index de87100eb51..f5ee366d2f4 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -6,6 +6,18 @@ cur_frm.email_field = "email_id"; erpnext.LeadController = frappe.ui.form.Controller.extend({ setup: function () { + + this.frm.make_methods = { + 'Quotation': () => erpnext.utils.create_new_doc('Quotation', { + 'quotation_to': this.frm.doc.doctype, + 'party_name': this.frm.doc.name + }), + 'Opportunity': () => erpnext.utils.create_new_doc('Opportunity', { + 'opportunity_from': this.frm.doc.doctype, + 'party_name': this.frm.doc.name + }) + } + this.frm.fields_dict.customer.get_query = function (doc, cdt, cdn) { return { query: "erpnext.controllers.queries.customer_query" } } @@ -40,32 +52,6 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ if (!this.frm.doc.__islocal) { frappe.contacts.render_address_and_contact(cur_frm); - - let make_quotation = this.frm.dashboard.transactions_area.find('.btn-new[data-doctype="Quotation"]').unbind('click'); - let make_opportunity = this.frm.dashboard.transactions_area.find('.btn-new[data-doctype="Opportunity"]').unbind('click'); - - make_quotation.on('click', function() { - let doctype = $(this).attr('data-doctype'); - - frappe.model.with_doctype(doctype, function() { - var new_doc = frappe.model.get_new_doc(doctype); - new_doc['quotation_to'] = doc.doctype; - new_doc['party_name'] = doc.name; - frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); - }); - }); - - make_opportunity.on('click', function() { - let doctype = $(this).attr('data-doctype'); - - frappe.model.with_doctype(doctype, function() { - var new_doc = frappe.model.get_new_doc(doctype); - new_doc['opportunity_from'] = doc.doctype; - new_doc['party_name'] = doc.name; - frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); - }); - }); - } else { frappe.contacts.clear_address_and_contact(cur_frm); } diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 389e25ece10..2dd65fec170 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -286,6 +286,16 @@ $.extend(erpnext.utils, { refresh_field(table_fieldname); }, + create_new_doc: function (doctype, update_fields) { + frappe.model.with_doctype(doctype, function() { + var new_doc = frappe.model.get_new_doc(doctype); + for (let [key, value] of Object.entries(update_fields)) { + new_doc[key] = value; + } + frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); + }); + } + }); erpnext.utils.select_alternate_items = function(opts) { diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 61a4fd487e5..0ce521261ef 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -3,6 +3,18 @@ frappe.ui.form.on("Customer", { setup: function(frm) { + + frm.make_methods = { + 'Quotation': () => erpnext.utils.create_new_doc('Quotation', { + 'quotation_to': frm.doc.doctype, + 'party_name': frm.doc.name + }), + 'Opportunity': () => erpnext.utils.create_new_doc('Opportunity', { + 'opportunity_from': frm.doc.doctype, + 'party_name': frm.doc.name + }) + } + frm.add_fetch('lead_name', 'company_name', 'customer_name'); frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate'); frm.set_query('customer_group', {'is_group': 0}); @@ -113,31 +125,6 @@ frappe.ui.form.on("Customer", { // indicator erpnext.utils.set_party_dashboard_indicators(frm); - let make_quotation = frm.dashboard.transactions_area.find('.btn-new[data-doctype="Quotation"]').unbind('click'); - let make_opportunity = frm.dashboard.transactions_area.find('.btn-new[data-doctype="Opportunity"]').unbind('click'); - - make_quotation.on('click', function() { - let doctype = $(this).attr('data-doctype'); - - frappe.model.with_doctype(doctype, function() { - var new_doc = frappe.model.get_new_doc(doctype); - new_doc['quotation_to'] = frm.doc.doctype; - new_doc['party_name'] = frm.doc.name; - frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); - }); - }); - - make_opportunity.on('click', function() { - let doctype = $(this).attr('data-doctype'); - - frappe.model.with_doctype(doctype, function() { - var new_doc = frappe.model.get_new_doc(doctype); - new_doc['opportunity_from'] = frm.doc.doctype; - new_doc['party_name'] = frm.doc.name; - frappe.ui.form.make_quick_entry(doctype, null, null, new_doc); - }); - }); - } else { frappe.contacts.clear_address_and_contact(frm); } From c5b68ef3869895a48b8220b4c99d3407618b47ad Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 15:50:46 +0530 Subject: [PATCH 03/19] fix: Rounding adjustment while additional discount amount is aplied on grand total --- erpnext/controllers/taxes_and_totals.py | 2 +- erpnext/public/js/controllers/taxes_and_totals.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 2db18298d38..3006c0e1235 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -390,7 +390,7 @@ class calculate_taxes_and_totals(object): net_total += item.net_amount # discount amount rounding loss adjustment if no taxes - if (not taxes or self.doc.apply_discount_on == "Net Total") \ + if (self.doc.apply_discount_on == "Net Total" or not taxes or total_for_discount_amount==self.doc.net_total) \ and i == len(self.doc.get("items")) - 1: discount_amount_loss = flt(self.doc.net_total - net_total - self.doc.discount_amount, self.doc.precision("net_total")) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index a2d44c3ae24..29769464f3e 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -514,7 +514,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ net_total += item.net_amount; // discount amount rounding loss adjustment if no taxes - if ((!(me.frm.doc.taxes || []).length || (me.frm.doc.apply_discount_on == "Net Total")) + if ((!(me.frm.doc.taxes || []).length || total_for_discount_amount==me.frm.doc.net_total || (me.frm.doc.apply_discount_on == "Net Total")) && i == (me.frm.doc.items || []).length - 1) { var discount_amount_loss = flt(me.frm.doc.net_total - net_total - me.frm.doc.discount_amount, precision("net_total")); From 4f579639c6b3802b2f0b06bcd7e905962a231670 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 16:26:38 +0530 Subject: [PATCH 04/19] fix: Use AND instead of OR --- erpnext/regional/report/gstr_1/gstr_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index a71a83a6bb0..b1cb7867daa 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -149,7 +149,7 @@ class Gstr1Report(object): if self.filters.get("type_of_business") == "B2B": conditions += """ and ifnull(invoice_type, '') != 'Export' and is_return != 1 - and customer in ('{0}') and (customer_gstin IS NOT NULL OR customer_gstin NOT IN ('', 'NA'))""".\ + and customer in ('{0}') and (customer_gstin IS NOT NULL AND customer_gstin NOT IN ('', 'NA'))""".\ format("', '".join([frappe.db.escape(c.name) for c in customers])) if self.filters.get("type_of_business") in ("B2C Large", "B2C Small"): From 20a4cf12903473ecd407a6040731ac137790c697 Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Fri, 24 May 2019 18:09:05 +0530 Subject: [PATCH 05/19] fix(selling): Remove Totals row for tree-based Sales Analytics --- erpnext/selling/report/sales_analytics/sales_analytics.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.json b/erpnext/selling/report/sales_analytics/sales_analytics.json index bd8230230ba..71932610a6a 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.json +++ b/erpnext/selling/report/sales_analytics/sales_analytics.json @@ -1,5 +1,5 @@ { - "add_total_row": 1, + "add_total_row": 0, "creation": "2018-09-21 12:46:29.451048", "disable_prepared_report": 0, "disabled": 0, @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2019-02-12 14:30:40.043652", + "modified": "2019-05-24 05:37:02.866139", "modified_by": "Administrator", "module": "Selling", "name": "Sales Analytics", From 50bdaa6d1a87d055cc8242310aff75a19de3731b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 18:08:22 +0530 Subject: [PATCH 06/19] fix: Added Expense Account field to push value from PO-PR-PI --- .../purchase_receipt_item.json | 114 +++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 528f799aa70..03fe4e46674 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -20,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "barcode", "fieldtype": "Data", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_2", "fieldtype": "Section Break", "hidden": 0, @@ -83,6 +85,7 @@ "bold": 1, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "item_code", "fieldtype": "Link", "hidden": 0, @@ -119,6 +122,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "supplier_part_no", "fieldtype": "Data", "hidden": 1, @@ -151,6 +155,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_2", "fieldtype": "Column Break", "hidden": 0, @@ -182,6 +187,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_name", "fieldtype": "Data", "hidden": 0, @@ -215,6 +221,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_4", "fieldtype": "Section Break", "hidden": 0, @@ -247,6 +254,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -282,6 +290,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break1", "fieldtype": "Column Break", "hidden": 0, @@ -312,6 +321,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image", "fieldtype": "Attach", "hidden": 1, @@ -344,6 +354,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image_view", "fieldtype": "Image", "hidden": 0, @@ -377,6 +388,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "received_and_accepted", "fieldtype": "Section Break", "hidden": 0, @@ -408,6 +420,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "received_qty", "fieldtype": "Float", "hidden": 0, @@ -443,6 +456,7 @@ "bold": 0, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "qty", "fieldtype": "Float", "hidden": 0, @@ -478,6 +492,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_qty", "fieldtype": "Float", "hidden": 0, @@ -513,6 +528,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break2", "fieldtype": "Column Break", "hidden": 0, @@ -544,6 +560,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "uom", "fieldtype": "Link", "hidden": 0, @@ -581,6 +598,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_uom", "fieldtype": "Link", "hidden": 0, @@ -617,6 +635,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "conversion_factor", "fieldtype": "Float", "hidden": 0, @@ -654,6 +673,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "item_code.retain_sample", + "fetch_if_empty": 0, "fieldname": "retain_sample", "fieldtype": "Check", "hidden": 0, @@ -689,6 +709,7 @@ "columns": 0, "depends_on": "retain_sample", "fetch_from": "item_code.sample_quantity", + "fetch_if_empty": 0, "fieldname": "sample_quantity", "fieldtype": "Int", "hidden": 0, @@ -722,6 +743,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rate_and_amount", "fieldtype": "Section Break", "hidden": 0, @@ -753,6 +775,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -786,6 +809,7 @@ "collapsible": 0, "columns": 0, "depends_on": "price_list_rate", + "fetch_if_empty": 0, "fieldname": "discount_percentage", "fieldtype": "Percent", "hidden": 0, @@ -818,6 +842,7 @@ "collapsible": 0, "columns": 0, "depends_on": "discount_percentage", + "fetch_if_empty": 0, "fieldname": "discount_amount", "fieldtype": "Currency", "hidden": 0, @@ -851,6 +876,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break3", "fieldtype": "Column Break", "hidden": 0, @@ -881,6 +907,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -913,6 +940,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sec_break1", "fieldtype": "Section Break", "hidden": 0, @@ -943,6 +971,7 @@ "bold": 1, "collapsible": 0, "columns": 3, + "fetch_if_empty": 0, "fieldname": "rate", "fieldtype": "Currency", "hidden": 0, @@ -979,6 +1008,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -1013,6 +1043,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break4", "fieldtype": "Column Break", "hidden": 0, @@ -1043,6 +1074,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_rate", "fieldtype": "Currency", "hidden": 0, @@ -1079,6 +1111,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_amount", "fieldtype": "Currency", "hidden": 0, @@ -1115,6 +1148,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "pricing_rule", "fieldtype": "Link", "hidden": 0, @@ -1147,6 +1181,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_29", "fieldtype": "Section Break", "hidden": 0, @@ -1178,6 +1213,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1211,6 +1247,7 @@ "bold": 0, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1244,6 +1281,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_32", "fieldtype": "Column Break", "hidden": 0, @@ -1275,6 +1313,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1308,6 +1347,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1341,6 +1381,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_weight_details", "fieldtype": "Section Break", "hidden": 0, @@ -1373,6 +1414,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_per_unit", "fieldtype": "Float", "hidden": 0, @@ -1405,6 +1447,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_weight", "fieldtype": "Float", "hidden": 0, @@ -1437,6 +1480,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_41", "fieldtype": "Column Break", "hidden": 0, @@ -1468,6 +1512,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_uom", "fieldtype": "Link", "hidden": 0, @@ -1501,6 +1546,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", "hidden": 0, @@ -1532,6 +1578,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, @@ -1568,6 +1615,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_warehouse", "fieldtype": "Link", "hidden": 0, @@ -1605,6 +1653,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:!doc.__islocal", + "fetch_if_empty": 0, "fieldname": "quality_inspection", "fieldtype": "Link", "hidden": 0, @@ -1639,6 +1688,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_40", "fieldtype": "Column Break", "hidden": 0, @@ -1670,6 +1720,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "is_fixed_asset", "fieldtype": "Check", "hidden": 1, @@ -1703,6 +1754,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_fixed_asset", + "fetch_if_empty": 0, "fieldname": "asset", "fieldtype": "Link", "hidden": 0, @@ -1737,6 +1789,7 @@ "collapsible": 0, "columns": 0, "depends_on": "is_fixed_asset", + "fetch_if_empty": 0, "fieldname": "asset_location", "fieldtype": "Link", "hidden": 0, @@ -1770,6 +1823,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "purchase_order", "fieldtype": "Link", "hidden": 0, @@ -1806,6 +1860,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, @@ -1839,6 +1894,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_qty", "fieldtype": "Float", "hidden": 0, @@ -1874,6 +1930,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_45", "fieldtype": "Section Break", "hidden": 0, @@ -1905,6 +1962,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "serial_no", "fieldtype": "Small Text", "hidden": 0, @@ -1938,6 +1996,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "batch_no", "fieldtype": "Link", "hidden": 0, @@ -1972,6 +2031,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_48", "fieldtype": "Column Break", "hidden": 0, @@ -2004,6 +2064,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rejected_serial_no", "fieldtype": "Small Text", "hidden": 0, @@ -2035,6 +2096,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_50", "fieldtype": "Section Break", "hidden": 0, @@ -2066,6 +2128,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "project", "fieldtype": "Link", "hidden": 0, @@ -2091,6 +2154,40 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Expense Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -2100,6 +2197,7 @@ "columns": 0, "default": ":Company", "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))", + "fetch_if_empty": 0, "fieldname": "cost_center", "fieldtype": "Link", "hidden": 0, @@ -2132,6 +2230,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "purchase_order_item", "fieldtype": "Data", "hidden": 1, @@ -2167,6 +2266,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break5", "fieldtype": "Column Break", "hidden": 0, @@ -2197,6 +2297,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "allow_zero_valuation_rate", "fieldtype": "Check", "hidden": 0, @@ -2229,6 +2330,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "bom", "fieldtype": "Link", "hidden": 0, @@ -2263,6 +2365,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:parent.is_subcontracted == 'Yes'", + "fetch_if_empty": 0, "fieldname": "include_exploded_items", "fieldtype": "Check", "hidden": 0, @@ -2295,6 +2398,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "billed_amt", "fieldtype": "Currency", "hidden": 0, @@ -2328,6 +2432,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "landed_cost_voucher_amount", "fieldtype": "Currency", "hidden": 0, @@ -2360,6 +2465,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "brand", "fieldtype": "Link", "hidden": 1, @@ -2395,6 +2501,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "item_group", "fieldtype": "Link", "hidden": 1, @@ -2429,6 +2536,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rm_supp_cost", "fieldtype": "Currency", "hidden": 1, @@ -2465,6 +2573,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_tax_amount", "fieldtype": "Currency", "hidden": 1, @@ -2501,6 +2610,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "valuation_rate", "fieldtype": "Currency", "hidden": 1, @@ -2538,6 +2648,7 @@ "collapsible": 0, "columns": 0, "description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges", + "fetch_if_empty": 0, "fieldname": "item_tax_rate", "fieldtype": "Code", "hidden": 1, @@ -2571,6 +2682,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, @@ -2608,7 +2720,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 16:04:36.138776", + "modified": "2019-05-30 18:06:42.150605", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", From 8cb2c7a89cda33051c8dd705149ccfb1d53b4625 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 May 2019 18:13:11 +0530 Subject: [PATCH 07/19] fix: Set query for expense account in PO and PR --- .../buying/doctype/purchase_order/purchase_order.js | 8 ++++++++ .../stock/doctype/purchase_receipt/purchase_receipt.js | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 019d0de4708..c032df32706 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -33,6 +33,14 @@ frappe.ui.form.on("Purchase Order", { } } }); + + frm.set_query("expense_account", "items", function() { + return { + query: "erpnext.controllers.queries.get_expense_account", + filters: {'company': frm.doc.company} + } + }); + }, refresh: function(frm) { diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index d33c23e4b17..7a073996c74 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -18,7 +18,15 @@ frappe.ui.form.on("Purchase Receipt", { "purchase_receipt": frm.doc.name } } - }) + }); + + frm.set_query("expense_account", "items", function() { + return { + query: "erpnext.controllers.queries.get_expense_account", + filters: {'company': frm.doc.company} + } + }); + }, onload: function(frm) { erpnext.queries.setup_queries(frm, "Warehouse", function() { From 9350b5a533f6df95757d272b93ad71c0137d8d45 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 30 May 2019 21:52:13 +0530 Subject: [PATCH 08/19] fix: allow import for packing slip --- .../doctype/packing_slip/packing_slip.json | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.json b/erpnext/stock/doctype/packing_slip/packing_slip.json index 93d7bdf78df..4e944039132 100644 --- a/erpnext/stock/doctype/packing_slip/packing_slip.json +++ b/erpnext/stock/doctype/packing_slip/packing_slip.json @@ -1,7 +1,8 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, - "allow_import": 0, + "allow_import": 1, "allow_rename": 0, "autoname": "MAT-PAC-.YYYY.-.#####", "beta": 0, @@ -20,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "packing_slip_details", "fieldtype": "Section Break", "hidden": 0, @@ -51,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break0", "fieldtype": "Column Break", "hidden": 0, @@ -82,6 +85,7 @@ "collapsible": 0, "columns": 0, "description": "Indicates that the package is a part of this delivery (Only Draft)", + "fetch_if_empty": 0, "fieldname": "delivery_note", "fieldtype": "Link", "hidden": 0, @@ -114,6 +118,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break1", "fieldtype": "Column Break", "hidden": 0, @@ -145,6 +150,7 @@ "collapsible": 0, "columns": 0, "default": "", + "fetch_if_empty": 0, "fieldname": "naming_series", "fieldtype": "Select", "hidden": 0, @@ -177,6 +183,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break0", "fieldtype": "Section Break", "hidden": 0, @@ -207,6 +214,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break2", "fieldtype": "Column Break", "hidden": 0, @@ -238,6 +246,7 @@ "collapsible": 0, "columns": 0, "description": "Identification of the package for the delivery (for print)", + "fetch_if_empty": 0, "fieldname": "from_case_no", "fieldtype": "Data", "hidden": 0, @@ -270,6 +279,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break3", "fieldtype": "Column Break", "hidden": 0, @@ -301,6 +311,7 @@ "collapsible": 0, "columns": 0, "description": "If more than one package of the same type (for print)", + "fetch_if_empty": 0, "fieldname": "to_case_no", "fieldtype": "Data", "hidden": 0, @@ -333,6 +344,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "package_item_details", "fieldtype": "Section Break", "hidden": 0, @@ -364,6 +376,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "get_items", "fieldtype": "Button", "hidden": 0, @@ -395,6 +408,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "items", "fieldtype": "Table", "hidden": 0, @@ -427,6 +441,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "package_weight_details", "fieldtype": "Section Break", "hidden": 0, @@ -459,6 +474,7 @@ "collapsible": 0, "columns": 0, "description": "The net weight of this package. (calculated automatically as sum of net weight of items)", + "fetch_if_empty": 0, "fieldname": "net_weight_pkg", "fieldtype": "Float", "hidden": 0, @@ -490,6 +506,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_weight_uom", "fieldtype": "Link", "hidden": 0, @@ -522,6 +539,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break4", "fieldtype": "Column Break", "hidden": 0, @@ -553,6 +571,7 @@ "collapsible": 0, "columns": 0, "description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)", + "fetch_if_empty": 0, "fieldname": "gross_weight_pkg", "fieldtype": "Float", "hidden": 0, @@ -584,6 +603,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "gross_weight_uom", "fieldtype": "Link", "hidden": 0, @@ -616,6 +636,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "letter_head_details", "fieldtype": "Section Break", "hidden": 0, @@ -648,6 +669,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "letter_head", "fieldtype": "Link", "hidden": 0, @@ -681,6 +703,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "misc_details", "fieldtype": "Section Break", "hidden": 0, @@ -712,6 +735,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "amended_from", "fieldtype": "Link", "hidden": 0, @@ -749,7 +773,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-08-21 16:15:37.201278", + "modified": "2019-05-30 21:50:38.260908", "modified_by": "Administrator", "module": "Stock", "name": "Packing Slip", From ffcb7aa6edcbb4e5410748c9ea732fe654d6755e Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 22:26:52 +0530 Subject: [PATCH 09/19] fix: Add translations for missing labels in AR report --- .../accounts/report/accounts_receivable/accounts_receivable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index e99447dcdbe..89e57ee572d 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -83,7 +83,7 @@ class ReceivablePayableReport(object): for label in ("Invoiced Amount", "Paid Amount", credit_or_debit_note, "Outstanding Amount"): columns.append({ - "label": label, + "label": _(label), "fieldname": frappe.scrub(label), "fieldtype": "Currency", "options": "currency", From 2dcd03d17dcf26ad9c04d4b4e154ecf29b791d03 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 22:33:02 +0530 Subject: [PATCH 10/19] fix: Label translations --- .../report/accounts_receivable/accounts_receivable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 89e57ee572d..f82a8572e23 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -68,13 +68,13 @@ class ReceivablePayableReport(object): if self.filters.based_on_payment_terms: columns.append({ - "label": "Payment Term", + "label": _("Payment Term"), "fieldname": "payment_term", "fieldtype": "Data", "width": 120 }) columns.append({ - "label": "Invoice Grand Total", + "label": _("Invoice Grand Total"), "fieldname": "invoice_grand_total", "fieldtype": "Currency", "options": "currency", From 6f1e624465dde03e678f118557177ac5c994bf0f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 30 May 2019 23:19:55 +0530 Subject: [PATCH 11/19] fix: POS cash mode of payment css --- erpnext/public/js/payment/pos_payment.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/payment/pos_payment.html b/erpnext/public/js/payment/pos_payment.html index 185d748aff9..cb6971b46b5 100644 --- a/erpnext/public/js/payment/pos_payment.html +++ b/erpnext/public/js/payment/pos_payment.html @@ -21,7 +21,7 @@
-
+
From a0b85d060b2f0491567f2dbda1ccd2d11877b658 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 3 Jun 2019 11:57:00 +0530 Subject: [PATCH 12/19] fix: Serial no filtering issue for delivered items --- erpnext/public/js/utils/serial_no_batch_selector.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index b94cdd8c4c3..d8ebe33e8a5 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -342,13 +342,24 @@ erpnext.SerialNoBatchSelector = Class.extend({ get_serial_no_fields: function() { var me = this; this.serial_list = []; + + let serial_no_filters = { + item_code: me.item_code, + delivery_document_no: ["in", ""] + } + + if (me.warehouse_details.name) { + serial_no_filters['warehouse'] = me.warehouse_details.name; + } return [ {fieldtype: 'Section Break', label: __('Serial No')}, { fieldtype: 'Link', fieldname: 'serial_no_select', options: 'Serial No', label: __('Select'), get_query: function() { - return { filters: {item_code: me.item_code, warehouse: me.warehouse_details.name}}; + return { + filters: serial_no_filters + }; }, onchange: function(e) { if(this.in_local_change) return; From fad3789f646653f50642c64ffe93c434d8a01f3b Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 3 Jun 2019 13:04:57 +0530 Subject: [PATCH 13/19] fix: Pass delivery document no as empty string --- erpnext/public/js/utils/serial_no_batch_selector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index d8ebe33e8a5..df50884ce71 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -345,7 +345,7 @@ erpnext.SerialNoBatchSelector = Class.extend({ let serial_no_filters = { item_code: me.item_code, - delivery_document_no: ["in", ""] + delivery_document_no: "" } if (me.warehouse_details.name) { From 56757866f346cc4393bc903809bd82d08d9b5c7c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 3 Jun 2019 18:20:46 +0530 Subject: [PATCH 14/19] fix: report Payment Period Based On Invoice Date not working --- .../payment_period_based_on_invoice_date.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py index a7d1820850c..89e0113fc8d 100644 --- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py +++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py @@ -18,22 +18,22 @@ def execute(filters=None): data = [] for d in entries: invoice = invoice_details.get(d.against_voucher) or frappe._dict() - + if d.reference_type=="Purchase Invoice": payment_amount = flt(d.debit) or -1 * flt(d.credit) else: payment_amount = flt(d.credit) or -1 * flt(d.debit) - row = [d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher, + row = [d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher, invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks] if d.against_voucher: - row += get_ageing_data(30, 60, 90, d.posting_date, invoice.posting_date, payment_amount) + row += get_ageing_data(30, 60, 90, 120, d.posting_date, invoice.posting_date, payment_amount) else: row += ["", "", "", "", ""] if invoice.due_date: row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0) - + data.append(row) return columns, data @@ -48,19 +48,19 @@ def get_columns(filters): return [ _("Payment Document") + ":: 100", _("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":140", - _("Party Type") + "::100", + _("Party Type") + "::100", _("Party") + ":Dynamic Link/Party Type:140", _("Posting Date") + ":Date:100", _("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == "Outgoing" else ":Link/Sales Invoice:130"), - _("Invoice Posting Date") + ":Date:130", - _("Payment Due Date") + ":Date:130", - _("Debit") + ":Currency:120", + _("Invoice Posting Date") + ":Date:130", + _("Payment Due Date") + ":Date:130", + _("Debit") + ":Currency:120", _("Credit") + ":Currency:120", - _("Remarks") + "::150", + _("Remarks") + "::150", _("Age") +":Int:40", - "0-30:Currency:100", - "30-60:Currency:100", - "60-90:Currency:100", + "0-30:Currency:100", + "30-60:Currency:100", + "60-90:Currency:100", _("90-Above") + ":Currency:100", _("Delay in payment (Days)") + "::150" ] @@ -79,21 +79,21 @@ def get_conditions(filters): if filters.party: conditions.append("party=%(party)s") - + if filters.party_type: conditions.append("against_voucher_type=%(reference_type)s") filters["reference_type"] = "Sales Invoice" if filters.party_type=="Customer" else "Purchase Invoice" if filters.get("from_date"): conditions.append("posting_date >= %(from_date)s") - + if filters.get("to_date"): conditions.append("posting_date <= %(to_date)s") return "and " + " and ".join(conditions) if conditions else "" def get_entries(filters): - return frappe.db.sql("""select + return frappe.db.sql("""select voucher_type, voucher_no, party_type, party, posting_date, debit, credit, remarks, against_voucher from `tabGL Entry` where company=%(company)s and voucher_type in ('Journal Entry', 'Payment Entry') {0} From 42d0ee7431c947fbcf3b2aa86a4fe4541fe251fe Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Wed, 5 Jun 2019 11:12:32 +0530 Subject: [PATCH 15/19] fix: Update Italy e-invoice XML --- erpnext/regional/italy/e-invoice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/italy/e-invoice.xml b/erpnext/regional/italy/e-invoice.xml index b725b964f2e..9a588d1666b 100644 --- a/erpnext/regional/italy/e-invoice.xml +++ b/erpnext/regional/italy/e-invoice.xml @@ -118,7 +118,7 @@ {{ doc.type_of_document }} - EUR + {{ doc.currency }} {{ doc.posting_date }} {{ doc.unamended_name }} {%- if doc.stamp_duty %} From 88832daae47150f8a727a5738f188ac447f3f90d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 5 Jun 2019 13:20:18 +0530 Subject: [PATCH 16/19] feat: Rounding based on settings on salary component (#17851) --- .../salary_component/salary_component.json | 254 ++++++++++-------- erpnext/hr/doctype/salary_slip/salary_slip.py | 4 + .../doctype/salary_slip/test_salary_slip.py | 12 +- 3 files changed, 155 insertions(+), 115 deletions(-) diff --git a/erpnext/hr/doctype/salary_component/salary_component.json b/erpnext/hr/doctype/salary_component/salary_component.json index ca49ceac006..c9dfe4c56f8 100644 --- a/erpnext/hr/doctype/salary_component/salary_component.json +++ b/erpnext/hr/doctype/salary_component/salary_component.json @@ -122,11 +122,42 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "1", - "depends_on": "eval:doc.type == \"Earning\"", "fetch_if_empty": 0, - "fieldname": "is_tax_applicable", - "fieldtype": "Check", + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -134,7 +165,6 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Is Tax Applicable", "length": 0, "no_copy": 0, "permlevel": 0, @@ -225,8 +255,10 @@ "bold": 0, "collapsible": 0, "columns": 0, + "default": "1", + "depends_on": "eval:doc.type == \"Earning\"", "fetch_if_empty": 0, - "fieldname": "do_not_include_in_total", + "fieldname": "is_tax_applicable", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -235,7 +267,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Do not include in total", + "label": "Is Tax Applicable", "length": 0, "no_copy": 0, "permlevel": 0, @@ -258,6 +290,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "depends_on": "is_tax_applicable", "fetch_if_empty": 0, "fieldname": "deduct_full_tax_on_selected_payroll_date", "fieldtype": "Check", @@ -292,39 +325,7 @@ "collapsible": 0, "columns": 0, "fetch_if_empty": 0, - "fieldname": "column_break_4", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, - "fieldname": "disabled", + "fieldname": "round_to_the_nearest_integer", "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, @@ -333,40 +334,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Disabled", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, - "fieldname": "description", - "fieldtype": "Small Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Description", + "label": "Round to the Nearest Integer", "length": 0, "no_copy": 0, "permlevel": 0, @@ -416,6 +384,72 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "do_not_include_in_total", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Do Not Include in Total", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "disabled", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Disabled", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -854,6 +888,40 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.amount_based_on_formula!==1", + "fetch_if_empty": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -895,7 +963,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.amount_based_on_formula!==0", + "depends_on": "amount_based_on_formula", "fetch_if_empty": 0, "fieldname": "formula", "fieldtype": "Code", @@ -922,40 +990,6 @@ "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.amount_based_on_formula!==1", - "fetch_if_empty": 0, - "fieldname": "amount", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amount", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -1034,7 +1068,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-05-13 12:55:55.424370", + "modified": "2019-06-05 11:19:15.926608", "modified_by": "Administrator", "module": "HR", "name": "Salary Component", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index cd423499b79..dd4c77d1452 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -616,6 +616,10 @@ class SalarySlip(TransactionBase): elif not row.amount: amount = row.default_amount + row.additional_amount + # apply rounding + if frappe.get_cached_value("Salary Component", row.salary_component, "round_to_the_nearest_integer"): + amount, additional_amount = rounded(amount), rounded(additional_amount) + return amount, additional_amount def calculate_unclaimed_taxable_benefits(self, payroll_period): diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py index b333f4f49e4..16a75f473f4 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py @@ -211,7 +211,7 @@ class TestSalarySlip(unittest.TestCase): tax_paid = get_tax_paid_in_period(employee) # total taxable income 586000, 250000 @ 5%, 86000 @ 20% ie. 12500 + 17200 - annual_tax = 113567.79 + annual_tax = 113568 try: self.assertEqual(tax_paid, annual_tax) except AssertionError: @@ -250,7 +250,7 @@ class TestSalarySlip(unittest.TestCase): # total taxable income 416000, 166000 @ 5% ie. 8300 try: - self.assertEqual(tax_paid, 88607.79) + self.assertEqual(tax_paid, 88608) except AssertionError: print("\nSalary Slip - Tax calculation failed on following case\n", data, "\n") raise @@ -265,7 +265,7 @@ class TestSalarySlip(unittest.TestCase): # total taxable income 566000, 250000 @ 5%, 66000 @ 20%, 12500 + 13200 tax_paid = get_tax_paid_in_period(employee) try: - self.assertEqual(tax_paid, 121211.48) + self.assertEqual(tax_paid, 121211) except AssertionError: print("\nSalary Slip - Tax calculation failed on following case\n", data, "\n") raise @@ -443,7 +443,8 @@ def make_deduction_salary_component(setup=False, test_tax=False): "type": "Deduction", "amount_based_on_formula": 1, "depends_on_payment_days": 0, - "variable_based_on_taxable_salary": 1 + "variable_based_on_taxable_salary": 1, + "round_to_the_nearest_integer": 1 } ] if not test_tax: @@ -453,7 +454,8 @@ def make_deduction_salary_component(setup=False, test_tax=False): "condition": 'employment_type=="Intern"', "formula": 'base*.1', "type": "Deduction", - "amount_based_on_formula": 1 + "amount_based_on_formula": 1, + "round_to_the_nearest_integer": 1 }) if setup or test_tax: make_salary_component(data, test_tax) From b20eda99965ee4d408e42ba2b2e9253d9668f206 Mon Sep 17 00:00:00 2001 From: Rohan Date: Wed, 5 Jun 2019 14:16:57 +0530 Subject: [PATCH 17/19] fix(projects): Remove hardcode of expected end date for new Tasks (#17716) --- erpnext/projects/doctype/task/task.js | 33 ++++++++++++--------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index c1a9c448b41..a4733b93207 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -19,43 +19,38 @@ frappe.ui.form.on("Task", { }, refresh: function(frm) { - frm.fields_dict['parent_task'].get_query = function() { + frm.fields_dict['parent_task'].get_query = function () { return { filters: { "is_group": 1, } } } - if(!frm.is_group){ - var doc = frm.doc; - if(doc.__islocal) { - if(!frm.doc.exp_end_date) { - frm.set_value("exp_end_date", frappe.datetime.add_days(new Date(), 7)); - } - } - if(!doc.__islocal) { - if(frappe.model.can_read("Timesheet")) { - frm.add_custom_button(__("Timesheet"), function() { - frappe.route_options = {"project": doc.project, "task": doc.name} + if (!frm.doc.is_group) { + if (!frm.is_new()) { + if (frappe.model.can_read("Timesheet")) { + frm.add_custom_button(__("Timesheet"), () => { + frappe.route_options = { "project": frm.doc.project, "task": frm.doc.name } frappe.set_route("List", "Timesheet"); }, __("View"), true); } - if(frappe.model.can_read("Expense Claim")) { - frm.add_custom_button(__("Expense Claims"), function() { - frappe.route_options = {"project": doc.project, "task": doc.name} + + if (frappe.model.can_read("Expense Claim")) { + frm.add_custom_button(__("Expense Claims"), () => { + frappe.route_options = { "project": frm.doc.project, "task": frm.doc.name } frappe.set_route("List", "Expense Claim"); }, __("View"), true); } - if(frm.perm[0].write) { - if(frm.doc.status!=="Closed" && frm.doc.status!=="Cancelled") { - frm.add_custom_button(__("Close"), function() { + if (frm.perm[0].write) { + if (!["Closed", "Cancelled"].includes(frm.doc.status)) { + frm.add_custom_button(__("Close"), () => { frm.set_value("status", "Closed"); frm.save(); }); } else { - frm.add_custom_button(__("Reopen"), function() { + frm.add_custom_button(__("Reopen"), () => { frm.set_value("status", "Open"); frm.save(); }); From 63af463a9a03092b0099156521e3960ab07dba06 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Wed, 5 Jun 2019 14:22:59 +0530 Subject: [PATCH 18/19] fix: Patch for renaming enquiry_from to opportunity_from (#17785) * fix: Patch for renaming enquiry_from to opportunity_from * fix: Patch fix * fix: patch fix * fix: Use has_column instead of exists * fix: Handled ifnull --- erpnext/patches.txt | 3 ++- .../v11_1/set_missing_opportunity_from.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v11_1/set_missing_opportunity_from.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9b5cc7f0ab0..b6083ef44c0 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -600,4 +600,5 @@ erpnext.patches.v11_1.set_missing_title_for_quotation execute:frappe.delete_doc("Report", "Inactive Items") erpnext.patches.v11_1.delete_scheduling_tool erpnext.patches.v11_1.update_bank_transaction_status -erpnext.patches.v11_1.renamed_delayed_item_report \ No newline at end of file +erpnext.patches.v11_1.renamed_delayed_item_report +erpnext.patches.v11_1.set_missing_opportunity_from \ No newline at end of file diff --git a/erpnext/patches/v11_1/set_missing_opportunity_from.py b/erpnext/patches/v11_1/set_missing_opportunity_from.py new file mode 100644 index 00000000000..cb444b2e5dd --- /dev/null +++ b/erpnext/patches/v11_1/set_missing_opportunity_from.py @@ -0,0 +1,17 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + + frappe.reload_doctype("Opportunity") + if frappe.db.has_column("Opportunity", "enquiry_from"): + frappe.db.sql(""" UPDATE `tabOpportunity` set opportunity_from = enquiry_from + where ifnull(opportunity_from, '') = '' and ifnull(enquiry_from, '') != ''""") + + if frappe.db.has_column("Opportunity", "lead") and frappe.db.has_column("Opportunity", "enquiry_from"): + frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = lead + where enquiry_from = 'Lead' and ifnull(party_name, '') = '' and ifnull(lead, '') != ''""") + + if frappe.db.has_column("Opportunity", "customer") and frappe.db.has_column("Opportunity", "enquiry_from"): + frappe.db.sql(""" UPDATE `tabOpportunity` set party_name = customer + where enquiry_from = 'Customer' and ifnull(party_name, '') = '' and ifnull(customer, '') != ''""") From 576e68eef018557826f8f3657eafc71d3290eee5 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Wed, 5 Jun 2019 15:35:01 +0550 Subject: [PATCH 19/19] bumped to version 11.1.36 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 69019252479..1d30f866bdf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.35' +__version__ = '11.1.36' def get_default_company(user=None): '''Get default company for user'''