Merge branch 'develop' of https://github.com/frappe/erpnext into develop

This commit is contained in:
Abhishek Balam 2020-04-26 13:07:09 +05:30
commit 8aa8457a2d
3 changed files with 24 additions and 7 deletions

View File

@ -136,9 +136,18 @@ def make_bank_entry(dt, dn):
def make_return_entry(employee, company, employee_advance_name,
return_amount, advance_account, mode_of_payment=None):
return_account = get_default_bank_cash_account(company, account_type='Cash', mode_of_payment = mode_of_payment)
mode_of_payment_type = ''
if mode_of_payment:
mode_of_payment_type = frappe.get_cached_value('Mode of Payment', mode_of_payment, 'type')
if mode_of_payment_type not in ["Cash", "Bank"]:
# if mode of payment is General then it unset the type
mode_of_payment_type = None
je = frappe.new_doc('Journal Entry')
je.posting_date = nowdate()
je.voucher_type = 'Bank Entry'
# if mode of payment is Bank then voucher type is Bank Entry
je.voucher_type = '{} Entry'.format(mode_of_payment_type) if mode_of_payment_type else 'Cash Entry'
je.company = company
je.remark = 'Return against Employee Advance: ' + employee_advance_name

View File

@ -299,6 +299,7 @@ frappe.ui.form.on('Material Request', {
args: {
"material_request": frm.doc.name
},
freeze: true,
callback: function(r) {
if(r.message.length) {
frm.reload_doc();

View File

@ -8,7 +8,7 @@ from __future__ import unicode_literals
import frappe
import json
from frappe.utils import cstr, flt, getdate, new_line_sep, nowdate, add_days
from frappe.utils import cstr, flt, getdate, new_line_sep, nowdate, add_days, get_link_to_form
from frappe import msgprint, _
from frappe.model.mapper import get_mapped_doc
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
@ -522,15 +522,22 @@ def raise_work_orders(material_request):
work_orders.append(wo_order.name)
else:
errors.append(_("Row {0}: Bill of Materials not found for the Item {1}").format(d.idx, d.item_code))
errors.append(_("Row {0}: Bill of Materials not found for the Item {1}")
.format(d.idx, get_link_to_form("Item", d.item_code)))
if work_orders:
message = ["""<a href="#Form/Work Order/%s" target="_blank">%s</a>""" % \
(p, p) for p in work_orders]
msgprint(_("The following Work Orders were created:") + '\n' + new_line_sep(message))
work_orders_list = [get_link_to_form("Work Order", d) for d in work_orders]
if len(work_orders) > 1:
msgprint(_("The following {0} were created: {1}")
.format(frappe.bold(_("Work Orders")), '<br>' + ', '.join(work_orders_list)))
else:
msgprint(_("The {0} {1} created sucessfully")
.format(frappe.bold(_("Work Order")), work_orders_list[0]))
if errors:
frappe.throw(_("Work Order cannot be created for following reason:") + '\n' + new_line_sep(errors))
frappe.throw(_("Work Order cannot be created for following reason: <br> {0}")
.format(new_line_sep(errors)))
return work_orders