Minor fixes in payroll entry and opening invoice tool
This commit is contained in:
parent
5a344576b8
commit
6a640b78c4
@ -4,7 +4,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe import _, scrub
|
||||
from frappe.utils import flt
|
||||
from frappe.model.document import Document
|
||||
|
||||
@ -68,29 +68,18 @@ class OpeningInvoiceCreationTool(Document):
|
||||
for row in self.invoices:
|
||||
if not row.qty:
|
||||
row.qty = 1.0
|
||||
if not row.party:
|
||||
frappe.throw(mandatory_error_msg.format(
|
||||
idx=row.idx,
|
||||
field=_("Party"),
|
||||
invoice_type=self.invoice_type
|
||||
))
|
||||
|
||||
# set party type if not available
|
||||
if not row.party_type:
|
||||
row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
|
||||
|
||||
if not row.posting_date:
|
||||
frappe.throw(mandatory_error_msg.format(
|
||||
idx=row.idx,
|
||||
field=_("Party"),
|
||||
invoice_type=self.invoice_type
|
||||
))
|
||||
|
||||
if not row.outstanding_amount:
|
||||
frappe.throw(mandatory_error_msg.format(
|
||||
idx=row.idx,
|
||||
field=_("Outstanding Amount"),
|
||||
invoice_type=self.invoice_type
|
||||
))
|
||||
for d in ("Party", "Posting Date", "Outstanding Amount", "Due Date", "Temporary Opening Account"):
|
||||
if not row.get(scrub(d)):
|
||||
frappe.throw(mandatory_error_msg.format(
|
||||
idx=row.idx,
|
||||
field=_(d),
|
||||
invoice_type=self.invoice_type
|
||||
))
|
||||
|
||||
args = self.get_invoice_dict(row=row)
|
||||
if not args:
|
||||
|
@ -37,7 +37,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
if (!slip_status.draft && !slip_status.submitted) {
|
||||
return;
|
||||
} else {
|
||||
frm.add_custom_button("View Salary Slips",
|
||||
frm.add_custom_button(__("View Salary Slips"),
|
||||
function() {
|
||||
frappe.set_route(
|
||||
'List', 'Salary Slip', {posting_date: frm.doc.posting_date}
|
||||
@ -47,13 +47,11 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
}
|
||||
|
||||
if (slip_status.draft) {
|
||||
frm.add_custom_button("Submit Salary Slip",
|
||||
frm.add_custom_button(__("Submit Salary Slip"),
|
||||
function() {
|
||||
submit_salary_slip(frm);
|
||||
},
|
||||
__('Make')
|
||||
);
|
||||
frm.page.set_inner_btn_group_as_primary(__('Make'));
|
||||
}
|
||||
).addClass("btn-primary");
|
||||
}
|
||||
},
|
||||
|
||||
@ -182,7 +180,7 @@ frappe.ui.form.on('Payroll Entry', {
|
||||
// Submit salary slips
|
||||
|
||||
const submit_salary_slip = function (frm) {
|
||||
frappe.confirm(__('This will create a Journal Entry. Do you want to proceed?'),
|
||||
frappe.confirm(__('This will submit Salary Slips and create accrual Journal Entry. Do you want to proceed?'),
|
||||
function() {
|
||||
frappe.call({
|
||||
method: 'submit_salary_slips',
|
||||
@ -190,7 +188,7 @@ const submit_salary_slip = function (frm) {
|
||||
callback: function() {frm.events.refresh(frm);},
|
||||
doc: frm.doc,
|
||||
freeze: true,
|
||||
freeze_message: 'Creating Journal Entries...'
|
||||
freeze_message: 'Submitting Salary Slips and creating Journal Entry...'
|
||||
});
|
||||
},
|
||||
function() {
|
||||
|
Loading…
Reference in New Issue
Block a user