diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index a2e1a4a1612..1c5bea6cf15 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -452,6 +452,8 @@ class PaymentEntry(AccountsController):
frappe.throw(_("Reference No and Reference Date is mandatory for Bank transaction"))
def set_remarks(self):
+ if self.remarks: return
+
if self.payment_type=="Internal Transfer":
remarks = [_("Amount {0} {1} transferred from {2} to {3}")
.format(self.paid_from_account_currency, self.paid_amount, self.paid_from, self.paid_to)]
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 6712842948e..5de2af51694 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -244,6 +244,9 @@ doc_events = {
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
"on_trash": "erpnext.regional.check_deletion_permission"
},
+ "Purchase Invoice": {
+ "on_submit": "erpnext.regional.india.utils.make_reverse_charge_entries"
+ },
"Payment Entry": {
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.update_payment_req_status"],
"on_trash": "erpnext.regional.check_deletion_permission"
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 445d683788e..e6e8ae7cb31 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -534,6 +534,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
},
() => me.frm.script_manager.trigger("price_list_rate", cdt, cdn),
() => me.toggle_conversion_factor(item),
+ () => {
+ if (show_batch_dialog && !item.has_serial_no
+ && !item.has_batch_no) {
+ show_batch_dialog = false;
+ }
+ },
() => {
if (show_batch_dialog)
return frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
index 35f9cf674ce..888b2da48eb 100644
--- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
+++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.html
@@ -52,7 +52,7 @@
|
|
- | (d) {{__("Inward Supplies(liable to reverse charge")}} |
+ (d) {{__("Inward Supplies(liable to reverse charge)")}} |
{{ flt(data.sup_details.isup_rev.txval, 2) }} |
{{ flt(data.sup_details.isup_rev.iamt, 2) }} |
{{ flt(data.sup_details.isup_rev.camt, 2) }} |
diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
index 15dcbd5e154..626a88acec7 100644
--- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
@@ -158,7 +158,7 @@ class GSTR3BReport(Document):
self.prepare_data("Sales Invoice", outward_supply_tax_amounts, "sup_details", "osup_det", ["Registered Regular"])
self.prepare_data("Sales Invoice", outward_supply_tax_amounts, "sup_details", "osup_zero", ["SEZ", "Deemed Export", "Overseas"])
- self.prepare_data("Purchase Invoice", inward_supply_tax_amounts, "sup_details", "isup_rev", ["Registered Regular"], reverse_charge="Y")
+ self.prepare_data("Purchase Invoice", inward_supply_tax_amounts, "sup_details", "isup_rev", ["Unregistered", "Overseas"], reverse_charge="Y")
self.report_dict["sup_details"]["osup_nil_exmp"]["txval"] = flt(self.get_nil_rated_supply_value(), 2)
self.set_itc_details(itc_details)
@@ -192,31 +192,27 @@ class GSTR3BReport(Document):
for d in self.report_dict["itc_elg"]["itc_avl"]:
itc_type = itc_type_map.get(d["ty"])
- gst_category = "Registered Regular"
+ gst_category = ["Registered Regular"]
if d["ty"] == 'ISRC':
reverse_charge = "Y"
+ itc_type = 'All Other ITC'
+ gst_category = ['Unregistered', 'Overseas']
else:
reverse_charge = "N"
for account_head in self.account_heads:
+ for category in gst_category:
+ for key in [['iamt', 'igst_account'], ['camt', 'cgst_account'], ['samt', 'sgst_account'], ['csamt', 'cess_account']]:
+ d[key[0]] += flt(itc_details.get((category, itc_type, reverse_charge, account_head.get(key[1])), {}).get("amount"), 2)
- d["iamt"] += flt(itc_details.get((gst_category, itc_type, reverse_charge, account_head.get('igst_account')), {}).get("amount"), 2)
- d["camt"] += flt(itc_details.get((gst_category, itc_type, reverse_charge, account_head.get('cgst_account')), {}).get("amount"), 2)
- d["samt"] += flt(itc_details.get((gst_category, itc_type, reverse_charge, account_head.get('sgst_account')), {}).get("amount"), 2)
- d["csamt"] += flt(itc_details.get((gst_category, itc_type, reverse_charge, account_head.get('cess_account')), {}).get("amount"), 2)
-
- net_itc["iamt"] += flt(d["iamt"], 2)
- net_itc["camt"] += flt(d["camt"], 2)
- net_itc["samt"] += flt(d["samt"], 2)
- net_itc["csamt"] += flt(d["csamt"], 2)
+ for key in ['iamt', 'camt', 'samt', 'csamt']:
+ net_itc[key] += flt(d[key], 2)
for account_head in self.account_heads:
itc_inelg = self.report_dict["itc_elg"]["itc_inelg"][1]
- itc_inelg["iamt"] = flt(itc_details.get(("Ineligible", "N", account_head.get("igst_account")), {}).get("amount"), 2)
- itc_inelg["camt"] = flt(itc_details.get(("Ineligible", "N", account_head.get("cgst_account")), {}).get("amount"), 2)
- itc_inelg["samt"] = flt(itc_details.get(("Ineligible", "N", account_head.get("sgst_account")), {}).get("amount"), 2)
- itc_inelg["csamt"] = flt(itc_details.get(("Ineligible", "N", account_head.get("cess_account")), {}).get("amount"), 2)
+ for key in [['iamt', 'igst_account'], ['camt', 'cgst_account'], ['samt', 'sgst_account'], ['csamt', 'cess_account']]:
+ itc_inelg[key[0]] = flt(itc_details.get(("Ineligible", "N", account_head.get(key[1])), {}).get("amount"), 2)
def prepare_data(self, doctype, tax_details, supply_type, supply_category, gst_category_list, reverse_charge="N"):
@@ -274,17 +270,16 @@ class GSTR3BReport(Document):
""" #nosec
.format(doctype = doctype), (self.month_no, self.year, reverse_charge, self.company, self.gst_details.get("gstin"))))
- def get_itc_details(self, reverse_charge='N'):
-
+ def get_itc_details(self):
itc_amount = frappe.db.sql("""
select s.gst_category, sum(t.tax_amount_after_discount_amount) as tax_amount, t.account_head, s.eligibility_for_itc, s.reverse_charge
from `tabPurchase Invoice` s , `tabPurchase Taxes and Charges` t
- where s.docstatus = 1 and t.parent = s.name and s.reverse_charge = %s
+ where s.docstatus = 1 and t.parent = s.name
and month(s.posting_date) = %s and year(s.posting_date) = %s and s.company = %s
and s.company_gstin = %s
group by t.account_head, s.gst_category, s.eligibility_for_itc
""",
- (reverse_charge, self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
+ (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
itc_details = {}
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index abcc953277a..b817ad8d67a 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -9,6 +9,8 @@ from erpnext.hr.utils import get_salary_assignment
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
from erpnext.regional.india import number_state_mapping
from six import string_types
+from erpnext.accounts.general_ledger import make_gl_entries
+from erpnext.accounts.utils import get_account_currency
def validate_gstin_for_india(doc, method):
if hasattr(doc, 'gst_state') and doc.gst_state:
@@ -643,5 +645,53 @@ def get_gst_accounts(company, account_wise=False):
elif val:
gst_accounts[val] = acc
-
return gst_accounts
+
+def make_reverse_charge_entries(doc, method):
+ country = frappe.get_cached_value('Company', doc.company, 'country')
+
+ if country != 'India':
+ return
+
+ if doc.reverse_charge == 'Y':
+ gl_entries = []
+ gst_accounts = get_gst_accounts(doc.company)
+ gst_account_list = gst_accounts.get('cgst_account') + gst_accounts.get('sgst_account') \
+ + gst_accounts.get('igst_account')
+
+ for tax in doc.get('taxes'):
+ if tax.category not in ("Total", "Valuation and Total"):
+ continue
+
+ if flt(tax.base_tax_amount_after_discount_amount) and tax.account_head in gst_account_list:
+ account_currency = get_account_currency(tax.account_head)
+
+ gl_entries.append(doc.get_gl_dict(
+ {
+ "account": tax.account_head,
+ "cost_center": tax.cost_center,
+ "posting_date": doc.posting_date,
+ "against": doc.supplier,
+ "credit": tax.base_tax_amount_after_discount_amount,
+ "credits_in_account_currency": tax.base_tax_amount_after_discount_amount \
+ if account_currency==doc.company_currency \
+ else tax.tax_amount_after_discount_amount
+ }, account_currency, item=tax)
+ )
+
+ gl_entries.append(doc.get_gl_dict(
+ {
+ "account": doc.credit_to if doc.doctype == 'Purchase Invoice' else doc.debit_to,
+ "cost_center": doc.cost_center,
+ "posting_date": doc.posting_date,
+ "party_type": 'Supplier',
+ "party": doc.supplier,
+ "against": tax.account_head,
+ "debit": tax.base_tax_amount_after_discount_amount,
+ "debit_in_account_currency": tax.base_tax_amount_after_discount_amount \
+ if account_currency==doc.company_currency \
+ else tax.tax_amount_after_discount_amount
+ }, account_currency, item=doc)
+ )
+
+ make_gl_entries(gl_entries)
\ No newline at end of file
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.json b/erpnext/selling/report/sales_analytics/sales_analytics.json
index bf9edd6cd49..de5c3a6b2a7 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.json
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.json
@@ -1,5 +1,5 @@
{
- "add_total_row": 0,
+ "add_total_row": 1,
"creation": "2018-09-21 12:46:29.451048",
"disable_prepared_report": 0,
"disabled": 0,
@@ -7,7 +7,7 @@
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
- "modified": "2020-04-30 19:49:02.303320",
+ "modified": "2020-06-19 17:41:03.132101",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Analytics",
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py
index 97d9322918d..4d113c8e9e9 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.py
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.py
@@ -23,7 +23,14 @@ class Analytics(object):
self.get_columns()
self.get_data()
self.get_chart_data()
- return self.columns, self.data, None, self.chart
+
+ # Skipping total row for tree-view reports
+ skip_total_row = 0
+
+ if self.filters.tree_type in ["Supplier Group", "Item Group", "Customer Group", "Territory"]:
+ skip_total_row = 1
+
+ return self.columns, self.data, None, self.chart, None, skip_total_row
def get_columns(self):
self.columns = [{
@@ -194,9 +201,6 @@ class Analytics(object):
def get_rows(self):
self.data = []
self.get_periodic_data()
- total_row = {
- "entity": "Total",
- }
for entity, period_data in iteritems(self.entity_periodic_data):
row = {
@@ -210,9 +214,6 @@ class Analytics(object):
row[scrub(period)] = amount
total += amount
- if not total_row.get(scrub(period)): total_row[scrub(period)] = 0
- total_row[scrub(period)] += amount
-
row["total"] = total
if self.filters.tree_type == "Item":
@@ -220,8 +221,6 @@ class Analytics(object):
self.data.append(row)
- self.data.append(total_row)
-
def get_rows_by_group(self):
self.get_periodic_data()
out = []
diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py
index 7e8501dcc15..4d81a1e4dda 100644
--- a/erpnext/selling/report/sales_analytics/test_analytics.py
+++ b/erpnext/selling/report/sales_analytics/test_analytics.py
@@ -33,21 +33,6 @@ class TestAnalytics(unittest.TestCase):
report = execute(filters)
expected_data = [
- {
- 'entity': 'Total',
- 'apr_2017': 0.0,
- 'may_2017': 0.0,
- 'jun_2017': 2000.0,
- 'jul_2017': 1000.0,
- 'aug_2017': 0.0,
- 'sep_2017': 1500.0,
- 'oct_2017': 1000.0,
- 'nov_2017': 0.0,
- 'dec_2017': 0.0,
- 'jan_2018': 0.0,
- 'feb_2018': 2000.0,
- 'mar_2018': 0.0
- },
{
"entity": "_Test Customer 1",
"entity_name": "_Test Customer 1",
@@ -149,21 +134,6 @@ class TestAnalytics(unittest.TestCase):
report = execute(filters)
expected_data = [
- {
- 'entity': 'Total',
- 'apr_2017': 0.0,
- 'may_2017': 0.0,
- 'jun_2017': 20.0,
- 'jul_2017': 10.0,
- 'aug_2017': 0.0,
- 'sep_2017': 15.0,
- 'oct_2017': 10.0,
- 'nov_2017': 0.0,
- 'dec_2017': 0.0,
- 'jan_2018': 0.0,
- 'feb_2018': 20.0,
- 'mar_2018': 0.0
- },
{
"entity": "_Test Customer 1",
"entity_name": "_Test Customer 1",
diff --git a/erpnext/www/lms/content.html b/erpnext/www/lms/content.html
index cdc71412c48..dc9b6d80fb5 100644
--- a/erpnext/www/lms/content.html
+++ b/erpnext/www/lms/content.html
@@ -59,7 +59,7 @@
{% macro title() %}
@@ -69,15 +69,15 @@
{% macro navigation() %}
{% if previous %}
-
Previous
+
{{_('Previous')}}
{% else %}
-
Back to Course
+
{{ _('Back to Course') }}
{% endif %}
{% if next %}
-
+
{% else %}
-
+
{% endif %}
{% endmacro %}
@@ -86,7 +86,7 @@
{{ title() }}
{% if content.duration %}
- {{ content.duration }} Mins
+ {{ content.duration }} {{_('Mins')}}
{% endif %}
{% if content.publish_date and content.duration%}
@@ -94,7 +94,7 @@
{% endif %}
{% if content.publish_date %}
- Published on {{ content.publish_date.strftime('%d, %b %Y') }}
+ {{_('Published on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
{% endif %}
@@ -109,13 +109,13 @@
{{ title() }}
{% if content.author or content.publish_date %}
- Published
+ {{_('Published')}}
{% endif %}
{% if content.author %}
- by {{ content.author }}
+ {{_('by')}} {{ content.author }}
{% endif %}
{% if content.publish_date %}
- on {{ content.publish_date.strftime('%d, %b %Y') }}
+ {{_('on')}} {{ content.publish_date.strftime('%d, %b %Y') }}
{% endif %}
@@ -205,4 +205,4 @@
{% endif %}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html
index f2fd9363e8c..0d70ed5cefd 100644
--- a/erpnext/www/lms/course.html
+++ b/erpnext/www/lms/course.html
@@ -72,11 +72,11 @@
{% if has_access %}
diff --git a/erpnext/www/lms/index.html b/erpnext/www/lms/index.html
index ffb4419f367..7ce3521273f 100644
--- a/erpnext/www/lms/index.html
+++ b/erpnext/www/lms/index.html
@@ -45,7 +45,7 @@
{{ education_settings.description }}
{% if frappe.session.user == 'Guest' %}
- Sign Up
+ {{_('Sign Up')}}
{% endif %}
diff --git a/erpnext/www/lms/macros/card.html b/erpnext/www/lms/macros/card.html
index 076061d41b3..dc8fc5c72c7 100644
--- a/erpnext/www/lms/macros/card.html
+++ b/erpnext/www/lms/macros/card.html
@@ -15,8 +15,8 @@
{% if has_access or program.intro_video%}
{% endif %}
diff --git a/erpnext/www/lms/macros/hero.html b/erpnext/www/lms/macros/hero.html
index 66bb861c467..94f239eb8ed 100644
--- a/erpnext/www/lms/macros/hero.html
+++ b/erpnext/www/lms/macros/hero.html
@@ -2,16 +2,16 @@
{{ title }}
{{ description or ''}}
{% if frappe.session.user == 'Guest' %}
- Sign Up
+ {{_('Sign Up')}}
{% elif not has_access %}
-
+
{% endif %}
@@ -28,7 +28,7 @@
let btn = document.getElementById('enroll');
btn.disbaled = true;
- btn.innerText = 'Enrolling...'
+ btn.innerText = __('Enrolling...')
let opts = {
method: 'erpnext.education.utils.enroll_in_program',
@@ -44,7 +44,7 @@
window.location.reload()
}
})
- success_dialog.set_message('You have successfully enrolled for the program ');
+ success_dialog.set_message(__('You have successfully enrolled for the program '));
success_dialog.$message.show()
success_dialog.show();
btn.disbaled = false;
diff --git a/erpnext/www/lms/profile.html b/erpnext/www/lms/profile.html
index 9508daedb71..5755dfe6d8e 100644
--- a/erpnext/www/lms/profile.html
+++ b/erpnext/www/lms/profile.html
@@ -30,7 +30,7 @@
@@ -43,11 +43,11 @@
{{ student.first_name }} {{ student.last_name or '' }}
@@ -61,4 +61,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html
index 271b7813bb4..7ad618630a4 100644
--- a/erpnext/www/lms/program.html
+++ b/erpnext/www/lms/program.html
@@ -55,11 +55,11 @@
{% if has_access and progress[course.name] %}
{% endif %}
diff --git a/erpnext/www/lms/topic.html b/erpnext/www/lms/topic.html
index 1f0d1876646..cd24616cd45 100644
--- a/erpnext/www/lms/topic.html
+++ b/erpnext/www/lms/topic.html
@@ -23,13 +23,13 @@
{% if has_access %}