feat: record reason for hold as comment

This commit is contained in:
Mangesh-Khairnar 2019-03-12 12:54:25 +05:30
parent a1afd78723
commit 4f74313baf
3 changed files with 7 additions and 43 deletions

View File

@ -450,14 +450,15 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
primary_action: function() {
var data = d.get_values();
frappe.call({
method: "erpnext.buying.doctype.purchase_order.purchase_order.update_reason_for_hold",
method: "frappe.desk.form.utils.add_comment",
args: {
data: data.reason_for_hold,
name: me.frm.doc.name
reference_doctype: me.frm.doctype,
reference_name: me.frm.docname,
content: __('Reason for hold:')+data.reason_for_hold,
comment_email: frappe.session.user
},
callback: function(r) {
if(!r.exc) {
me.frm.set_value("reason_for_hold", data.reason_for_hold);
me.update_status('Hold', 'On Hold')
d.hide();
}

View File

@ -3398,40 +3398,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.status === 'On Hold'",
"fetch_if_empty": 0,
"fieldname": "reason_for_hold",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Reason for Hold",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "ref_sq",
"fieldtype": "Data",
@ -4016,7 +3983,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-03-11 11:12:32.663129",
"modified": "2019-03-12 12:44:54.454670",
"modified_by": "mangesh@iwebnotes.com",
"module": "Buying",
"name": "Purchase Order",

View File

@ -301,10 +301,6 @@ class PurchaseOrder(BuyingController):
else:
self.db_set("per_received", 0, update_modified=False)
@frappe.whitelist()
def update_reason_for_hold(name, data):
frappe.db.set_value('Purchase Order', name, 'reason_for_hold', data)
def item_last_purchase_rate(name, conversion_rate, item_code, conversion_factor= 1.0):
"""get last purchase rate for an item"""