Merge pull request #12741 from Helkyd/develop
Update Trial balance
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 558dd8d..a852b76 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1620,8 +1620,16 @@
var me = this;
var invoice_data = {};
this.si_docs = this.get_doc_from_localstorage();
+
if (this.frm.doc.offline_pos_name) {
- this.update_invoice();
+ this.update_invoice()
+ //to retrieve and set the default payment
+ invoice_data[this.frm.doc.offline_pos_name] = this.frm.doc;
+ invoice_data[this.frm.doc.offline_pos_name].payments[0].amount = this.frm.doc.net_total
+ invoice_data[this.frm.doc.offline_pos_name].payments[0].base_amount = this.frm.doc.net_total
+
+ this.frm.doc.paid_amount = this.frm.doc.net_total
+ this.frm.doc.outstanding_amount = 0
} else {
this.frm.doc.offline_pos_name = $.now();
this.frm.doc.posting_date = frappe.datetime.get_today();
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 5df2a65..7142c69 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -51,8 +51,8 @@
filters.to_date = filters.year_end_date
def get_data(filters):
- accounts = frappe.db.sql("""select name, parent_account, account_name, root_type, report_type, lft, rgt
- from `tabAccount` where company=%s order by lft""", filters.company, as_dict=True)
+ accounts = frappe.db.sql("""select name, parent_account, account_name, account_number, root_type, report_type, lft, rgt
+ from `tabAccount` where company=%s order by account_name, lft""", filters.company, as_dict=True)
company_currency = erpnext.get_company_currency(filters.company)
if not accounts:
@@ -175,6 +175,9 @@
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
data = []
+ tmpaccnt = sorted(accounts)
+ if not (accounts[0].account_number is None):
+ accounts = tmpaccnt
for d in accounts:
has_value = False
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index 77209e0..0d656bc 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -27,8 +27,14 @@
var me = this;
this.dialog.set_primary_action(__("Submit"), function() {
- me.dialog.hide()
- me.submit_invoice()
+ // Allow no ZERO payment
+ $.each(me.frm.doc.payments, function (index, data) {
+ if (data.amount != 0) {
+ me.dialog.hide();
+ me.submit_invoice();
+ return;
+ }
+ });
})
},