From 3f398d24f3e7fd31954c52e09b17e89a54e66af3 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 31 Oct 2018 17:58:26 +0530 Subject: [PATCH 01/50] [Fix] Precision issue, not able to submit the stock entry (#15863) --- .../doctype/sales_invoice/sales_invoice.py | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index a6cd352b14..76de9c8efd 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -671,9 +671,11 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": tax.account_head, "against": self.customer, - "credit": flt(tax.base_tax_amount_after_discount_amount), - "credit_in_account_currency": flt(tax.base_tax_amount_after_discount_amount) \ - if account_currency==self.company_currency else flt(tax.tax_amount_after_discount_amount), + "credit": flt(tax.base_tax_amount_after_discount_amount, + tax.precision("tax_amount_after_discount_amount")), + "credit_in_account_currency": (flt(tax.base_tax_amount_after_discount_amount, + tax.precision("base_tax_amount_after_discount_amount")) if account_currency==self.company_currency else + flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount_after_discount_amount"))), "cost_center": tax.cost_center }, account_currency) ) @@ -681,7 +683,7 @@ class SalesInvoice(SellingController): def make_item_gl_entries(self, gl_entries): # income account gl entries for item in self.get("items"): - if flt(item.base_net_amount): + if flt(item.base_net_amount, item.precision("base_net_amount")): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) @@ -698,9 +700,10 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": item.income_account, "against": self.customer, - "credit": item.base_net_amount, - "credit_in_account_currency": item.base_net_amount \ - if account_currency==self.company_currency else item.net_amount, + "credit": flt(item.base_net_amount, item.precision("base_net_amount")), + "credit_in_account_currency": (flt(item.base_net_amount, item.precision("base_net_amount")) + if account_currency==self.company_currency + else flt(item.net_amount, item.precision("net_amount"))), "cost_center": item.cost_center }, account_currency) ) @@ -771,7 +774,7 @@ class SalesInvoice(SellingController): def make_write_off_gl_entry(self, gl_entries): # write off entries, applicable if only pos - if self.write_off_account and self.write_off_amount: + if self.write_off_account and flt(self.write_off_amount, self.precision("write_off_amount")): write_off_account_currency = get_account_currency(self.write_off_account) default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center') @@ -781,9 +784,10 @@ class SalesInvoice(SellingController): "party_type": "Customer", "party": self.customer, "against": self.write_off_account, - "credit": self.base_write_off_amount, - "credit_in_account_currency": self.base_write_off_amount \ - if self.party_account_currency==self.company_currency else self.write_off_amount, + "credit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")), + "credit_in_account_currency": (flt(self.base_write_off_amount, + self.precision("base_write_off_amount")) if self.party_account_currency==self.company_currency + else flt(self.write_off_amount, self.precision("write_off_amount"))), "against_voucher": self.return_against if cint(self.is_return) else self.name, "against_voucher_type": self.doctype }, self.party_account_currency) @@ -792,15 +796,16 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": self.write_off_account, "against": self.customer, - "debit": self.base_write_off_amount, - "debit_in_account_currency": self.base_write_off_amount \ - if write_off_account_currency==self.company_currency else self.write_off_amount, + "debit": flt(self.base_write_off_amount, self.precision("base_write_off_amount")), + "debit_in_account_currency": (flt(self.base_write_off_amount, + self.precision("base_write_off_amount")) if write_off_account_currency==self.company_currency + else flt(self.write_off_amount, self.precision("write_off_amount"))), "cost_center": self.write_off_cost_center or default_cost_center }, write_off_account_currency) ) def make_gle_for_rounding_adjustment(self, gl_entries): - if self.rounding_adjustment: + if flt(self.rounding_adjustment, self.precision("rounding_adjustment")): round_off_account, round_off_cost_center = \ get_round_off_account_and_cost_center(self.company) @@ -808,8 +813,10 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": round_off_account, "against": self.customer, - "credit_in_account_currency": self.rounding_adjustment, - "credit": self.base_rounding_adjustment, + "credit_in_account_currency": flt(self.rounding_adjustment, + self.precision("rounding_adjustment")), + "credit": flt(self.base_rounding_adjustment, + self.precision("base_rounding_adjustment")), "cost_center": round_off_cost_center, } )) From 0c0e49a42197cc64c87c9ac93c9d112ae013c2b9 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Wed, 31 Oct 2018 18:00:09 +0530 Subject: [PATCH 02/50] fix: Fix fieldnames in template (#15860) --- .../accounts_receivable.html | 26 ++++++------ .../accounts_receivable.py | 40 ++++++++++++++----- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 7f663d8ded..933c6ddf89 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -75,7 +75,7 @@ {%= format_currency(balance_row[range3]) %} {%= format_currency(balance_row[range4]) %} - {%= format_currency(flt(balance_row[__("Outstanding Amount")]), data[data.length-1]["currency"]) %} + {%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %} {%= __("PDC/LC") %} @@ -84,7 +84,7 @@ - {%= format_currency(flt(balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %} + {%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %} {%= __("Cheques Required") %} @@ -93,7 +93,7 @@ - {%= format_currency(flt(balance_row[__("Outstanding Amount")]-balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %} + {%= format_currency(flt(balance_row[("outstanding_amount")]-balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %} @@ -177,10 +177,10 @@ {%= data[i]["po_no"] %} {% } %} - {%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %} - {%= data[i][__("PDC/LC Ref")] %} - {%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %} + {%= frappe.datetime.str_to_user(data[i][("pdc/lc_date")]) %} + {%= data[i][("pdc/lc_ref")] %} + {%= format_currency(data[i][("pdc/lc_amount")], data[i]["currency"]) %} + {%= format_currency(data[i][("remaining_balance")], data[i]["currency"]) %} {% } %} {% } else { %} @@ -205,9 +205,9 @@ {%= data[i][__("Customer LPO")] %} {% } %} {%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %} - {%= data[i][__("PDC/LC Ref")] %} - {%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %} + {%= data[i][("pdc/lc_ref")] %} + {%= format_currency(data[i][("pdc/lc_amount")], data[i]["currency"]) %} + {%= format_currency(data[i][("remaining_balance")], data[i]["currency"]) %} {% } %} {% } %} {% } else { %} @@ -228,10 +228,10 @@ {% } else { %} {%= __("Total") %} {% } %} - {%= format_currency(data[i][__("Total Invoiced Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Total Paid Amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Total Outstanding Amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} {% } %} {% } %} diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 0425fe5136..fb5467148e 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -88,20 +88,40 @@ class ReceivablePayableReport(object): "width": 120 }) - columns.append({ + columns += [ + { "fieldname": "currency", "label": _("Currency"), "fieldtype": "Link", "options": "Currency", "width": 100 - }) - - columns += [ - _("PDC/LC Date") + ":Date:110", - _("PDC/LC Ref") + ":Data:110", - _("PDC/LC Amount") + ":Currency/currency:130", - _("Remaining Balance") + ":Currency/currency:130" - ] + }, + { + "fieldname": "pdc/lc_date", + "label": _("PDC/LC Date"), + "fieldtype": "Date", + "width": 110 + }, + { + "fieldname": "pdc/lc_ref", + "label": _("PDC/LC Ref"), + "fieldtype": "Data", + "width": 110 + }, + { + "fieldname": "pdc/lc_amount", + "label": _("PDC/LC Amount"), + "fieldtype": "Currency", + "options": "Currency", + "width": 130 + }, + { + "fieldname": "remaining_balance", + "label": _("Remaining Balance"), + "fieldtype": "Currency", + "options": "Currency", + "width": 130 + }] if args.get('party_type') == 'Customer': columns.append({ @@ -139,7 +159,6 @@ class ReceivablePayableReport(object): data = [] pdc_details = get_pdc_details(args.get("party_type"), self.filters.report_date) - gl_entries_data = self.get_entries_till(self.filters.report_date, args.get("party_type")) if gl_entries_data: @@ -429,7 +448,6 @@ def get_pdc_details(party_type, report_date): and pent.party_type = %s group by pent.party, pref.reference_name""", (report_date, party_type), as_dict=1): pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc) - if scrub(party_type): amount_field = ("jea.debit_in_account_currency" if party_type == 'Supplier' else "jea.credit_in_account_currency") From cd11bdfdbb4d8b9ba841a80bb890e944258ec791 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 31 Oct 2018 18:02:00 +0530 Subject: [PATCH 03/50] [Fix] Supplier wise sales analytics report not showing item details which is added in purchase invoice with update stock (#15869) --- .../supplier_wise_sales_analytics.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py index 1d694293ce..8dec3d0975 100644 --- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py +++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py @@ -84,6 +84,14 @@ def get_suppliers_details(filters): is_stock_item=1 and name=pri.item_code)""", as_dict=1): item_supplier_map.setdefault(d.item_code, []).append(d.supplier) + for d in frappe.db.sql("""select pr.supplier, pri.item_code from + `tabPurchase Invoice` pr, `tabPurchase Invoice Item` pri + where pr.name=pri.parent and pr.docstatus=1 and + ifnull(pr.update_stock, 0) = 1 and pri.item_code=(select name from `tabItem` + where is_stock_item=1 and name=pri.item_code)""", as_dict=1): + if d.item_code not in item_supplier_map: + item_supplier_map.setdefault(d.item_code, []).append(d.supplier) + if supplier: for item_code, suppliers in item_supplier_map.items(): if supplier not in suppliers: From 305c82bd8d0db30c716fb3b4cbbeb7505ba8f892 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Wed, 31 Oct 2018 18:02:55 +0530 Subject: [PATCH 04/50] fix(medical-record): Remove z-index property (#15790) --- erpnext/healthcare/page/medical_record/medical_record.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/healthcare/page/medical_record/medical_record.css b/erpnext/healthcare/page/medical_record/medical_record.css index 70014da1c0..977625bbd1 100644 --- a/erpnext/healthcare/page/medical_record/medical_record.css +++ b/erpnext/healthcare/page/medical_record/medical_record.css @@ -14,10 +14,6 @@ margin-bottom: -4px; } -.medical_record-row > * { - z-index: -999; -} - .date-indicator { background:none; font-size:12px; From 41c5fda196baabeea0adeaf5e3952febbe7754d2 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Wed, 31 Oct 2018 18:04:30 +0530 Subject: [PATCH 05/50] fix(sms-center): Fix db query (#15774) --- .../selling/doctype/sms_center/sms_center.py | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py index f3674ae373..bb6ba1ffce 100644 --- a/erpnext/selling/doctype/sms_center/sms_center.py +++ b/erpnext/selling/doctype/sms_center/sms_center.py @@ -15,19 +15,24 @@ class SMSCenter(Document): def create_receiver_list(self): rec, where_clause = '', '' if self.send_to == 'All Customer Contact': - where_clause = self.customer and " and customer = '%s'" % \ - self.customer.replace("'", "\'") or " and ifnull(customer, '') != ''" + where_clause = " and dl.link_doctype = 'Customer'" + if self.customer: + where_clause += " and dl.link_name = '%s'" % \ + self.customer.replace("'", "\'") or " and ifnull(dl.link_name, '') != ''" if self.send_to == 'All Supplier Contact': - where_clause = self.supplier and " and supplier = '%s'" % \ - self.supplier.replace("'", "\'") or " and ifnull(supplier, '') != ''" + where_clause = " and dl.link_doctype = 'Supplier'" + if self.supplier: + where_clause += " and dl.link_name = '%s'" % \ + self.supplier.replace("'", "\'") or " and ifnull(dl.link_name, '') != ''" if self.send_to == 'All Sales Partner Contact': - where_clause = self.sales_partner and " and sales_partner = '%s'" % \ - self.sales_partner.replace("'", "\'") or " and ifnull(sales_partner, '') != ''" - + where_clause = " and dl.link_doctype = 'Sales Partner'" + if self.sales_partner: + where_clause += "and dl.link_name = '%s'" % \ + self.sales_partner.replace("'", "\'") or " and ifnull(dl.link_name, '') != ''" if self.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']: - rec = frappe.db.sql("""select CONCAT(ifnull(first_name,''), ' ', ifnull(last_name,'')), - mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and - docstatus != 2 %s""" % where_clause) + rec = frappe.db.sql("""select CONCAT(ifnull(c.first_name,''), ' ', ifnull(c.last_name,'')), + c.mobile_no from `tabContact` c, `tabDynamic Link` dl where ifnull(c.mobile_no,'')!='' and + c.docstatus != 2 and dl.parent = c.name%s""" % where_clause) elif self.send_to == 'All Lead (Open)': rec = frappe.db.sql("""select lead_name, mobile_no from `tabLead` where @@ -50,7 +55,6 @@ class SMSCenter(Document): where ifnull(tabEmployee.cell_number,'')!=''""") rec_list = '' - for d in rec: rec_list += d[0] + ' - ' + d[1] + '\n' self.receiver_list = rec_list From b4bff7e298b18cf598b206c4f950f6427a72cddb Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 31 Oct 2018 13:35:58 +0000 Subject: [PATCH 06/50] bumped to version 10.1.66 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 105bff46bf..d016ebd21b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.65' +__version__ = '10.1.66' def get_default_company(user=None): '''Get default company for user''' From dcb71a61ad46c72a646db2dd91a27ba0b98d050b Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 2 Nov 2018 12:12:42 +0530 Subject: [PATCH 07/50] [Fix] Payment entry not able to submit (#15859) --- .../doctype/payment_entry/payment_entry.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 940a709beb..4802a7dd6a 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -791,15 +791,25 @@ frappe.ui.form.on('Payment Entry', { var write_off_row = $.map(frm.doc["deductions"] || [], function(t) { return t.account==r.message[account] ? t : null; }); - if (!write_off_row.length) { - var row = frm.add_child("deductions"); + var row = []; + + var difference_amount = flt(frm.doc.difference_amount, + precision("difference_amount")); + + if (!write_off_row.length && difference_amount) { + row = frm.add_child("deductions"); row.account = r.message[account]; row.cost_center = r.message["cost_center"]; } else { - var row = write_off_row[0]; + row = write_off_row[0]; + } + + if (row) { + row.amount = flt(row.amount) + difference_amount; + } else { + frappe.msgprint(__("No gain or loss in the exchange rate")) } - row.amount = flt(row.amount) + flt(frm.doc.difference_amount); refresh_field("deductions"); frm.events.set_unallocated_amount(frm); From 768513f2f979db3786801814e339e43535037129 Mon Sep 17 00:00:00 2001 From: Navdeep Ghai <30634335+navdeepghai1@users.noreply.github.com> Date: Fri, 2 Nov 2018 10:49:05 +0400 Subject: [PATCH 08/50] fixed divided by zero error (#15885) --- .../report/item_wise_sales_register/item_wise_sales_register.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 05ad741a3d..017a2c971b 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -54,7 +54,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum ] row += [(d.base_net_rate * d.qty)/d.stock_qty, d.base_net_amount] \ - if d.stock_uom != d.uom else [d.base_net_rate, d.base_net_amount] + if d.stock_uom != d.uom and d.stock_qty != 0 else [d.base_net_rate, d.base_net_amount] total_tax = 0 for tax in tax_columns: From 598d34445f0661b7f8c02467bca126d7f0ed58a0 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 2 Nov 2018 16:02:33 +0530 Subject: [PATCH 09/50] =?UTF-8?q?[Fix]=20Column=20=E2=80=98claimed=5Famoun?= =?UTF-8?q?t=E2=80=99=20cannot=20be=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erpnext/hr/doctype/employee_advance/employee_advance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py index 28547fb285..29aae05ba3 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.py +++ b/erpnext/hr/doctype/employee_advance/employee_advance.py @@ -60,7 +60,8 @@ class EmployeeAdvance(Document): where employee_advance = %s and docstatus=1 and allocated_amount > 0 """, self.name)[0][0] - frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount) + if claimed_amount: + frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount) @frappe.whitelist() def make_bank_entry(dt, dn): From 59f16bc9421889fd11b21180fc33e627c70e19be Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 5 Nov 2018 06:40:25 +0000 Subject: [PATCH 10/50] bumped to version 10.1.67 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d016ebd21b..7461fda9f7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.66' +__version__ = '10.1.67' def get_default_company(user=None): '''Get default company for user''' From 3e6663d47ed5ee970dd2725efa930c8ea6818486 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Nov 2018 14:01:59 +0530 Subject: [PATCH 11/50] fix(serial no): Set supplier info based on pur invoice if serial no is created from Purchase Invoice (#15820) --- erpnext/stock/doctype/serial_no/serial_no.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index 3d1979dd81..e04343dc42 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -81,9 +81,9 @@ class SerialNo(StockController): self.purchase_date = purchase_sle.posting_date self.purchase_time = purchase_sle.posting_time self.purchase_rate = purchase_sle.incoming_rate - if purchase_sle.voucher_type == "Purchase Receipt": + if purchase_sle.voucher_type in ("Purchase Receipt", "Purchase Invoice"): self.supplier, self.supplier_name = \ - frappe.db.get_value("Purchase Receipt", purchase_sle.voucher_no, + frappe.db.get_value(purchase_sle.voucher_type, purchase_sle.voucher_no, ["supplier", "supplier_name"]) # If sales return entry @@ -253,8 +253,8 @@ def has_duplicate_serial_no(sn, sle): status = False if sn.purchase_document_no: - if sle.voucher_type in ['Purchase Receipt', 'Stock Entry'] and \ - sn.delivery_document_type not in ['Purchase Receipt', 'Stock Entry']: + if sle.voucher_type in ['Purchase Receipt', 'Stock Entry', "Purchase Invoice"] and \ + sn.delivery_document_type not in ['Purchase Receipt', 'Stock Entry', "Purchase Invoice"]: status = True if status and sle.voucher_type == 'Stock Entry' and \ From a97a520aa85fdf31e0a753993d638361973841f6 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 6 Nov 2018 11:02:04 +0000 Subject: [PATCH 12/50] bumped to version 10.1.68 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7461fda9f7..7c307b760b 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.67' +__version__ = '10.1.68' def get_default_company(user=None): '''Get default company for user''' From c704630d5fd465c832a5f99914ff465bed9a5987 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Tue, 6 Nov 2018 17:24:45 +0530 Subject: [PATCH 13/50] fix: Return default if company not found (#15915) --- .../report/item_wise_sales_register/item_wise_sales_register.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index 017a2c971b..1c12cdfe86 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -16,7 +16,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum if not filters: filters = {} columns = get_columns(additional_table_columns) - company_currency = erpnext.get_company_currency(filters.company) + company_currency = erpnext.get_company_currency(filters.get('company')) item_list = get_items(filters, additional_query_columns) if item_list: From 7f37d26f0527fba9cefcb55046ddd3b0671c4abf Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Wed, 7 Nov 2018 11:26:10 +0000 Subject: [PATCH 14/50] bumped to version 10.1.69 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7c307b760b..7c26e1da6a 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.68' +__version__ = '10.1.69' def get_default_company(user=None): '''Get default company for user''' From 6ff2f395f51696ebd6e2e40d2570d3af5092ddfd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 8 Nov 2018 12:30:44 +0530 Subject: [PATCH 15/50] fix(gle): Post gl entry for booking COGS from Sales Invoice even if grand_total is zero (#15825) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 76de9c8efd..065e32a76f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -589,9 +589,6 @@ class SalesInvoice(SellingController): def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False): auto_accounting_for_stock = erpnext.is_perpetual_inventory_enabled(self.company) - if not self.grand_total: - return - if not gl_entries: gl_entries = self.get_gl_entries() From a88eaa6e206c21b9f5fd1cc6abbc1085e97e2269 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 8 Nov 2018 13:05:08 +0530 Subject: [PATCH 16/50] [Fix] User able to change discount if pricing rule has discount value as zero (#15921) --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index eca4320e18..75db8b9314 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -185,7 +185,8 @@ def get_pricing_rule_for_item(args): "discount_percentage": 0.0 }) else: - item_details.discount_percentage = pricing_rule.discount_percentage or args.discount_percentage + item_details.discount_percentage = (pricing_rule.get('discount_percentage', 0) + if pricing_rule else args.discount_percentage) elif args.get('pricing_rule'): item_details = remove_pricing_rule_for_item(args.get("pricing_rule"), item_details) From f8a5cfe8d8c286f8744765f95d2e6bd44339ffc7 Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Fri, 9 Nov 2018 10:09:04 +0000 Subject: [PATCH 17/50] bumped to version 10.1.70 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7c26e1da6a..1b66ea75cf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.69' +__version__ = '10.1.70' def get_default_company(user=None): '''Get default company for user''' From 438490fd2934a7bfbf7e937f139d0f39fa0acd99 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Mon, 12 Nov 2018 15:11:04 +0530 Subject: [PATCH 18/50] fix: changed currency exchange API to frankfurter - Switched to Frankfurter's public API (frankfurter.app) from self hosted API (frankfurter.erpnext.org) --- erpnext/setup/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index f318c042d5..dfff74a78c 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -95,7 +95,7 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None): if not value: import requests - api_url = "https://frankfurter.erpnext.org/{0}".format(transaction_date) + api_url = "https://frankfurter.app/{0}".format(transaction_date) response = requests.get(api_url, params={ "base": from_currency, "symbols": to_currency From fad08e1bcbed9fc41e2a20d307c19847ecac3e4c Mon Sep 17 00:00:00 2001 From: khushalti Date: Tue, 13 Nov 2018 12:09:32 +0530 Subject: [PATCH 19/50] [fix] - GL entry not creating on PR if rejected qty mentoned (#15815) --- erpnext/patches.txt | 3 +- ...r_purchase_receipts_with_rejected_items.py | 32 +++++++++++++++++++ .../purchase_receipt/purchase_receipt.py | 3 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6c7a252b16..bc6f99db84 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -506,4 +506,5 @@ erpnext.patches.v10_0.update_address_template_for_india erpnext.patches.v10_0.set_discount_amount erpnext.patches.v10_0.recalculate_gross_margin_for_project erpnext.patches.v10_0.delete_hub_documents -erpnext.patches.v10_0.update_user_image_in_employee \ No newline at end of file +erpnext.patches.v10_0.update_user_image_in_employee +erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items \ No newline at end of file diff --git a/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py b/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py new file mode 100644 index 0000000000..68c06ef62b --- /dev/null +++ b/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py @@ -0,0 +1,32 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe, erpnext + +def execute(): + for company in frappe.get_all("Company"): + if not erpnext.is_perpetual_inventory_enabled(company.name): + continue + + acc_frozen_upto = frappe.db.get_value("Accounts Settings", None, "acc_frozen_upto") or "1900-01-01" + pr_with_rejected_warehouse = frappe.db.sql(""" + select pr.name + from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item + where pr.name = pr_item.parent + and pr.posting_date > %s + and pr.docstatus=1 + and pr.company = %s + and pr_item.rejected_qty > 0 + """, (acc_frozen_upto, company.name), as_dict=1) + + for d in pr_with_rejected_warehouse: + doc = frappe.get_doc("Purchase Receipt", d.name) + + doc.docstatus = 2 + doc.make_gl_entries_on_cancel(repost_future_gle=False) + + + # update gl entries for submit state of PR + doc.docstatus = 1 + doc.make_gl_entries(repost_future_gle=False) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 80dc4e1260..2c56a97625 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -182,7 +182,8 @@ class PurchaseReceipt(BuyingController): if warehouse_account.get(d.warehouse): stock_value_diff = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Purchase Receipt", "voucher_no": self.name, - "voucher_detail_no": d.name}, "stock_value_difference") + "voucher_detail_no": d.name, "warehouse": d.warehouse}, "stock_value_difference") + if not stock_value_diff: continue gl_entries.append(self.get_gl_dict({ From 6b78e520d2a22cf9ecb4a1aca8e03735d2a7337d Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Tue, 13 Nov 2018 10:55:31 +0000 Subject: [PATCH 20/50] bumped to version 10.1.71 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1b66ea75cf..981ca9a510 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.70' +__version__ = '10.1.71' def get_default_company(user=None): '''Get default company for user''' From 047a7123eb0308ce64dbd5b48b81a88c518f7346 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 14 Nov 2018 13:20:00 +0530 Subject: [PATCH 21/50] Claimed amount is not reset on cancel --- erpnext/hr/doctype/employee_advance/employee_advance.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py index 29aae05ba3..c90e5dbbde 100644 --- a/erpnext/hr/doctype/employee_advance/employee_advance.py +++ b/erpnext/hr/doctype/employee_advance/employee_advance.py @@ -58,10 +58,9 @@ class EmployeeAdvance(Document): select sum(ifnull(allocated_amount, 0)) from `tabExpense Claim Advance` where employee_advance = %s and docstatus=1 and allocated_amount > 0 - """, self.name)[0][0] + """, self.name)[0][0] or 0 - if claimed_amount: - frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount) + frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount) @frappe.whitelist() def make_bank_entry(dt, dn): From 2426d00dd68b504404a35bf37cce4ecd936f59bd Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Thu, 15 Nov 2018 09:04:14 +0000 Subject: [PATCH 22/50] bumped to version 10.1.72 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 981ca9a510..d6bb2d7aab 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.71' +__version__ = '10.1.72' def get_default_company(user=None): '''Get default company for user''' From f4dc71661d1d07e883e83b5a27ba9b4b1bbce7cf Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 15 Nov 2018 17:04:02 +0530 Subject: [PATCH 23/50] [Fix] Address not set from the API --- erpnext/controllers/buying_controller.py | 12 ++++++++++++ erpnext/controllers/selling_controller.py | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index cd3cbe97c9..7ed225fa28 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -10,6 +10,7 @@ from erpnext.accounts.party import get_party_details from erpnext.stock.get_item_details import get_conversion_factor from erpnext.buying.utils import validate_for_items, update_last_purchase_rate from erpnext.stock.stock_ledger import get_valuation_rate +from frappe.contacts.doctype.address.address import get_address_display from erpnext.controllers.stock_controller import StockController @@ -39,6 +40,7 @@ class BuyingController(StockController): self.set_qty_as_per_stock_uom() self.validate_stock_or_nonstock_items() self.validate_warehouse() + self.set_supplier_address() if self.doctype=="Purchase Invoice": self.validate_purchase_receipt_if_update_stock() @@ -96,6 +98,16 @@ class BuyingController(StockController): if not d.cost_center and lc_voucher_data and lc_voucher_data[0][1]: d.db_set('cost_center', lc_voucher_data[0][1]) + def set_supplier_address(self): + address_dict = { + 'supplier_address': 'address_display', + 'shipping_address': 'shipping_address_display' + } + + for address_field, address_display_field in address_dict.items(): + if self.get(address_field): + self.set(address_display_field, get_address_display(self.get(address_field))) + def set_total_in_words(self): from frappe.utils import money_in_words if self.meta.get_field("base_in_words"): diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index be5f64ecb1..5c203aff69 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -8,6 +8,7 @@ from frappe import _, throw from erpnext.stock.get_item_details import get_bin_details from erpnext.stock.utils import get_incoming_rate from erpnext.stock.get_item_details import get_conversion_factor +from frappe.contacts.doctype.address.address import get_address_display from erpnext.controllers.stock_controller import StockController @@ -40,6 +41,7 @@ class SellingController(StockController): self.validate_selling_price() self.set_qty_as_per_stock_uom() self.set_po_nos() + self.set_customer_address() check_active_sales_items(self) def set_missing_values(self, for_validate=False): @@ -344,6 +346,17 @@ class SellingController(StockController): po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)}) self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no]))) + def set_customer_address(self): + address_dict = { + 'customer_address': 'address_display', + 'shipping_address_name': 'shipping_address', + 'company_address': 'company_address_display' + } + + for address_field, address_display_field in address_dict.items(): + if self.get(address_field): + self.set(address_display_field, get_address_display(self.get(address_field))) + def validate_items(self): # validate items to see if they have is_sales_item enabled from erpnext.controllers.buying_controller import validate_item_type From 27a0c3796399fca289a5a7ec9033dd7ad7e71a09 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Thu, 15 Nov 2018 19:21:30 +0000 Subject: [PATCH 24/50] css: build files in v10 --- erpnext/public/css/erpnext.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index 460efbfe9f..c55e422151 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -346,6 +346,11 @@ body[data-route="pos"] .btn-more { body[data-route="pos"] .collapse-btn { cursor: pointer; } +@media (max-width: 767px) { + body[data-route="pos"] .page-actions { + max-width: 110px; + } +} .price-info { position: absolute; left: 0; From 6424f47f3bd5054643edacc1261099ffe0435306 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 21 Nov 2018 23:18:41 +0530 Subject: [PATCH 25/50] [Fix] Incorrect stock value difference because of negative stock --- erpnext/stock/stock_ledger.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 53267d64bc..43140faff6 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -176,7 +176,11 @@ class update_entries_after(object): # rounding as per precision self.stock_value = flt(self.stock_value, self.precision) - stock_value_difference = self.stock_value - self.prev_stock_value + if self.prev_stock_value < 0 and self.stock_value >= 0: + stock_value_difference = sle.actual_qty * self.valuation_rate + else: + stock_value_difference = self.stock_value - self.prev_stock_value + self.prev_stock_value = self.stock_value # update current sle From 5dbb9f5312b42f907fdbac939bc1ea7ecaa06975 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Fri, 23 Nov 2018 19:54:08 +0530 Subject: [PATCH 26/50] Accounts receivable summary print fix --- .../accounts_receivable.html | 6 +- .../accounts_receivable_summary.py | 104 +++++++++++++++--- 2 files changed, 89 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 933c6ddf89..b4276a10cd 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -194,7 +194,7 @@ {% if(!filters.show_pdc_in_print) { %} {%= format_currency(data[i]["paid_amount"], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["credit_note"], data[i]["currency"]) : format_currency(data[i]["debit_note"], data[i]["currency"]) %} {% } %} {%= format_currency(data[i]["outstanding_amount"], data[i]["currency"]) %} @@ -220,7 +220,7 @@
{%= data[i][__("Customer Name")] %} {% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
{%= data[i][__("Supplier Name")] %} - {% } %} + {% } %} {% } %}
{%= __("Remarks") %}: {%= data[i][__("Remarks")] %} @@ -230,7 +230,7 @@ {% } %} {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("credit_note_amt")], data[i]["currency"]) : format_currency(data[i][__("debit_note_amt")], data[i]["currency"]) %} {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} {% } %} {% } %} diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 08b24fb147..fdb7ec82ca 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe import _ +from frappe import _, scrub from frappe.utils import flt from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport @@ -18,25 +18,93 @@ class AccountsReceivableSummary(ReceivablePayableReport): if party_naming_by == "Naming Series": columns += [ args.get("party_type") + " Name::140"] - credit_debit_label = _("Credit Note Amt") if args.get('party_type') == 'Customer' else _("Debit Note Amt") + credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt" + + columns += [{ + "label": _("Total Invoiced Amt"), + "fieldname": "total_invoiced_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }, + { + "label": _("Total Paid Amt"), + "fieldname": "total_paid_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + }] + columns += [ - _("Total Invoiced Amt") + ":Currency/currency:140", - _("Total Paid Amt") + ":Currency/currency:140", - credit_debit_label + ":Currency/currency:140", - _("Total Outstanding Amt") + ":Currency/currency:160", - "0-" + str(self.filters.range1) + ":Currency/currency:100", - str(self.filters.range1) + "-" + str(self.filters.range2) + ":Currency/currency:100", - str(self.filters.range2) + "-" + str(self.filters.range3) + ":Currency/currency:100", - str(self.filters.range3) + _("-Above") + ":Currency/currency:100"] + { + "label": _(credit_debit_label), + "fieldname": scrub(credit_debit_label), + "fieldtype": "Currency", + "options": "currency", + "width": 140 + }, + { + "label": _("Total Outstanding Amt"), + "fieldname": "total_outstanding_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _("0-" + str(self.filters.range1)), + "fieldname": scrub("0-" + str(self.filters.range1)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldname": scrub(str(self.filters.range1) + "-" + str(self.filters.range2)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldname": scrub(str(self.filters.range2) + "-" + str(self.filters.range3)), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + }, + { + "label": _(str(self.filters.range3) + _("-Above")), + "fieldname": scrub(str(self.filters.range3) + _("-Above")), + "fieldtype": "Currency", + "options": "currency", + "width": 160 + } + ] if args.get("party_type") == "Customer": - columns += [ - _("Territory") + ":Link/Territory:80", - _("Customer Group") + ":Link/Customer Group:120" - ] + columns += [{ + "label": _("Territory"), + "fieldname": "territory", + "fieldtype": "Link", + "options": "Territory", + "width": 80 + }, + { + "label": _("Customer Group"), + "fieldname": "customer_group", + "fieldtype": "Link", + "options": "Customer Group", + "width": 80 + }] + if args.get("party_type") == "Supplier": - columns += [_("Supplier Type") + ":Link/Supplier Type:80"] - + columns += [{ + "label": _("Supplier Group"), + "fieldname": "supplier_group", + "fieldtype": "Link", + "options": "Supplier Group", + "width": 80 + }] + columns.append({ "fieldname": "currency", "label": _("Currency"), @@ -67,7 +135,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): row += [self.get_territory(party), self.get_customer_group(party)] if args.get("party_type") == "Supplier": row += [self.get_supplier_type(party)] - + row.append(party_dict.currency) data.append(row) @@ -91,7 +159,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): for k in party_total[d.party].keys(): if k != "currency": party_total[d.party][k] += flt(d.get(k, 0)) - + party_total[d.party].currency = d.currency return party_total From 3893ba302c8086c3fc63e1214de4b3d7aed88193 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 26 Nov 2018 14:03:23 +0530 Subject: [PATCH 27/50] If is pos and no pos profile use the item's default warehouse for packing materials --- erpnext/stock/doctype/packed_item/packed_item.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py index 0c55b433a1..e0ad7ac9df 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.py +++ b/erpnext/stock/doctype/packed_item/packed_item.py @@ -49,8 +49,9 @@ def update_packing_list_item(doc, packing_item_code, qty, main_item_row, descrip pi.qty = flt(qty) pi.description = description if not pi.warehouse: - pi.warehouse = (main_item_row.warehouse - if (doc.get('is_pos') or not item.default_warehouse) else item.default_warehouse) + pi.warehouse = (main_item_row.warehouse if ((doc.get('is_pos') + or not item.default_warehouse) and main_item_row.warehouse) else item.default_warehouse) + if not pi.batch_no: pi.batch_no = cstr(main_item_row.get("batch_no")) if not pi.target_warehouse: From 10bcd5113cf03e55f1d86ca2f11744a2d8f2eb60 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 27 Nov 2018 16:25:35 +0530 Subject: [PATCH 28/50] [Fix] Accounts receivable summary print is not working --- .../report/accounts_receivable/accounts_receivable.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 933c6ddf89..ae8141e9f0 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -228,10 +228,10 @@ {% } else { %} {%= __("Total") %} {% } %} - {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} - {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Invoiced Amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Paid Amt")], data[i]["currency"]) %} {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][__("Total Outstanding Amt")], data[i]["currency"]) %} {% } %} {% } %} From 96598936ad87690f1033961636da1c6e7b595ad9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 27 Nov 2018 17:48:13 +0530 Subject: [PATCH 29/50] fix(test): Fixed tests for discount with margin and period closing voucher --- .../test_period_closing_voucher.py | 1 + .../doctype/pricing_rule/test_pricing_rule.py | 36 +++++++------------ erpnext/controllers/taxes_and_totals.py | 7 ++-- .../public/js/controllers/taxes_and_totals.js | 3 +- erpnext/public/js/controllers/transaction.js | 2 +- 5 files changed, 20 insertions(+), 29 deletions(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index 9ef66edc34..eb02d97b78 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -72,6 +72,7 @@ class TestPeriodClosingVoucher(unittest.TestCase): "company": "_Test Company", "fiscal_year": get_fiscal_year(today(), company="_Test Company")[0], "posting_date": today(), + "cost_center": "_Test Cost Center - _TC", "remarks": "test" }) pcv.insert() diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py index 3fa34e279a..30ae71db3a 100644 --- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py @@ -11,12 +11,16 @@ from erpnext.stock.get_item_details import get_item_details from frappe import MandatoryError class TestPricingRule(unittest.TestCase): + def setUp(self): + frappe.db.sql("delete from `tabPricing Rule`") + + def tearDown(self): + frappe.db.sql("delete from `tabPricing Rule`") + def test_pricing_rule_for_discount(self): from erpnext.stock.get_item_details import get_item_details from frappe import MandatoryError - frappe.db.sql("delete from `tabPricing Rule`") - test_record = { "doctype": "Pricing Rule", "title": "_Test Pricing Rule", @@ -88,14 +92,10 @@ class TestPricingRule(unittest.TestCase): details = get_item_details(args) self.assertEquals(details.get("discount_percentage"), 15) - frappe.db.sql("delete from `tabPricing Rule`") - def test_pricing_rule_for_margin(self): from erpnext.stock.get_item_details import get_item_details from frappe import MandatoryError - frappe.db.sql("delete from `tabPricing Rule`") - test_record = { "doctype": "Pricing Rule", "title": "_Test Pricing Rule", @@ -109,14 +109,14 @@ class TestPricingRule(unittest.TestCase): "company": "_Test Company" } frappe.get_doc(test_record.copy()).insert() - + item_price = frappe.get_doc({ "doctype": "Item Price", "price_list": "_Test Price List 2", "item_code": "_Test FG Item 2", "price_list_rate": 100 }) - + item_price.insert(ignore_permissions=True) args = frappe._dict({ @@ -136,14 +136,10 @@ class TestPricingRule(unittest.TestCase): self.assertEquals(details.get("margin_type"), "Percentage") self.assertEquals(details.get("margin_rate_or_amount"), 10) - frappe.db.sql("delete from `tabPricing Rule`") - def test_pricing_rule_for_variants(self): from erpnext.stock.get_item_details import get_item_details from frappe import MandatoryError - frappe.db.sql("delete from `tabPricing Rule`") - if not frappe.db.exists("Item", "Test Variant PRT"): frappe.get_doc({ "doctype": "Item", @@ -209,8 +205,6 @@ class TestPricingRule(unittest.TestCase): self.assertEquals(details.get("discount_percentage"), 17.5) def test_pricing_rule_for_stock_qty(self): - frappe.db.sql("delete from `tabPricing Rule`") - test_record = { "doctype": "Pricing Rule", "title": "_Test Pricing Rule", @@ -253,24 +247,18 @@ class TestPricingRule(unittest.TestCase): def test_pricing_rule_with_margin_and_discount(self): frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule') - make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10) + make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10, discount_percentage=10) si = create_sales_invoice(do_not_save=True) si.items[0].price_list_rate = 1000 si.payment_schedule = [] si.insert(ignore_permissions=True) item = si.items[0] - self.assertEquals(item.rate, 1100) self.assertEquals(item.margin_rate_or_amount, 10) - - # With discount - item.discount_percentage = 10 - si.payment_schedule = [] - si.save() - item = si.items[0] + self.assertEquals(item.rate_with_margin, 1100) + self.assertEqual(item.discount_percentage, 10) + self.assertEquals(item.discount_amount, 110) self.assertEquals(item.rate, 990) - self.assertEquals(item.discount_percentage, 10) - frappe.db.sql("delete from `tabPricing Rule`") def make_pricing_rule(**args): args = frappe._dict(args) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 41ba61b231..2639a15adc 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -66,8 +66,11 @@ class calculate_taxes_and_totals(object): if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']: item.rate_with_margin, item.base_rate_with_margin = self.calculate_margin(item) - item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\ - if item.rate_with_margin > 0 else item.rate + if flt(item.rate_with_margin) > 0: + item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate")) + item.discount_amount = item.rate_with_margin - item.rate + elif flt(item.price_list_rate) > 0: + item.discount_amount = item.price_list_rate - item.rate item.net_rate = item.rate item.amount = flt(item.rate * item.qty, item.precision("amount")) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index a31acfc5f5..0a0dcf7be2 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -10,9 +10,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ + flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100); } else { item.rate_with_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount); - item.base_rate_with_margin = flt(item.rate_with_margin) * flt(this.frm.doc.conversion_rate); } - + item.base_rate_with_margin = flt(item.rate_with_margin) * flt(this.frm.doc.conversion_rate); item.rate = flt(item.rate_with_margin , precision("rate", item)); if(item.discount_percentage){ diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index d9bd50c226..e5ecc5ba1b 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -33,7 +33,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ item.margin_rate_or_amount = 0; item.rate_with_margin = 0; } - + item.base_rate_with_margin = item.rate_with_margin * flt(frm.doc.conversion_rate); cur_frm.cscript.set_gross_profit(item); cur_frm.cscript.calculate_taxes_and_totals(); From e3136c38e1c1ee10211a7606da4e15f97336347b Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 28 Nov 2018 07:57:27 +0000 Subject: [PATCH 30/50] bumped to version 10.1.73 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d6bb2d7aab..97359ede97 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.72' +__version__ = '10.1.73' def get_default_company(user=None): '''Get default company for user''' From ca332bdcdbd0ce08d3cbef6e038c229db6d86870 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 29 Nov 2018 18:15:29 +0530 Subject: [PATCH 31/50] Revert "[Fix] Accounts receivable summary print is not working" --- .../report/accounts_receivable/accounts_receivable.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index b22f880f6e..b4276a10cd 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -228,10 +228,10 @@ {% } else { %} {%= __("Total") %} {% } %} - {%= format_currency(data[i][__("Total Invoiced Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Total Paid Amt")], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")], data[i]["currency"]) : format_currency(data[i][__("Debit Note Amt")], data[i]["currency"]) %} - {%= format_currency(data[i][__("Total Outstanding Amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("credit_note_amt")], data[i]["currency"]) : format_currency(data[i][__("debit_note_amt")], data[i]["currency"]) %} + {%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %} {% } %} {% } %} From eda0a6eb331d1ce39d5a2521988431daee2359eb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 30 Nov 2018 15:15:17 +0530 Subject: [PATCH 32/50] fix(test): Fixed tests for period closing voucher --- .../doctype/period_closing_voucher/period_closing_voucher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index 03d0918226..dee8b16358 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -75,7 +75,8 @@ class PeriodClosingVoucher(AccountsController): "debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0, "debit": abs(net_pl_balance) if net_pl_balance > 0 else 0, "credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0, - "credit": abs(net_pl_balance) if net_pl_balance < 0 else 0 + "credit": abs(net_pl_balance) if net_pl_balance < 0 else 0, + "cost_center": self.cost_center })) from erpnext.accounts.general_ledger import make_gl_entries From 16b8ecbe058bfb406cc35ddfe9c7bef69626c9fb Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 30 Nov 2018 16:20:52 +0530 Subject: [PATCH 33/50] [Fix] Stock value difference calculation for stock reconciliation --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 2 +- erpnext/stock/stock_ledger.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 5b6e706674..257434fb89 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -180,7 +180,7 @@ class StockReconciliation(StockController): frappe.throw(_("Valuation Rate required for Item in row {0}").format(row.idx)) if ((previous_sle and row.qty == previous_sle.get("qty_after_transaction") - and row.valuation_rate == previous_sle.get("valuation_rate")) + and (row.valuation_rate == previous_sle.get("valuation_rate") or row.qty == 0)) or (not previous_sle and not row.qty)): continue diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 43140faff6..c73cbf2942 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -176,7 +176,7 @@ class update_entries_after(object): # rounding as per precision self.stock_value = flt(self.stock_value, self.precision) - if self.prev_stock_value < 0 and self.stock_value >= 0: + if self.prev_stock_value < 0 and self.stock_value >= 0 and sle.voucher_type != 'Stock Reconciliation': stock_value_difference = sle.actual_qty * self.valuation_rate else: stock_value_difference = self.stock_value - self.prev_stock_value From a8003c1af7e06eee1e0b2ea3f7e38f64b460df7e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 3 Dec 2018 11:49:52 +0530 Subject: [PATCH 34/50] [Fix] Permissions issue while making item variants --- erpnext/stock/doctype/item/item.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 86594a2a26..3bebd296ce 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -458,7 +458,7 @@ $.extend(erpnext.item, { fields: ["attribute_value"], limit_start: 0, limit_page_length: 500, - parent: "Item" + parent: "Item Attribute" } }).then((r) => { if(r.message) { @@ -579,7 +579,7 @@ $.extend(erpnext.item, { ["attribute_value", "like", term + "%"] ], fields: ["attribute_value"], - parent: "Item" + parent: "Item Attribute" }, callback: function(r) { if (r.message) { From db43c3af68bb95039cee168c2dc5b27a413a469b Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 3 Dec 2018 12:15:10 +0530 Subject: [PATCH 35/50] display message if details to fetch grade isnt filled up --- .../doctype/assessment_result/assessment_result.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/education/doctype/assessment_result/assessment_result.js b/erpnext/education/doctype/assessment_result/assessment_result.js index cf176aa520..27f549016d 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.js +++ b/erpnext/education/doctype/assessment_result/assessment_result.js @@ -50,6 +50,12 @@ frappe.ui.form.on("Assessment Result", { frappe.ui.form.on("Assessment Result Detail", { score: function(frm, cdt, cdn) { var d = locals[cdt][cdn]; + + if(!d.maximum_score || !frm.doc.grading_scale) { + d.score = ""; + frappe.throw(__("Please fill in all the details to generate Assessment Result.")); + } + if (d.score > d.maximum_score) { frappe.throw(__("Score cannot be greater than Maximum Score")); } From dd7b020b0177d3200c7512dc6a398a5d88d23510 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 3 Dec 2018 14:24:41 +0530 Subject: [PATCH 36/50] fix(test): Fixed tests for period closing voucher --- .../doctype/period_closing_voucher/period_closing_voucher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index dee8b16358..7a2e25474a 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -70,13 +70,14 @@ class PeriodClosingVoucher(AccountsController): net_pl_balance += flt(acc.balance_in_company_currency) if net_pl_balance: + cost_center = frappe.db.get_value("Company", self.company, "cost_center") gl_entries.append(self.get_gl_dict({ "account": self.closing_account_head, "debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0, "debit": abs(net_pl_balance) if net_pl_balance > 0 else 0, "credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0, "credit": abs(net_pl_balance) if net_pl_balance < 0 else 0, - "cost_center": self.cost_center + "cost_center": cost_center })) from erpnext.accounts.general_ledger import make_gl_entries From 114cc810a0605644dd27d051323ecf452d12692e Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 3 Dec 2018 15:13:06 +0530 Subject: [PATCH 37/50] List view currency bug fix --- erpnext/stock/doctype/delivery_note/delivery_note_list.js | 4 ++-- .../stock/doctype/purchase_receipt/purchase_receipt_list.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_list.js b/erpnext/stock/doctype/delivery_note/delivery_note_list.js index f1ad92914b..2972e41d4f 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note_list.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note_list.js @@ -1,6 +1,6 @@ frappe.listview_settings['Delivery Note'] = { - add_fields: ["customer", "customer_name", "base_grand_total", "per_installed", "per_billed", - "transporter_name", "grand_total", "is_return", "status"], + add_fields: ["customer", "customer_name", "base_grand_total", "per_installed", "per_billed", + "transporter_name", "grand_total", "is_return", "status", "currency"], get_indicator: function(doc) { if(cint(doc.is_return)==1) { return [__("Return"), "darkgrey", "is_return,=,Yes"]; diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js index 5c57fb5f01..5033b2d0b8 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js @@ -1,6 +1,6 @@ frappe.listview_settings['Purchase Receipt'] = { add_fields: ["supplier", "supplier_name", "base_grand_total", "is_subcontracted", - "transporter_name", "is_return", "status", "per_billed"], + "transporter_name", "is_return", "status", "per_billed", "currency"], get_indicator: function(doc) { if(cint(doc.is_return)==1) { return [__("Return"), "darkgrey", "is_return,=,Yes"]; From 636d186d081ff3e6b725a4605dfcd07c6c70cf8a Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 3 Dec 2018 15:52:45 +0530 Subject: [PATCH 38/50] [Fix] In project, tax amount is added in the total billed amount(sales) field --- erpnext/projects/doctype/project/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 75582cde6f..ec8dcc9e98 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -254,13 +254,13 @@ class Project(Document): self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0 def update_sales_amount(self): - total_sales_amount = frappe.db.sql("""select sum(base_grand_total) + total_sales_amount = frappe.db.sql("""select sum(base_net_total) from `tabSales Order` where project = %s and docstatus=1""", self.name) self.total_sales_amount = total_sales_amount and total_sales_amount[0][0] or 0 def update_billed_amount(self): - total_billed_amount = frappe.db.sql("""select sum(base_grand_total) + total_billed_amount = frappe.db.sql("""select sum(base_net_total) from `tabSales Invoice` where project = %s and docstatus=1""", self.name) self.total_billed_amount = total_billed_amount and total_billed_amount[0][0] or 0 From 675567419b564d4ab2992df763751edcec40b5ad Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 4 Dec 2018 18:43:52 +0530 Subject: [PATCH 39/50] [Fix] Permissions issue --- erpnext/public/js/utils/item_quick_entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/utils/item_quick_entry.js b/erpnext/public/js/utils/item_quick_entry.js index b2e0b85556..0248f9a187 100644 --- a/erpnext/public/js/utils/item_quick_entry.js +++ b/erpnext/public/js/utils/item_quick_entry.js @@ -320,7 +320,7 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ ["attribute_value", "like", e.target.value + "%"] ], fields: ["attribute_value"], - parent: "Item" + parent: "Item Attribute" }, callback: function(r) { if (r.message) { From 40c15348dab7e486e7cb5dce8c203fced1979a3b Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 6 Dec 2018 07:37:32 +0530 Subject: [PATCH 40/50] fix(setup-wizard): Validate abbr length before switching to next slide --- erpnext/public/js/setup_wizard.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 484d81decc..75a27594f1 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -97,6 +97,9 @@ erpnext.setup.slides_settings = [ if (!this.values.company_abbr) { return false; } + if (this.values.company_abbr.length > 5) { + return false; + } return true; } }, From be0a349a5273bb5cc34e3f39a6efdfe13ae051e0 Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Thu, 6 Dec 2018 09:14:35 +0000 Subject: [PATCH 41/50] bumped to version 10.1.74 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 97359ede97..2f63374928 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.73' +__version__ = '10.1.74' def get_default_company(user=None): '''Get default company for user''' From 65a9991d8408ba6623a0191fb6f14482e4f9b844 Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Mon, 10 Dec 2018 12:14:33 +0000 Subject: [PATCH 42/50] bumped to version 10.1.75 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 2f63374928..84b56376e4 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.74' +__version__ = '10.1.75' def get_default_company(user=None): '''Get default company for user''' From ba8c0412063a6c930d255b5cb5b993d676c353f8 Mon Sep 17 00:00:00 2001 From: "shreyashah115@gmail.com" Date: Thu, 20 Dec 2018 13:23:51 +0530 Subject: [PATCH 43/50] fix: Check if items exist --- erpnext/buying/doctype/purchase_order/purchase_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index d4f1de1776..e0781f137a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -85,6 +85,7 @@ class PurchaseOrder(BuyingController): frappe.msgprint(_("{0} currently has a {1} Supplier Scorecard standing, and Purchase Orders to this supplier should be issued with caution.").format(self.supplier, standing), title=_("Caution"), indicator='orange') def validate_minimum_order_qty(self): + if not self.get("items"): return items = list(set([d.item_code for d in self.get("items")])) itemwise_min_order_qty = frappe._dict(frappe.db.sql("""select name, min_order_qty From ed3561279de263556a7a766c39099f3e16570749 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Mon, 24 Dec 2018 09:49:51 +0100 Subject: [PATCH 44/50] Update README.md (#16224) --- erpnext/selling/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/README.md b/erpnext/selling/README.md index db05132a9d..d186133d1f 100644 --- a/erpnext/selling/README.md +++ b/erpnext/selling/README.md @@ -1,6 +1,11 @@ -Selling management module. Includes forms for capturing / managing the sales process. +Selling management module. Includes forms for capturing / managing the sales process: + +- Customer +- Campaign +- Quotation +- Sales Order + +Moved to CRM Module: - Lead - Opportunity -- Quotation -- Sales Order \ No newline at end of file From d2b9093ecce124fe165a3a6aa898483e80cc1890 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 24 Dec 2018 14:21:07 +0530 Subject: [PATCH 45/50] fix: Check if items exist (#16248) --- erpnext/controllers/buying_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 7ed225fa28..0496ab21f4 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -462,7 +462,7 @@ class BuyingController(StockController): update_last_purchase_rate(self, is_submit = 0) def validate_schedule_date(self): - if not self.schedule_date: + if not self.schedule_date and self.get("items"): self.schedule_date = min([d.schedule_date for d in self.get("items")]) if self.schedule_date: From 91ddadeefac5ab9c31f3efa4e4c86b991d81badf Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 24 Dec 2018 14:25:12 +0530 Subject: [PATCH 46/50] fix: add currency to options (#16199) --- .../quotation_item/quotation_item.json | 120 +++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index 6b721c004e..d3f128fa6a 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -15,6 +15,7 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -44,11 +45,13 @@ "reqd": 1, "search_index": 1, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "150px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -74,10 +77,12 @@ "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, @@ -102,10 +107,12 @@ "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, @@ -134,11 +141,13 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "150px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -165,10 +174,12 @@ "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, @@ -197,11 +208,13 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "300px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -227,10 +240,12 @@ "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, @@ -257,10 +272,12 @@ "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, @@ -288,10 +305,12 @@ "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, @@ -317,10 +336,12 @@ "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": 1, "collapsible": 0, @@ -349,11 +370,13 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -383,11 +406,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -412,10 +437,12 @@ "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, @@ -443,10 +470,12 @@ "reqd": 1, "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, @@ -473,10 +502,12 @@ "reqd": 1, "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, @@ -503,10 +534,12 @@ "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, @@ -532,10 +565,12 @@ "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, @@ -565,11 +600,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -599,11 +636,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -630,10 +669,12 @@ "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, @@ -662,10 +703,12 @@ "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, @@ -693,10 +736,12 @@ "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, @@ -725,10 +770,12 @@ "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, @@ -754,10 +801,12 @@ "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, @@ -787,11 +836,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -820,10 +871,12 @@ "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, @@ -852,10 +905,12 @@ "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, @@ -880,10 +935,12 @@ "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": 1, "collapsible": 0, @@ -915,11 +972,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -936,6 +995,7 @@ "label": "Net Rate", "length": 0, "no_copy": 0, + "options": "currency", "permlevel": 0, "precision": "", "print_hide": 1, @@ -946,10 +1006,12 @@ "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, @@ -979,11 +1041,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1011,10 +1075,12 @@ "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, @@ -1039,10 +1105,12 @@ "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, @@ -1072,11 +1140,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1103,10 +1173,12 @@ "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, @@ -1136,11 +1208,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "100px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1168,10 +1242,12 @@ "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, @@ -1198,10 +1274,12 @@ "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": 1, @@ -1228,10 +1306,12 @@ "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, @@ -1258,10 +1338,12 @@ "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, @@ -1288,10 +1370,12 @@ "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, @@ -1317,10 +1401,12 @@ "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, @@ -1348,10 +1434,12 @@ "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": 1, @@ -1379,10 +1467,12 @@ "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, @@ -1410,10 +1500,12 @@ "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, @@ -1439,10 +1531,12 @@ "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, @@ -1469,10 +1563,12 @@ "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, @@ -1500,10 +1596,12 @@ "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, @@ -1530,10 +1628,12 @@ "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, @@ -1559,10 +1659,12 @@ "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, @@ -1592,11 +1694,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "150px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1626,11 +1730,13 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "150px" }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1658,10 +1764,12 @@ "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, @@ -1686,10 +1794,12 @@ "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": 1, "bold": 0, "collapsible": 0, @@ -1717,10 +1827,12 @@ "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, @@ -1750,10 +1862,12 @@ "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, @@ -1783,6 +1897,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "150px" } @@ -1798,7 +1913,7 @@ "istable": 1, "max_attachments": 0, "menu_index": 0, - "modified": "2018-08-06 05:18:38.135668", + "modified": "2018-12-12 05:52:46.135944", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", @@ -1811,5 +1926,6 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file From c4d38c0afc83c99fbabbbd4fc9a08e62d4851e96 Mon Sep 17 00:00:00 2001 From: Navdeep Ghai <30634335+navdeepghai1@users.noreply.github.com> Date: Mon, 24 Dec 2018 13:23:19 +0400 Subject: [PATCH 47/50] Fix the disappears of image bug after uploading and saving the employee (#16217) * Fix image disappears of image after uploading and saving the employee * Fix the codacy issue --- erpnext/hr/doctype/employee/employee.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 81671c21dc..5d5bdd99ce 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -55,8 +55,8 @@ class Employee(NestedSet): def validate_user_details(self): data = frappe.db.get_value('User', self.user_id, ['enabled', 'user_image'], as_dict=1) - - self.image = data.get("user_image") + if data.get("user_image"): + self.image = data.get("user_image") self.validate_for_enabled_user_id(data.get("enabled", 0)) self.validate_duplicate_user_id() @@ -336,4 +336,4 @@ def get_children(doctype, parent=None, company=None, is_root=False, is_tree=Fals .format(company=company, condition=condition), as_dict=1) # return employee - return employee \ No newline at end of file + return employee From 7ec5e80b707444bc1b8a2664bdfc71ee402d0677 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 24 Dec 2018 14:55:31 +0530 Subject: [PATCH 48/50] [Fix] While making sales invoice from delivery note, system not remove the returned qty (#16141) --- .../doctype/sales_order/sales_order.py | 2 +- .../doctype/delivery_note/delivery_note.py | 20 ++++++++++++++++++- .../delivery_note/test_delivery_note.py | 18 +++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 8b0ecbf370..b2c6ccc7f1 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -552,7 +552,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): def update_item(source, target, source_parent): target.amount = flt(source.amount) - flt(source.billed_amt) target.base_amount = target.amount * flt(source_parent.conversion_rate) - target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty + target.qty = target.amount / flt(source.rate) if (source.rate and source.billed_amt) else source.qty - source.returned_qty item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1) target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \ diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index ccc6da4031..5a0d7728c3 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -382,8 +382,24 @@ def get_invoiced_qty_map(delivery_note): return invoiced_qty_map +def get_returned_qty_map(sales_orders): + """returns a map: {so_detail: returned_qty}""" + returned_qty_map = {} + + for name, returned_qty in frappe.get_all('Sales Order Item', fields = ["name", "returned_qty"], + filters = {'parent': ('in', sales_orders), 'docstatus': 1}, as_list=1): + if not returned_qty_map.get(name): + returned_qty_map[name] = 0 + returned_qty_map[name] += returned_qty + + return returned_qty_map + @frappe.whitelist() def make_sales_invoice(source_name, target_doc=None): + doc = frappe.get_doc('Delivery Note', source_name) + sales_orders = [d.against_sales_order for d in doc.items] + returned_qty_map = get_returned_qty_map(sales_orders) + invoiced_qty_map = get_invoiced_qty_map(source_name) def set_missing_values(source, target): @@ -403,7 +419,9 @@ def make_sales_invoice(source_name, target_doc=None): target.update(get_fetch_values("Sales Invoice", 'company_address', target.company_address)) def update_item(source_doc, target_doc, source_parent): - target_doc.qty = source_doc.qty - invoiced_qty_map.get(source_doc.name, 0) + target_doc.qty = (source_doc.qty - + invoiced_qty_map.get(source_doc.name, 0) - returned_qty_map.get(source_doc.so_detail, 0)) + if source_doc.serial_no and source_parent.per_billed > 0: target_doc.serial_no = get_delivery_note_serial_no(source_doc.item_code, target_doc.qty, source_parent.name) diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py index c3dbb8d4e7..0771d79848 100644 --- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py @@ -564,6 +564,24 @@ class TestDeliveryNote(unittest.TestCase): self.assertEqual(dn.per_billed, 100) self.assertEqual(dn.status, "Completed") + def test_make_sales_invoice_from_dn_for_returned_qty(self): + from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note + from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice + + so = make_sales_order(qty=2) + so.submit() + + dn = make_delivery_note(so.name) + dn.submit() + + dn1 = create_delivery_note(is_return=1, return_against=dn.name, qty=-1, do_not_submit=True) + dn1.items[0].against_sales_order = so.name + dn1.items[0].so_detail = so.items[0].name + dn1.submit() + + si = make_sales_invoice(dn.name) + self.assertEquals(si.items[0].qty, 1) + def create_delivery_note(**args): dn = frappe.new_doc("Delivery Note") args = frappe._dict(args) From 52a692ee084e9614d430a4e5425f2ad625ee7950 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 26 Dec 2018 00:40:17 +0530 Subject: [PATCH 49/50] [Fix] Not able to delete customer if contact is available --- erpnext/selling/doctype/customer/customer.py | 5 +++++ erpnext/selling/doctype/customer/test_customer.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index b17345c2e7..2a6853aa67 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -173,6 +173,11 @@ class Customer(TransactionBase): frappe.throw(_("""New credit limit is less than current outstanding amount for the customer. Credit limit has to be atleast {0}""").format(outstanding_amt)) def on_trash(self): + if self.customer_primary_contact: + frappe.db.sql("""update `tabCustomer` + set customer_primary_contact=null, mobile_no=null, email_id=null + where name=%s""", self.name) + delete_contact_and_address('Customer', self.name) if self.lead_name: frappe.db.sql("update `tabLead` set status='Interested' where name=%s", self.lead_name) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 45546e348a..123fd552c6 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -96,6 +96,15 @@ class TestCustomer(unittest.TestCase): so.save() + def test_delete_customer_contact(self): + customer = frappe.get_doc( + get_customer_dict('_Test Customer for delete')).insert(ignore_permissions=True) + + customer.mobile_no = "8989889890" + customer.save() + self.assertTrue(customer.customer_primary_contact) + frappe.delete_doc('Customer', customer.name) + def test_disabled_customer(self): make_test_records("Item") From 9a9c9c2ba39b2fca2a803cb198fb2bb49e55464d Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Wed, 26 Dec 2018 11:09:34 +0000 Subject: [PATCH 50/50] bumped to version 10.1.76 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 84b56376e4..b9d86a8e84 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.75' +__version__ = '10.1.76' def get_default_company(user=None): '''Get default company for user'''