fix: Made period fields read only and added validation for multiple entries by same user
This commit is contained in:
parent
4e4b200972
commit
0bee62b460
@ -76,6 +76,7 @@ var get_closing_voucher_details = function(frm) {
|
||||
refresh_field("grand_total");
|
||||
refresh_field("net_total");
|
||||
refresh_field("total_quantity");
|
||||
refresh_field("total_amount");
|
||||
|
||||
frm.get_field("payment_reconciliation_details").$wrapper.html(r.message);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@ -72,7 +72,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@ -958,7 +958,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-01-26 13:23:49.192650",
|
||||
"modified": "2019-01-28 12:33:45.217813",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "POS Closing Voucher",
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from collections import defaultdict
|
||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
|
||||
@ -26,6 +27,7 @@ class POSClosingVoucher(Document):
|
||||
|
||||
sales_summary = get_sales_summary(invoice_list)
|
||||
self.set_sales_summary_values(sales_summary)
|
||||
self.total_amount = sales_summary['grand_total']
|
||||
|
||||
if not self.get('payment_reconciliation'):
|
||||
mop = get_mode_of_payment_details(invoice_list)
|
||||
@ -36,6 +38,21 @@ class POSClosingVoucher(Document):
|
||||
|
||||
return self.get_payment_reconciliation_details()
|
||||
|
||||
def validate(self):
|
||||
user = frappe.get_all('POS Closing Voucher',
|
||||
filters = {
|
||||
'user': self.user,
|
||||
'docstatus': 1
|
||||
},
|
||||
or_filters = {
|
||||
'period_start_date': ('between', [self.period_start_date, self.period_end_date]),
|
||||
'period_end_date': ('between', [self.period_start_date, self.period_end_date])
|
||||
})
|
||||
|
||||
if user:
|
||||
frappe.throw(_("POS Closing Voucher alreday exists for {0} between date {1} and {2}"
|
||||
.format(self.user, self.period_start_date, self.period_end_date)))
|
||||
|
||||
def set_invoice_list(self, invoice_list):
|
||||
self.sales_invoices_summary = []
|
||||
for invoice in invoice_list:
|
||||
|
Loading…
Reference in New Issue
Block a user