diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 45a1b1f8e4..de8063debb 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''' 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 46ee79c9c9..101b9f2194 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/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 607051e50a..1b63f7105f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -747,9 +747,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) ) @@ -757,7 +759,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) @@ -774,9 +776,10 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": item.income_account if not item.enable_deferred_revenue else item.deferred_revenue_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) ) @@ -875,7 +878,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.get_cached_value('Company', self.company, 'cost_center') @@ -885,10 +888,11 @@ 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, - "against_voucher": self.return_against if cint(self.is_return) and self.return_against else self.name, + "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, "cost_center": self.cost_center }, self.party_account_currency) @@ -897,15 +901,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.cost_center or 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) @@ -913,8 +918,10 @@ class SalesInvoice(SellingController): self.get_gl_dict({ "account": round_off_account, "against": self.customer, - "credit_in_account_currency": self.base_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": self.cost_center or round_off_cost_center, } )) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 2284fcd69e..f26cd33b18 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 6bdafd7abf..572f81dc35 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -89,20 +89,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({ @@ -140,7 +160,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: @@ -464,7 +483,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") 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; diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 5041be0123..fcadc38594 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 = '12.x.x-develop' -staging_version = '11.0.3-beta.16' +staging_version = '11.0.3-beta.17' error_report_email = "support@erpnext.com" 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) 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 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 917a334251..2a02b469fb 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 @@ -85,6 +85,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 iteritems(item_supplier_map): if supplier not in suppliers: