From a032f0528e4e8567fe07d0ed7ab786f8d629a6e8 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 11 Feb 2019 13:12:44 +0530 Subject: [PATCH 01/24] new report gross-and-net-profit-report --- erpnext/accounts/doctype/account/account.json | 35 +++- .../accounts/report/financial_statements.py | 9 +- .../gross_and_net_profit_report/__init__.py | 0 .../gross_and_net_profit_report.html | 1 + .../gross_and_net_profit_report.js | 51 ++++++ .../gross_and_net_profit_report.json | 30 ++++ .../gross_and_net_profit_report.py | 163 ++++++++++++++++++ 7 files changed, 285 insertions(+), 4 deletions(-) create mode 100644 erpnext/accounts/report/gross_and_net_profit_report/__init__.py create mode 100644 erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html create mode 100644 erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js create mode 100644 erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json create mode 100644 erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index e47f8d2245..876a3922c9 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -632,6 +632,39 @@ "set_only_once": 0, "translatable": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(((doc.account_type==\"Income Account\") || (doc.account_type==\"Expense Account\")) && (doc.is_group != 1))", + "fieldname": "include_in_gross", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Include in gross", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 } ], "has_web_view": 0, @@ -645,7 +678,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-01-07 16:52:02.557837", + "modified": "2019-02-08 11:30:46.790603", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py index 09cf5b1d2f..fd84bd0c56 100644 --- a/erpnext/accounts/report/financial_statements.py +++ b/erpnext/accounts/report/financial_statements.py @@ -126,7 +126,7 @@ def get_label(periodicity, from_date, to_date): def get_data( company, root_type, balance_must_be, period_list, filters=None, accumulated_values=1, only_current_fiscal_year=True, ignore_closing_entries=False, - ignore_accumulated_values_for_fy=False): + ignore_accumulated_values_for_fy=False , total = True): accounts = get_accounts(company, root_type) if not accounts: @@ -154,7 +154,7 @@ def get_data( out = prepare_data(accounts, balance_must_be, period_list, company_currency) out = filter_out_zero_value_rows(out, parent_children_map) - if out: + if out and total: add_total_row(out, root_type, balance_must_be, period_list, company_currency) return out @@ -218,6 +218,9 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency): "year_start_date": year_start_date, "year_end_date": year_end_date, "currency": company_currency, + "include_in_gross": d.include_in_gross, + "account_type": d.account_type, + "is_group": d.is_group, "opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1), "account_name": ('%s - %s' %(_(d.account_number), _(d.account_name)) if d.account_number else _(d.account_name)) @@ -285,7 +288,7 @@ def add_total_row(out, root_type, balance_must_be, period_list, company_currency def get_accounts(company, root_type): return frappe.db.sql(""" - select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name + select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name, include_in_gross, account_type, is_group, lft, rgt from `tabAccount` where company=%s and root_type=%s order by lft""", (company, root_type), as_dict=True) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/__init__.py b/erpnext/accounts/report/gross_and_net_profit_report/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html new file mode 100644 index 0000000000..40ba20c4ac --- /dev/null +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html @@ -0,0 +1 @@ +{% include "accounts/report/financial_statements.html" %} \ No newline at end of file diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js new file mode 100644 index 0000000000..63ac281cdb --- /dev/null +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt +/* eslint-disable */ + +frappe.query_reports["Gross and Net Profit Report"] = { + "filters": [ + + ] +} +frappe.require("assets/erpnext/js/financial_statements.js", function() { + frappe.query_reports["Gross and Net Profit Report"] = $.extend({}, + erpnext.financial_statements); + + frappe.query_reports["Gross and Net Profit Report"]["filters"].push( + { + "fieldname":"project", + "label": __("Project"), + "fieldtype": "MultiSelect", + get_data: function() { + var projects = frappe.query_report.get_filter_value("project") || ""; + + const values = projects.split(/\s*,\s*/).filter(d => d); + const txt = projects.match(/[^,\s*]*$/)[0] || ''; + let data = []; + + frappe.call({ + type: "GET", + method:'frappe.desk.search.search_link', + async: false, + no_spinner: true, + args: { + doctype: "Project", + txt: txt, + filters: { + "name": ["not in", values] + } + }, + callback: function(r) { + data = r.results; + } + }); + return data; + } + }, + { + "fieldname": "accumulated_values", + "label": __("Accumulated Values"), + "fieldtype": "Check" + } + ); +}); diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json new file mode 100644 index 0000000000..994b47faef --- /dev/null +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json @@ -0,0 +1,30 @@ +{ + "add_total_row": 0, + "creation": "2019-02-08 10:58:55.763090", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2019-02-08 10:58:55.763090", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Gross and Net Profit Report", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "GL Entry", + "report_name": "Gross and Net Profit Report", + "report_type": "Script Report", + "roles": [ + { + "role": "Accounts User" + }, + { + "role": "Accounts Manager" + }, + { + "role": "Auditor" + } + ] +} \ No newline at end of file diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py new file mode 100644 index 0000000000..6645dc3691 --- /dev/null +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -0,0 +1,163 @@ +# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.utils import flt +from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) +import copy +from pprint import pprint + + +def execute(filters=None): + period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, + filters.periodicity, filters.accumulated_values, filters.company) + + columns, data = [], [] + + income = get_data(filters.company, "Income", "Credit", period_list, filters = filters, + accumulated_values=filters.accumulated_values, + ignore_closing_entries=True, ignore_accumulated_values_for_fy= True, total= False) + + expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters, + accumulated_values=filters.accumulated_values, + ignore_closing_entries=True, ignore_accumulated_values_for_fy= True, total= False) + + columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company) + + data.append({"account_name": "'" + _("Included in Gross Profit") + "'", + "account": "'" + _("Included in Gross Profit") + "'"}) + + gross_income = get_revenue(income, period_list, 'gross') + data.append({}) + data.extend(gross_income or []) + + gross_expense = get_revenue(expense, period_list, 'gross') + data.append({}) + data.extend(gross_expense or []) + + data.append({}) + gross_profit = get_profit(gross_income, gross_expense, period_list, filters.company, 'Gross Profit',filters.presentation_currency) + data.append(gross_profit) + + non_gross_income = get_revenue(income, period_list, 'non_gross') + data.append({}) + data.extend(non_gross_income or []) + + non_gross_expense = get_revenue(expense, period_list, 'non_gross') + data.append({}) + data.extend(non_gross_expense or []) + + net_profit =get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, filters.company,filters.presentation_currency) + data.append({}) + data.append(net_profit) + + return columns, data + +def get_revenue(data, period_list, revenue_type): + + if revenue_type == 'gross': + gross = [item for item in data if item['include_in_gross']==1 or item['is_group']==1] + gross, status = remove_parent_with_no_child(gross, period_list) + while status == "data to be removed": + gross, status = remove_parent_with_no_child(gross, period_list) + gross = adjust_account(gross, period_list) + return copy.deepcopy(gross) + elif revenue_type == 'non_gross': + non_gross = [item for item in data if item['include_in_gross']==0 or item['is_group']==1] + non_gross, status = remove_parent_with_no_child(non_gross, period_list) + while status == "data to be removed": + non_gross, status = remove_parent_with_no_child(non_gross, period_list) + non_gross = adjust_account(non_gross, period_list) + return copy.deepcopy(non_gross) + +def remove_parent_with_no_child(data, period_list): + status = "nothing to remove" + for parent in data: + if 'is_group' in parent and parent["is_group"] == 1: + have_child = False + for child in data: + if 'parent_account' in child and child["parent_account"] == parent["account"]: + have_child = True + break + + if not have_child: + status = "data to be removed" + data.remove(parent) + + return data, status + +def adjust_account(data, period_list, consolidated= False): + leaf_nodes = [item for item in data if item['is_group'] == 0] + totals = {} + for node in leaf_nodes: + set_total(node, node["total"], data, totals) + for d in data: + for period in period_list: + key = period if consolidated else period.key + d[key] = totals[d["account"]] + d['total'] = totals[d["account"]] + return data + +def set_total(node, value, complete_list, totals): + if not totals.get(node['account']): + totals[node["account"]] = 0 + totals[node["account"]] += value + + parent = node['parent_account'] + if not parent == '': + return set_total(next(item for item in complete_list if item['account'] == parent), value, complete_list, totals) + + +def get_profit(gross_income, gross_expense, period_list, company, profit_type, currency=None, consolidated=False): + + total = 0 + + profit_loss = { + "account_name": "'" + _(profit_type) + "'", + "account": "'" + _(profit_type) + "'", + "warn_if_negative": True, + "currency": currency or frappe.get_cached_value('Company', company, "default_currency") + } + + has_value = False + + for period in period_list: + key = period if consolidated else period.key + profit_loss[key] = flt(gross_income[0][key]) - flt(gross_expense[0][key]) + + if profit_loss[key]: + has_value=True + + total += flt(profit_loss[key]) + profit_loss['total'] = total + + if has_value: + return profit_loss + +def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, company, currency=None, consolidated=False): + total = 0 + profit_loss = { + "account_name": "'" + _("Net Profit") + "'", + "account": "'" + _("Net Profit") + "'", + "warn_if_negative": True, + "currency": currency or frappe.get_cached_value('Company', company, "default_currency") + } + + has_value = False + + for period in period_list: + key = period if consolidated else period.key + total_income = flt(gross_income[0][key]) + flt(non_gross_income[0][key]) + total_expense = flt(gross_expense[0][key]) + flt(non_gross_expense[0][key]) + profit_loss[key] = flt(total_income) - flt(total_expense) + + if profit_loss[key]: + has_value=True + + total += flt(profit_loss[key]) + profit_loss['total'] = total + + if has_value: + return profit_loss From f70d4089bc3a1b99b79c5ec7d90b8533fe8e514a Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 11 Feb 2019 17:02:20 +0530 Subject: [PATCH 02/24] fix: codacy --- .../gross_and_net_profit_report/gross_and_net_profit_report.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index 6645dc3691..a5d6ec9974 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -7,7 +7,6 @@ from frappe import _ from frappe.utils import flt from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data) import copy -from pprint import pprint def execute(filters=None): From 4f0fd38209e3c1db85b98f2859ab7275b50e3a91 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 13 Feb 2019 16:46:05 +0530 Subject: [PATCH 03/24] refractor --- .../gross_and_net_profit_report.py | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index a5d6ec9974..9096c257ab 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -25,14 +25,23 @@ def execute(filters=None): columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company) + + gross_income = get_revenue(income, period_list, 'gross') + + gross_expense = get_revenue(expense, period_list, 'gross') + + if(len(gross_income)==0 and len(gross_expense)== 0): + data.append({"account_name": "'" + _("Nothing is included in gross") + "'", + "account": "'" + _("Nothing is included in gross") + "'"}) + + return columns, data + data.append({"account_name": "'" + _("Included in Gross Profit") + "'", "account": "'" + _("Included in Gross Profit") + "'"}) - gross_income = get_revenue(income, period_list, 'gross') data.append({}) data.extend(gross_income or []) - gross_expense = get_revenue(expense, period_list, 'gross') data.append({}) data.extend(gross_expense or []) @@ -48,7 +57,7 @@ def execute(filters=None): data.append({}) data.extend(non_gross_expense or []) - net_profit =get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, filters.company,filters.presentation_currency) + net_profit = get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, filters.company,filters.presentation_currency) data.append({}) data.append(net_profit) @@ -124,7 +133,7 @@ def get_profit(gross_income, gross_expense, period_list, company, profit_type, c for period in period_list: key = period if consolidated else period.key - profit_loss[key] = flt(gross_income[0][key]) - flt(gross_expense[0][key]) + profit_loss[key] = flt(gross_income[0][key] if len(gross_income) else 0) - flt(gross_expense[0][key] if len(gross_expense) else 0) if profit_loss[key]: has_value=True @@ -148,8 +157,8 @@ def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expe for period in period_list: key = period if consolidated else period.key - total_income = flt(gross_income[0][key]) + flt(non_gross_income[0][key]) - total_expense = flt(gross_expense[0][key]) + flt(non_gross_expense[0][key]) + total_income = flt(gross_income[0][key] if len(gross_income) else 0) + flt(non_gross_income[0][key] if len(non_gross_income) else 0) + total_expense = flt(gross_expense[0][key] if len(gross_expense) else 0) + flt(non_gross_expense[0][key] if len(non_gross_expense) else 0) profit_loss[key] = flt(total_income) - flt(total_expense) if profit_loss[key]: From 61f981ae05eeab7b53267a1a156869cfb5722d94 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 18 Feb 2019 11:43:32 +0530 Subject: [PATCH 04/24] Changes Requested --- .../gross_and_net_profit_report.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index 9096c257ab..fe767c0409 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -66,19 +66,14 @@ def execute(filters=None): def get_revenue(data, period_list, revenue_type): if revenue_type == 'gross': - gross = [item for item in data if item['include_in_gross']==1 or item['is_group']==1] - gross, status = remove_parent_with_no_child(gross, period_list) - while status == "data to be removed": - gross, status = remove_parent_with_no_child(gross, period_list) - gross = adjust_account(gross, period_list) - return copy.deepcopy(gross) + revenue = [item for item in data if item['include_in_gross']==1 or item['is_group']==1] elif revenue_type == 'non_gross': - non_gross = [item for item in data if item['include_in_gross']==0 or item['is_group']==1] - non_gross, status = remove_parent_with_no_child(non_gross, period_list) - while status == "data to be removed": - non_gross, status = remove_parent_with_no_child(non_gross, period_list) - non_gross = adjust_account(non_gross, period_list) - return copy.deepcopy(non_gross) + revenue = [item for item in data if item['include_in_gross']==0 or item['is_group']==1] + revenue, status = remove_parent_with_no_child(revenue, period_list) + while status == "data to be removed": + revenue, status = remove_parent_with_no_child(revenue, period_list) + revenue = adjust_account(revenue, period_list) + return copy.deepcopy(revenue) def remove_parent_with_no_child(data, period_list): status = "nothing to remove" From 42a106c7ba94f009f381b86d90281e200b033291 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 15 Feb 2019 16:09:20 +0530 Subject: [PATCH 05/24] Auditors print formats --- .../doctype/journal_entry/journal_entry.py | 7 ++ .../doctype/payment_entry/payment_entry.py | 8 ++ .../purchase_invoice/purchase_invoice.py | 8 ++ .../doctype/sales_invoice/sales_invoice.py | 7 ++ .../bank_and_cash_payment_voucher/__init__.py | 0 .../bank_and_cash_payment_voucher.html | 82 +++++++++++++++ .../bank_and_cash_payment_voucher.json | 22 +++++ .../journal_auditing_voucher/__init__.py | 0 .../journal_auditing_voucher.html | 76 ++++++++++++++ .../journal_auditing_voucher.json | 22 +++++ .../purchase_auditing_voucher/__init__.py | 0 .../purchase_auditing_voucher.html | 99 +++++++++++++++++++ .../purchase_auditing_voucher.json | 22 +++++ .../sales_auditing_voucher/__init__.py | 0 .../sales_auditing_voucher.html | 93 +++++++++++++++++ .../sales_auditing_voucher.json | 22 +++++ 16 files changed, 468 insertions(+) create mode 100644 erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py create mode 100644 erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html create mode 100644 erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json create mode 100644 erpnext/accounts/print_format/journal_auditing_voucher/__init__.py create mode 100644 erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html create mode 100644 erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json create mode 100644 erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py create mode 100644 erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html create mode 100644 erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json create mode 100644 erpnext/accounts/print_format/sales_auditing_voucher/__init__.py create mode 100644 erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html create mode 100644 erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 259172e448..9813ba4ef5 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -52,6 +52,13 @@ class JournalEntry(AccountsController): self.update_loan() self.update_inter_company_jv() + def before_print(self): + gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry", + "voucher_no": self.name} , + fields=["account", "party_type", "party", "debit", "credit", "remarks"] + ) + self.gl = gl_entries + def get_title(self): return self.pay_to_recd_from or self.accounts[0].account diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index f303301a33..6fc2e52981 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -70,6 +70,14 @@ class PaymentEntry(AccountsController): self.update_advance_paid() self.update_expense_claim() + def before_print(self): + gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry", + "voucher_no": self.name} , + fields=["account", "party_type", "party", "debit", "credit", "remarks"] + ) + print(gl_entries) + self.gl = gl_entries + def on_cancel(self): self.setup_party_account_field() self.make_gl_entries(cancel=1) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 0dd716df3f..1163d760f6 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -24,6 +24,7 @@ from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_ unlink_inter_company_invoice from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details from erpnext.accounts.deferred_revenue import validate_service_stop_date +from pprint import pprint form_grid_templates = { "items": "templates/form_grid/item_grid.html" @@ -53,6 +54,13 @@ class PurchaseInvoice(BuyingController): if not self.on_hold: self.release_date = '' + def before_print(self): + gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice", + "voucher_no": self.name} , + fields=["account", "party_type", "party", "debit", "credit"] + ) + self.gl = gl_entries + def invoice_is_blocked(self): return self.on_hold and (not self.release_date or self.release_date > getdate(nowdate())) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 895ca07da2..5e747b3523 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -205,6 +205,13 @@ class SalesInvoice(SellingController): def before_cancel(self): self.update_time_sheet(None) + def before_print(self): + gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice", + "voucher_no": self.name} , + fields=["account", "party_type", "party", "debit", "credit"] + ) + self.gl = gl_entries + def on_cancel(self): self.check_close_sales_order("sales_order") diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html new file mode 100644 index 0000000000..7b1a8a2a1c --- /dev/null +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -0,0 +1,82 @@ +{%- from "templates/print_formats/standard_macros.html" import add_header -%} + +
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading") + and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%} + {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} +
+
+ + +
Voucher No: {{ doc.name }}
+
+
+ + +
Date: {{ frappe.utils.formatdate(doc.creation) }}
+
+
+
+ + + + + + + + + + + {% set total_credit = 0 -%} + {% for entries in doc.gl %} + {% if entries.debit == 0.0 %} + + + + + + {% set total_credit = total_credit + entries.credit -%} + + + + + + + + + {% endif %} + {% endfor %} + + + + + + + {% set total_debit = 0 -%} + {% for entries in doc.gl %} + {% if entries.credit == 0.0 %} + + + + + {% set total_debit = total_debit + entries.debit -%} + + + + + + + + + + {% endif %} + {% endfor %} +
AccountParty TypePartyAmount
Credit
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.credit }}
Narration
{{ entries.remarks }}
Total (credit) {{total_credit}}
Debit
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.debit }}
Narration
{{ entries.remarks }}
Total (debit) {{total_debit}}
+
+
\ No newline at end of file diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json new file mode 100644 index 0000000000..e3afaec2ad --- /dev/null +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json @@ -0,0 +1,22 @@ +{ + "align_labels_right": 0, + "creation": "2019-02-15 11:49:08.608619", + "custom_format": 0, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Payment Entry", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "idx": 0, + "line_breaks": 0, + "modified": "2019-02-15 11:49:08.608619", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Bank and Cash Payment Voucher", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/__init__.py b/erpnext/accounts/print_format/journal_auditing_voucher/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html new file mode 100644 index 0000000000..cacb5f2a57 --- /dev/null +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -0,0 +1,76 @@ +{%- from "templates/print_formats/standard_macros.html" import add_header -%} + +
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading") + and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%} + {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} +
+
+ + +
Voucher No: {{ doc.name }}
+
+
+ + +
Date: {{ frappe.utils.formatdate(doc.creation) }}
+
+
+
+ + + + + + + + + + + {% set total_credit = 0 -%} + {% for entries in doc.gl %} + {% if entries.debit == 0.0 %} + + + + + + {% set total_credit = total_credit + entries.credit -%} + + + + + + {% endif %} + {% endfor %} + + + + + + + {% set total_debit = 0 -%} + {% for entries in doc.gl %} + {% if entries.credit == 0.0 %} + + + + + {% set total_debit = total_debit + entries.debit -%} + + + + + + + {% endif %} + {% endfor %} +
AccountParty TypePartyAmount
Credit
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.credit }}
Total (credit) {{total_credit}}
Debit
{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.debit }}
Total (debit) {{total_debit}}
+
+
\ No newline at end of file diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json new file mode 100644 index 0000000000..927e818e01 --- /dev/null +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json @@ -0,0 +1,22 @@ +{ + "align_labels_right": 0, + "creation": "2019-02-15 14:13:05.721784", + "custom_format": 0, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Journal Entry", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "idx": 0, + "line_breaks": 0, + "modified": "2019-02-15 14:13:05.721784", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Journal Auditing Voucher", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py b/erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html new file mode 100644 index 0000000000..c8bd5c21ec --- /dev/null +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -0,0 +1,99 @@ +{%- from "templates/print_formats/standard_macros.html" import add_header -%} +
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading") + and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%} + {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} +
+
+ + + + + + +
Supplier Name: {{ doc.supplier }}
Due Date: {{ frappe.utils.formatdate(doc.due_date) }}
Address: {{doc.address_display}}
Contact: {{doc.contact_display}}
Mobile no: {{doc.contact_mobile}}
+
+
+ + + +
Voucher No: {{ doc.name }}
Date: {{ frappe.utils.formatdate(doc.creation) }}
+
+
+
+ + + + + + + + + + + + + {% for item in doc.items %} + + + + + + + + + + + + {% endfor %} +
SLItem CodeItem NameUOMReceived Qty.Rejected QtyQtyBasic RateAmount
{{ loop.index }}{{ item.item_code }}{{ item.item_name }}{{ item.uom }}{{ item.received_qty }}{{ item.rejected_qty }}{{ item.qty}}{{ item.rate }}{{ item.amount }}
+
+
+
+ + + + +
Total Quantity: {{ doc.total_qty }}
Total: {{doc.total}}
Net Weight: {{ doc.total_net_weight }}
+
+
+ + + {% for tax in doc.taxes %} + + {% endfor %} + + + + +
Tax and Charges: {{doc.taxes_and_charges}}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
Taxes and Charges Added: {{ doc.taxes_and_charges_added }}
Taxes and Charges Deducted: {{ doc.taxes_and_charges_deducted }}
Total Taxes and Charges: {{ doc.total_taxes_and_charges }}
Net Payable: {{ doc.grand_total }}
+
+
+
+ + + + + + + + + + {% for entries in doc.gl %} + + + + + + + + + {% endfor %} + + + + + +
SLAccountParty TypePartyCredit AmountDebit Amount
{{ loop.index }}{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.credit }}{{ entries.debit }}
Total{{ doc.grand_total|flt }}{{ doc.grand_total|flt }}
+
+
\ No newline at end of file diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json new file mode 100644 index 0000000000..73779d49aa --- /dev/null +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json @@ -0,0 +1,22 @@ +{ + "align_labels_right": 0, + "creation": "2019-02-14 14:42:35.151611", + "custom_format": 0, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Purchase Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "idx": 0, + "line_breaks": 0, + "modified": "2019-02-14 14:42:35.151611", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Purchase Auditing Voucher", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/__init__.py b/erpnext/accounts/print_format/sales_auditing_voucher/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html new file mode 100644 index 0000000000..b3ce888fa5 --- /dev/null +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -0,0 +1,93 @@ +{%- from "templates/print_formats/standard_macros.html" import add_header -%} +
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading") + and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%} + {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }} +
+
+ + + + + + +
Customer Name: {{ doc.customer }}
Due Date: {{ frappe.utils.formatdate(doc.due_date) }}
Address: {{doc.address_display}}
Contact: {{doc.contact_display}}
Mobile no: {{doc.contact_mobile}}
+
+
+ + + +
Voucher No: {{ doc.name }}
Date: {{ frappe.utils.formatdate(doc.creation) }}
+
+
+
+ + + + + + + + + + + {% for item in doc.items %} + + + + + + + + + + {% endfor %} +
SLItem CodeItem NameUOMQuantityBasic RateAmount
{{ loop.index }}{{ item.item_code }}{{ item.item_name }}{{ item.uom }}{{ item.qty}}{{ item.rate }}{{ item.amount }}
+
+
+
+ + + + +
Total Quantity: {{ doc.total_qty }}
Total: {{doc.total}}
Net Weight: {{ doc.total_net_weight }}
+
+
+ + + {% for tax in doc.taxes %} + + {% endfor %} + + +
Tax and Charges: {{doc.taxes_and_charges}}
{{ tax.account_head }}: {{ tax.tax_amount_after_discount_amount }}
Total Taxes and Charges: {{ doc.total_taxes_and_charges }}
Net Payable: {{ doc.grand_total }}
+
+
+
+ + + + + + + + + + {% for entries in doc.gl %} + + + + + + + + + {% endfor %} + + + + + +
SLAccountParty TypePartyCredit AmountDebit Amount
{{ loop.index }}{{ entries.account }}{{ entries.party_type }}{{ entries.party }}{{ entries.credit }}{{ entries.debit }}
Total{{ doc.grand_total|flt }}{{ doc.grand_total|flt }}
+
+
\ No newline at end of file diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json new file mode 100644 index 0000000000..0544e0bc9e --- /dev/null +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json @@ -0,0 +1,22 @@ +{ + "align_labels_right": 0, + "creation": "2019-02-15 15:02:51.454754", + "custom_format": 0, + "default_print_language": "en", + "disabled": 0, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype": "Print Format", + "font": "Default", + "idx": 0, + "line_breaks": 0, + "modified": "2019-02-15 15:02:51.454754", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Sales Auditing Voucher", + "owner": "Administrator", + "print_format_builder": 0, + "print_format_type": "Server", + "show_section_headings": 0, + "standard": "Yes" +} \ No newline at end of file From 879e5fd8bbfa8ee331a3603241077cf1c63207b7 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 18 Feb 2019 14:43:55 +0530 Subject: [PATCH 06/24] remove print and codacy --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 1 - erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 1 - 2 files changed, 2 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 6fc2e52981..ef4cd3d31d 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -75,7 +75,6 @@ class PaymentEntry(AccountsController): "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit", "remarks"] ) - print(gl_entries) self.gl = gl_entries def on_cancel(self): diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 1163d760f6..9ac532dd69 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -24,7 +24,6 @@ from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_ unlink_inter_company_invoice from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details from erpnext.accounts.deferred_revenue import validate_service_stop_date -from pprint import pprint form_grid_templates = { "items": "templates/form_grid/item_grid.html" From a9a1552e328e0c4155d72b8e4ff665d116c7a3d4 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 27 Feb 2019 14:10:24 +0530 Subject: [PATCH 07/24] refactor --- .../gross_and_net_profit_report/gross_and_net_profit_report.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index fe767c0409..739c4f0051 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -69,6 +69,7 @@ def get_revenue(data, period_list, revenue_type): revenue = [item for item in data if item['include_in_gross']==1 or item['is_group']==1] elif revenue_type == 'non_gross': revenue = [item for item in data if item['include_in_gross']==0 or item['is_group']==1] + revenue, status = remove_parent_with_no_child(revenue, period_list) while status == "data to be removed": revenue, status = remove_parent_with_no_child(revenue, period_list) From ab4ff984c4a8e19cc5173b36e9eff56c2ef91373 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 28 Feb 2019 13:21:28 +0530 Subject: [PATCH 08/24] fix: scan barcode not adding the barcode value in the items table --- erpnext/public/js/controllers/transaction.js | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index cf62af7b70..168a727f27 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -314,14 +314,21 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ show_description(row_to_modify.idx, row_to_modify.item_code); + this.frm.from_barcode = true; frappe.model.set_value(row_to_modify.doctype, row_to_modify.name, { item_code: data.item_code, qty: (row_to_modify.qty || 0) + 1 }); - this.frm.refresh_field('items'); + ['serial_no', 'batch_no', 'barcode'].forEach(field => { + if (data[field] && frappe.meta.has_field(row_to_modify.doctype, field)) { + frappe.model.set_value(row_to_modify.doctype, + row_to_modify.name, field, data[field]); + } + }); + + scan_barcode_field.set_value(''); }); - scan_barcode_field.set_value(''); } return false; }, @@ -384,10 +391,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ // barcode cleared, remove item d.item_code = ""; } - this.item_code(doc, cdt, cdn, true); + + this.frm.from_barcode = true; + this.item_code(doc, cdt, cdn); }, - item_code: function(doc, cdt, cdn, from_barcode) { + item_code: function(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); var update_stock = 0, show_batch_dialog = 0; @@ -400,9 +409,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ show_batch_dialog = 1; } // clear barcode if setting item (else barcode will take priority) - if(!from_barcode) { + if(!this.frm.from_barcode) { item.barcode = null; } + + this.frm.from_barcode = false; if(item.item_code || item.barcode || item.serial_no) { if(!this.validate_company_and_party()) { this.frm.fields_dict["items"].grid.grid_rows[item.idx - 1].remove(); From 4ef924d0ba5e7c0cc990c9b9df603fa58fbf4bc0 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 1 Mar 2019 16:24:54 +0530 Subject: [PATCH 09/24] fix: on save state code field become blank --- erpnext/regional/italy/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py index 30280e20ad..f39b144cdc 100644 --- a/erpnext/regional/italy/utils.py +++ b/erpnext/regional/italy/utils.py @@ -343,4 +343,7 @@ def set_state_code(doc, method): return state_codes_lower = {key.lower():value for key,value in state_codes.items()} - doc.state_code = state_codes_lower.get(doc.get('state','').lower()) + + state = doc.get('state','').lower() + if state_codes_lower.get(state): + doc.state_code = state_codes_lower.get(state) From c2090939d74b5b3b52df70a8190550448315e25b Mon Sep 17 00:00:00 2001 From: Jay Parikh Date: Sat, 2 Mar 2019 12:19:32 +0000 Subject: [PATCH 10/24] Fix Sales Invoice Return Validation "validate_pos" --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 4cf3a1acf5..10a9dc6da5 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -523,8 +523,8 @@ class SalesInvoice(SellingController): def validate_pos(self): if self.is_return: - if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) < \ - 1/(10**(self.precision("grand_total") + 1)): + if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) > \ + 1.0/(10.0**(self.precision("grand_total") + 1.0)): frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total")) def validate_item_code(self): From 2bfb063fdb9ee4576b2285dd49ccd4c85d6b0bd5 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Sat, 2 Mar 2019 21:47:55 +0530 Subject: [PATCH 11/24] fix(sales order item): not able to search item by description --- erpnext/controllers/queries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 4c16323ca3..f8f1e54459 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -172,8 +172,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals or tabItem.item_code LIKE %(txt)s or tabItem.item_group LIKE %(txt)s or tabItem.item_name LIKE %(txt)s - or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s - {description_cond})) + or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s) + {description_cond}) {fcond} {mcond} order by if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), From f3bdeedc686e25e7b43913fa271e7dc42bbd3b6c Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 4 Mar 2019 12:27:41 +0530 Subject: [PATCH 12/24] minor fixes --- .../gross_and_net_profit_report.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index 739c4f0051..a0432dbef3 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -79,10 +79,10 @@ def get_revenue(data, period_list, revenue_type): def remove_parent_with_no_child(data, period_list): status = "nothing to remove" for parent in data: - if 'is_group' in parent and parent["is_group"] == 1: + if 'is_group' in parent and parent.get("is_group") == 1: have_child = False for child in data: - if 'parent_account' in child and child["parent_account"] == parent["account"]: + if 'parent_account' in child and child.get("parent_account") == parent.get("account"): have_child = True break @@ -116,8 +116,6 @@ def set_total(node, value, complete_list, totals): def get_profit(gross_income, gross_expense, period_list, company, profit_type, currency=None, consolidated=False): - total = 0 - profit_loss = { "account_name": "'" + _(profit_type) + "'", "account": "'" + _(profit_type) + "'", @@ -134,14 +132,10 @@ def get_profit(gross_income, gross_expense, period_list, company, profit_type, c if profit_loss[key]: has_value=True - total += flt(profit_loss[key]) - profit_loss['total'] = total - if has_value: return profit_loss def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, company, currency=None, consolidated=False): - total = 0 profit_loss = { "account_name": "'" + _("Net Profit") + "'", "account": "'" + _("Net Profit") + "'", @@ -160,8 +154,5 @@ def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expe if profit_loss[key]: has_value=True - total += flt(profit_loss[key]) - profit_loss['total'] = total - if has_value: return profit_loss From 1e4e61bd948463caac12f302a0896753421f6517 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 4 Mar 2019 12:36:51 +0530 Subject: [PATCH 13/24] Minor fixes --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 +-- erpnext/accounts/doctype/payment_entry/payment_entry.py | 3 +-- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 3 +-- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 9813ba4ef5..27c946ddc1 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -53,11 +53,10 @@ class JournalEntry(AccountsController): self.update_inter_company_jv() def before_print(self): - gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry", + self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit", "remarks"] ) - self.gl = gl_entries def get_title(self): return self.pay_to_recd_from or self.accounts[0].account diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index ef4cd3d31d..00ffd17234 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -71,11 +71,10 @@ class PaymentEntry(AccountsController): self.update_expense_claim() def before_print(self): - gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry", + self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit", "remarks"] ) - self.gl = gl_entries def on_cancel(self): self.setup_party_account_field() diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9ac532dd69..cbade186ad 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -54,11 +54,10 @@ class PurchaseInvoice(BuyingController): self.release_date = '' def before_print(self): - gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice", + self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit"] ) - self.gl = gl_entries def invoice_is_blocked(self): return self.on_hold and (not self.release_date or self.release_date > getdate(nowdate())) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 5e747b3523..5bc127239a 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -206,11 +206,10 @@ class SalesInvoice(SellingController): self.update_time_sheet(None) def before_print(self): - gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice", + self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit"] ) - self.gl = gl_entries def on_cancel(self): self.check_close_sales_order("sales_order") From e1f72cc010def067a2caf83939621129b01ff77e Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 4 Mar 2019 12:49:39 +0530 Subject: [PATCH 14/24] revert: Address and contact report fix (#16786) Reverts #16674 Address and other info are not visible in address and contact report ![screenshot 2019-02-27 at 11 31 38 am](https://user-images.githubusercontent.com/42651287/53469309-6029f500-3a83-11e9-9672-e5e7d14dc470.png) --- .../report/address_and_contacts/address_and_contacts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/selling/report/address_and_contacts/address_and_contacts.py b/erpnext/selling/report/address_and_contacts/address_and_contacts.py index eb242d0a73..a9e43034b4 100644 --- a/erpnext/selling/report/address_and_contacts/address_and_contacts.py +++ b/erpnext/selling/report/address_and_contacts/address_and_contacts.py @@ -102,8 +102,7 @@ def get_party_details(party_type, party_list, doctype, party_details): records = frappe.get_list(doctype, filters=filters, fields=fields, as_list=True) for d in records: details = party_details.get(d[0]) - if details: - details.setdefault(frappe.scrub(doctype), []).append(d[1:]) + details.setdefault(frappe.scrub(doctype), []).append(d[1:]) return party_details From 40743840b7a85da4f8966703eed981b2c82a4aad Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 4 Mar 2019 12:53:11 +0530 Subject: [PATCH 15/24] fix: Print letter head only if checked in Print Settings (#16789) Letter head is printed in financial statements even if option is not checked ![letter head option](https://user-images.githubusercontent.com/42651287/53430759-26baa080-3a15-11e9-948a-bc95700a18d2.png) --- erpnext/accounts/report/financial_statements.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html index 4b3b5f2d53..449fb845d7 100644 --- a/erpnext/accounts/report/financial_statements.html +++ b/erpnext/accounts/report/financial_statements.html @@ -15,7 +15,7 @@ height: 37px; } -{% var letterhead= filters.letter_head || (frappe.get_doc(":Company", filters.company) && frappe.get_doc(":Company", filters.company).default_letter_head) || frappe.defaults.get_default("letter_head"); %} +{% var letterhead= filters.letter_head || (frappe.get_doc(":Company", filters.company) && frappe.get_doc(":Company", filters.company).default_letter_head) %} {% if(letterhead) { %}
{%= frappe.boot.letter_heads[letterhead].header %} From 44ff41188d85e9a7dd50e96329496cca42707576 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 4 Mar 2019 12:56:27 +0530 Subject: [PATCH 16/24] fix: Selling and buying amount precision fix (#16764) --- .../report/gross_profit/gross_profit.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 67105e58de..073516fb88 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -6,7 +6,7 @@ import frappe from frappe import _, scrub from erpnext.stock.utils import get_incoming_rate from erpnext.controllers.queries import get_match_cond -from frappe.utils import flt +from frappe.utils import flt, cint def execute(filters=None): @@ -106,11 +106,14 @@ class GrossProfitGenerator(object): self.grouped = {} self.grouped_data = [] + self.currency_precision = cint(frappe.db.get_default("currency_precision")) or 3 + self.float_precision = cint(frappe.db.get_default("float_precision")) or 2 + for row in self.si_list: if self.skip_row(row, self.product_bundles): continue - row.base_amount = flt(row.base_net_amount) + row.base_amount = flt(row.base_net_amount, self.currency_precision) product_bundles = [] if row.update_stock: @@ -129,15 +132,15 @@ class GrossProfitGenerator(object): # get buying rate if row.qty: - row.buying_rate = row.buying_amount / row.qty - row.base_rate = row.base_amount / row.qty + row.buying_rate = flt(row.buying_amount / row.qty, self.float_precision) + row.base_rate = flt(row.base_amount / row.qty, self.float_precision) else: row.buying_rate, row.base_rate = 0.0, 0.0 # calculate gross profit - row.gross_profit = flt(row.base_amount - row.buying_amount, 3) + row.gross_profit = flt(row.base_amount - row.buying_amount, self.currency_precision) if row.base_amount: - row.gross_profit_percent = flt((row.gross_profit / row.base_amount) * 100.0, 3) + row.gross_profit_percent = flt((row.gross_profit / row.base_amount) * 100.0, self.currency_precision) else: row.gross_profit_percent = 0.0 @@ -156,8 +159,8 @@ class GrossProfitGenerator(object): new_row = row else: new_row.qty += row.qty - new_row.buying_amount += row.buying_amount - new_row.base_amount += row.base_amount + new_row.buying_amount += flt(row.buying_amount, self.currency_precision) + new_row.base_amount += flt(row.base_amount, self.currency_precision) new_row = self.set_average_rate(new_row) self.grouped_data.append(new_row) else: @@ -167,18 +170,19 @@ class GrossProfitGenerator(object): returned_item_rows = self.returned_invoices[row.parent][row.item_code] for returned_item_row in returned_item_rows: row.qty += returned_item_row.qty - row.base_amount += returned_item_row.base_amount - row.buying_amount = row.qty * row.buying_rate + row.base_amount += flt(returned_item_row.base_amount, self.currency_precision) + row.buying_amount = flt(row.qty * row.buying_rate, self.currency_precision) if row.qty or row.base_amount: row = self.set_average_rate(row) self.grouped_data.append(row) def set_average_rate(self, new_row): - new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount,3) - new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0),3) \ + new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount, self.currency_precision) + new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0), self.currency_precision) \ if new_row.base_amount else 0 - new_row.buying_rate = (new_row.buying_amount / new_row.qty) if new_row.qty else 0 - new_row.base_rate = (new_row.base_amount / new_row.qty) if new_row.qty else 0 + new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0 + new_row.base_rate = flt(new_row.base_amount / new_row.qty, self.float_precision) if new_row.qty else 0 + return new_row def get_returned_invoice_items(self): From 9842ce5a795808a63d2cb232bbba385a74df5e99 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 4 Mar 2019 13:39:52 +0530 Subject: [PATCH 17/24] fix: HSN code not disaplying for the GST Purchase Invoice print format --- .../gst_purchase_invoice/gst_purchase_invoice.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json index 2b7f9ce757..6d7c3d31ae 100644 --- a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json +++ b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json @@ -7,10 +7,10 @@ "docstatus": 0, "doctype": "Print Format", "font": "Default", - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\t\\t\\t\\t

Purchase Invoice
{{ doc.name }}\\t\\t\\t\\t

\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\"}, {\"print_hide\": 0, \"fieldname\": \"due_date\", \"label\": \"Due Date\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"address_display\", \"label\": \"Address\"}, {\"print_hide\": 0, \"fieldname\": \"contact_display\", \"label\": \"Contact\"}, {\"print_hide\": 0, \"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"item_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"image\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"received_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"discount_percentage\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"pricing_rule\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_per_unit\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total_weight\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"asset\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"items\", \"label\": \"Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"label\": \"Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"category\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"add_deduct_tax\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"charge_type\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"row_id\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"included_in_print_rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"account_head\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"cost_center\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"tax_amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"taxes\", \"label\": \"Purchase Taxes and Charges\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"grand_total\", \"label\": \"Grand Total\"}, {\"print_hide\": 0, \"fieldname\": \"in_words\", \"label\": \"In Words\"}, {\"print_hide\": 0, \"fieldname\": \"disable_rounded_total\", \"label\": \"Disable Rounded Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payments\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"cash_bank_account\", \"label\": \"Cash/Bank Account\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"other_charges_calculation\", \"align\": \"left\", \"label\": \"Tax Breakup\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Raw\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"main_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rm_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"required_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"consumed_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"stock_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"conversion_factor\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"current_stock\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"reference_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom_detail_no\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"supplied_items\", \"label\": \"Supplied Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"terms\", \"label\": \"Terms and Conditions1\"}]", + "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\t\\t\\t\\t

Purchase Invoice
{{ doc.name }}\\t\\t\\t\\t

\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\"}, {\"print_hide\": 0, \"fieldname\": \"due_date\", \"label\": \"Due Date\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"address_display\", \"label\": \"Address\"}, {\"print_hide\": 0, \"fieldname\": \"contact_display\", \"label\": \"Contact\"}, {\"print_hide\": 0, \"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"item_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"image\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"received_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"discount_percentage\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"pricing_rule\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_per_unit\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total_weight\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"asset\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"gst_hsn_code\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"items\", \"label\": \"Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"label\": \"Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"category\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"add_deduct_tax\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"charge_type\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"row_id\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"included_in_print_rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"account_head\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"cost_center\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"tax_amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"taxes\", \"label\": \"Purchase Taxes and Charges\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"grand_total\", \"label\": \"Grand Total\"}, {\"print_hide\": 0, \"fieldname\": \"in_words\", \"label\": \"In Words\"}, {\"print_hide\": 0, \"fieldname\": \"disable_rounded_total\", \"label\": \"Disable Rounded Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payments\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"cash_bank_account\", \"label\": \"Cash/Bank Account\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"other_charges_calculation\", \"align\": \"left\", \"label\": \"Tax Breakup\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Raw\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"main_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rm_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"required_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"consumed_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"stock_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"conversion_factor\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"current_stock\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"reference_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom_detail_no\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"supplied_items\", \"label\": \"Supplied Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"terms\", \"label\": \"Terms and Conditions1\"}]", "idx": 0, "line_breaks": 0, - "modified": "2018-04-07 13:06:08.060353", + "modified": "2019-03-04 13:38:47.362002", "modified_by": "Administrator", "module": "Accounts", "name": "GST Purchase Invoice", From 02138b6bfc1fcd02b79d8a9344e68cda1507caa3 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 4 Mar 2019 14:46:28 +0530 Subject: [PATCH 18/24] fix: gross depends upon now report type --- erpnext/accounts/doctype/account/account.json | 4 +-- .../gross_and_net_profit_report.py | 34 ++++++++----------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json index 876a3922c9..460c025b69 100644 --- a/erpnext/accounts/doctype/account/account.json +++ b/erpnext/accounts/doctype/account/account.json @@ -640,7 +640,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:(((doc.account_type==\"Income Account\") || (doc.account_type==\"Expense Account\")) && (doc.is_group != 1))", + "depends_on": "eval:(doc.report_type == 'Profit and Loss' && !doc.is_group)", "fieldname": "include_in_gross", "fieldtype": "Check", "hidden": 0, @@ -678,7 +678,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-02-08 11:30:46.790603", + "modified": "2019-03-04 14:42:07.208893", "modified_by": "Administrator", "module": "Accounts", "name": "Account", diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py index a0432dbef3..6550981a14 100644 --- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py +++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py @@ -26,9 +26,9 @@ def execute(filters=None): columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company) - gross_income = get_revenue(income, period_list, 'gross') + gross_income = get_revenue(income, period_list) - gross_expense = get_revenue(expense, period_list, 'gross') + gross_expense = get_revenue(expense, period_list) if(len(gross_income)==0 and len(gross_expense)== 0): data.append({"account_name": "'" + _("Nothing is included in gross") + "'", @@ -49,11 +49,11 @@ def execute(filters=None): gross_profit = get_profit(gross_income, gross_expense, period_list, filters.company, 'Gross Profit',filters.presentation_currency) data.append(gross_profit) - non_gross_income = get_revenue(income, period_list, 'non_gross') + non_gross_income = get_revenue(income, period_list, 0) data.append({}) data.extend(non_gross_income or []) - non_gross_expense = get_revenue(expense, period_list, 'non_gross') + non_gross_expense = get_revenue(expense, period_list, 0) data.append({}) data.extend(non_gross_expense or []) @@ -63,21 +63,17 @@ def execute(filters=None): return columns, data -def get_revenue(data, period_list, revenue_type): +def get_revenue(data, period_list, include_in_gross=1): + revenue = [item for item in data if item['include_in_gross']==include_in_gross or item['is_group']==1] - if revenue_type == 'gross': - revenue = [item for item in data if item['include_in_gross']==1 or item['is_group']==1] - elif revenue_type == 'non_gross': - revenue = [item for item in data if item['include_in_gross']==0 or item['is_group']==1] - - revenue, status = remove_parent_with_no_child(revenue, period_list) - while status == "data to be removed": - revenue, status = remove_parent_with_no_child(revenue, period_list) + data_to_be_removed =True + while data_to_be_removed: + revenue, data_to_be_removed = remove_parent_with_no_child(revenue, period_list) revenue = adjust_account(revenue, period_list) return copy.deepcopy(revenue) def remove_parent_with_no_child(data, period_list): - status = "nothing to remove" + data_to_be_removed = False for parent in data: if 'is_group' in parent and parent.get("is_group") == 1: have_child = False @@ -87,10 +83,10 @@ def remove_parent_with_no_child(data, period_list): break if not have_child: - status = "data to be removed" + data_to_be_removed = True data.remove(parent) - return data, status + return data, data_to_be_removed def adjust_account(data, period_list, consolidated= False): leaf_nodes = [item for item in data if item['is_group'] == 0] @@ -127,7 +123,7 @@ def get_profit(gross_income, gross_expense, period_list, company, profit_type, c for period in period_list: key = period if consolidated else period.key - profit_loss[key] = flt(gross_income[0][key] if len(gross_income) else 0) - flt(gross_expense[0][key] if len(gross_expense) else 0) + profit_loss[key] = flt(gross_income[0].get(key, 0)) - flt(gross_expense[0].get(key, 0)) if profit_loss[key]: has_value=True @@ -147,8 +143,8 @@ def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expe for period in period_list: key = period if consolidated else period.key - total_income = flt(gross_income[0][key] if len(gross_income) else 0) + flt(non_gross_income[0][key] if len(non_gross_income) else 0) - total_expense = flt(gross_expense[0][key] if len(gross_expense) else 0) + flt(non_gross_expense[0][key] if len(non_gross_expense) else 0) + total_income = flt(gross_income[0].get(key, 0)) + flt(non_gross_income[0].get(key, 0)) + total_expense = flt(gross_expense[0].get(key, 0)) + flt(non_gross_expense[0].get(key, 0)) profit_loss[key] = flt(total_income) - flt(total_expense) if profit_loss[key]: From 0c9945e0bf97bf8802bb458dc183c0797f048325 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 4 Mar 2019 16:14:53 +0530 Subject: [PATCH 19/24] Minor fixes --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 2 +- erpnext/accounts/doctype/payment_entry/payment_entry.py | 2 +- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 +- .../bank_and_cash_payment_voucher.html | 4 ++-- .../journal_auditing_voucher/journal_auditing_voucher.html | 4 ++-- .../purchase_auditing_voucher/purchase_auditing_voucher.html | 2 +- .../sales_auditing_voucher/sales_auditing_voucher.html | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 27c946ddc1..7c48b5c4f8 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -53,7 +53,7 @@ class JournalEntry(AccountsController): self.update_inter_company_jv() def before_print(self): - self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry", + self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit", "remarks"] ) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 00ffd17234..2f56a51a73 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -71,7 +71,7 @@ class PaymentEntry(AccountsController): self.update_expense_claim() def before_print(self): - self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry", + self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit", "remarks"] ) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index cbade186ad..c3978d78db 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -54,7 +54,7 @@ class PurchaseInvoice(BuyingController): self.release_date = '' def before_print(self): - self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice", + self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit"] ) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 5bc127239a..6eea8ad764 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -206,7 +206,7 @@ class SalesInvoice(SellingController): self.update_time_sheet(None) def before_print(self): - self.gl = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice", + self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice", "voucher_no": self.name} , fields=["account", "party_type", "party", "debit", "credit"] ) diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html index 7b1a8a2a1c..2eadb2a92a 100644 --- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html +++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html @@ -34,7 +34,7 @@ Credit {% set total_credit = 0 -%} - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {% if entries.debit == 0.0 %} {{ entries.account }} @@ -59,7 +59,7 @@ Debit {% set total_debit = 0 -%} - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {% if entries.credit == 0.0 %} {{ entries.account }} diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html index cacb5f2a57..4565559084 100644 --- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html +++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html @@ -34,7 +34,7 @@ Credit {% set total_credit = 0 -%} - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {% if entries.debit == 0.0 %} {{ entries.account }} @@ -56,7 +56,7 @@ Debit {% set total_debit = 0 -%} - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {% if entries.credit == 0.0 %} {{ entries.account }} diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html index c8bd5c21ec..35852e1e1c 100644 --- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html +++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html @@ -79,7 +79,7 @@ Credit Amount Debit Amount - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {{ loop.index }} {{ entries.account }} diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html index b3ce888fa5..04de83de70 100644 --- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html +++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html @@ -73,7 +73,7 @@ Credit Amount Debit Amount - {% for entries in doc.gl %} + {% for entries in doc.gl_entries %} {{ loop.index }} {{ entries.account }} From acb7238ad69a178dbf26d84af89f343590e6d432 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Tue, 5 Mar 2019 12:20:19 +0530 Subject: [PATCH 20/24] Allow zero amount in additional salary --- erpnext/hr/doctype/additional_salary/additional_salary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py index 6f87954f50..e25e69e75f 100644 --- a/erpnext/hr/doctype/additional_salary/additional_salary.py +++ b/erpnext/hr/doctype/additional_salary/additional_salary.py @@ -11,8 +11,8 @@ from frappe.utils import getdate, date_diff class AdditionalSalary(Document): def validate(self): self.validate_dates() - if self.amount <= 0: - frappe.throw(_("Amount should be greater than zero.")) + if self.amount < 0: + frappe.throw(_("Amount should not be less than zero.")) def validate_dates(self): date_of_joining, relieving_date = frappe.db.get_value("Employee", self.employee, From 29c46bb311dbacd71a7f7875ceff47eda8060c12 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 6 Mar 2019 14:42:50 +0530 Subject: [PATCH 21/24] fix(sales_order.py): handle zero bundle qty --- erpnext/manufacturing/doctype/work_order/work_order.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 9873efa124..947d6931e2 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -282,6 +282,10 @@ class WorkOrder(Document): total_bundle_qty = frappe.db.sql(""" select sum(qty) from `tabProduct Bundle Item` where parent = %s""", (frappe.db.escape(self.product_bundle_item)))[0][0] + if not total_bundle_qty: + # product bundle is 0 (product bundle allows 0 qty for items) + total_bundle_qty = 1 + cond = "product_bundle_item = %s" if self.product_bundle_item else "production_item = %s" qty = frappe.db.sql(""" select sum(qty) from From db8500c03af758f7640e78580efcaa66bc2fedd4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 6 Mar 2019 18:18:21 +0530 Subject: [PATCH 22/24] POS profile, account for change amount must be cash or bank account --- erpnext/accounts/doctype/pos_profile/pos_profile.js | 8 ++++++++ .../accounts/doctype/sales_invoice/sales_invoice.js | 8 ++++++++ .../sales_invoice_payment/sales_invoice_payment.json | 12 ++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js index 13d53d1f6a..a6386ddc4b 100755 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.js +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js @@ -33,6 +33,14 @@ frappe.ui.form.on('POS Profile', { }; }); + frm.set_query("account_for_change_amount", function() { + return { + filters: { + account_type: ['in', ["Cash", "Bank"]] + } + }; + }); + frm.set_query("print_format", function() { return { filters: { doc_type: "Sales Invoice", print_format_type: "Js"} }; }); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index b1a851a4f1..3816632065 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -556,6 +556,14 @@ frappe.ui.form.on('Sales Invoice', { frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion'); frm.add_fetch('payment_term', 'description', 'description'); + frm.set_query("account_for_change_amount", function() { + return { + filters: { + account_type: ['in', ["Cash", "Bank"]] + } + }; + }); + frm.custom_make_buttons = { 'Delivery Note': 'Delivery', 'Sales Invoice': 'Sales Return', diff --git a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json index ccdabfe544..1c5962acf6 100644 --- a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json +++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json @@ -20,6 +20,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:parent.doctype == 'POS Profile'", + "fetch_if_empty": 0, "fieldname": "default", "fieldtype": "Check", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "mode_of_payment", "fieldtype": "Link", "hidden": 0, @@ -85,8 +87,9 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "", + "default": "0", "depends_on": "eval:parent.doctype == 'Sales Invoice'", + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -120,6 +123,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", "hidden": 0, @@ -151,6 +155,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "account", "fieldtype": "Link", "hidden": 0, @@ -185,6 +190,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "mode_of_payment.type", + "fetch_if_empty": 0, "fieldname": "type", "fieldtype": "Read Only", "hidden": 0, @@ -218,6 +224,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_amount", "fieldtype": "Currency", "hidden": 0, @@ -251,6 +258,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "clearance_date", "fieldtype": "Date", "hidden": 0, @@ -287,7 +295,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 15:03:59.720469", + "modified": "2019-03-06 15:58:37.839241", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Payment", From 9ec4816b3248abdad16a95345629d2d2bae1a08a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Mar 2019 10:44:13 +0530 Subject: [PATCH 23/24] Update item_barcode_childtable_migrate.py --- erpnext/patches/v10_0/item_barcode_childtable_migrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py index bc6005677d..e30e0a74c0 100644 --- a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py +++ b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py @@ -27,5 +27,5 @@ def execute(): 'parent': item.name, 'parentfield': 'barcodes' }).insert() - except frappe.DuplicateEntryError: + except (frappe.DuplicateEntryError, frappe.UniqueValidationError): continue From 34062291529aee4c26d9c3664f714a32647079f2 Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Fri, 8 Mar 2019 09:39:32 +0000 Subject: [PATCH 24/24] bumped to version 11.1.14 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index d0ae9c4fc9..4870b194e7 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.13' +__version__ = '11.1.14' def get_default_company(user=None): '''Get default company for user'''