From 3f398d24f3e7fd31954c52e09b17e89a54e66af3 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 31 Oct 2018 17:58:26 +0530 Subject: [PATCH 1/8] [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 2/8] 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 3/8] [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 4/8] 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 5/8] 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 78b273af43637b5d9bb157c966e303b06ec6c903 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 <42651287+deepeshgarg007@users.noreply.github.com> Date: Wed, 31 Oct 2018 18:12:03 +0530 Subject: [PATCH 6/8] [Bug-Fix] Cannot Save Bank Statement Transaction Entry (#15793) * Create bank settings only if bank name is available * Minor bug-fix in validate_overlap --- .../bank_statement_transaction_entry.py | 9 +++++---- erpnext/hr/utils.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py b/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py index 7a7d7d226c..f5581941ba 100644 --- a/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py +++ b/erpnext/accounts/doctype/bank_statement_transaction_entry/bank_statement_transaction_entry.py @@ -16,10 +16,11 @@ import copy class BankStatementTransactionEntry(Document): def autoname(self): self.name = self.bank_account + "-" + self.from_date + "-" + self.to_date - mapper_name = self.bank + "-Statement-Settings" - if not frappe.db.exists("Bank Statement Settings", mapper_name): - self.create_settings(self.bank) - self.bank_settings = mapper_name + if self.bank: + mapper_name = self.bank + "-Statement-Settings" + if not frappe.db.exists("Bank Statement Settings", mapper_name): + self.create_settings(self.bank) + self.bank_settings = mapper_name def create_settings(self, bank): mapper = frappe.new_doc("Bank Statement Settings") diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 281b7fcb5d..f35eb5919e 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -178,7 +178,8 @@ def validate_overlap(doc, from_date, to_date, company = None): }, as_dict = 1) if overlap_doc: - exists_for = doc.employee + if doc.get("employee"): + exists_for = doc.employee if company: exists_for = company throw_overlap_error(doc, exists_for, overlap_doc[0].name, from_date, to_date) From b4bff7e298b18cf598b206c4f950f6427a72cddb Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 31 Oct 2018 13:35:58 +0000 Subject: [PATCH 7/8] 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 9f20f777b2e43dcb597562fd26e592de5fad4b38 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Wed, 31 Oct 2018 13:51:24 +0000 Subject: [PATCH 8/8] bumped to version 11.0.3-beta.17 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 9d21e4ba43..3a0ada8b0a 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '11.x.x-develop' -staging_version = '11.0.3-beta.16' +staging_version = '11.0.3-beta.17' error_report_email = "support@erpnext.com"