Merge pull request #23669 from rohitwaghchaure/not-able-to-make-material-request-from-so-develop
fix: not able to make material request from SO
This commit is contained in:
commit
4eaa74c4f5
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import json
|
import json
|
||||||
import frappe.utils
|
import frappe.utils
|
||||||
from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form
|
from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form, strip_html
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from six import string_types
|
from six import string_types
|
||||||
from frappe.model.utils import get_fetch_values
|
from frappe.model.utils import get_fetch_values
|
||||||
@ -993,15 +993,20 @@ def make_raw_material_request(items, company, sales_order, project=None):
|
|||||||
))
|
))
|
||||||
for item in raw_materials:
|
for item in raw_materials:
|
||||||
item_doc = frappe.get_cached_doc('Item', item.get('item_code'))
|
item_doc = frappe.get_cached_doc('Item', item.get('item_code'))
|
||||||
|
|
||||||
schedule_date = add_days(nowdate(), cint(item_doc.lead_time_days))
|
schedule_date = add_days(nowdate(), cint(item_doc.lead_time_days))
|
||||||
material_request.append('items', {
|
row = material_request.append('items', {
|
||||||
'item_code': item.get('item_code'),
|
'item_code': item.get('item_code'),
|
||||||
'qty': item.get('quantity'),
|
'qty': item.get('quantity'),
|
||||||
'schedule_date': schedule_date,
|
'schedule_date': schedule_date,
|
||||||
'warehouse': item.get('warehouse'),
|
'warehouse': item.get('warehouse'),
|
||||||
'sales_order': sales_order,
|
'sales_order': sales_order,
|
||||||
'project': project
|
'project': project
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if not (strip_html(item.get("description")) and strip_html(item_doc.description)):
|
||||||
|
row.description = item_doc.item_name or item.get('item_code')
|
||||||
|
|
||||||
material_request.insert()
|
material_request.insert()
|
||||||
material_request.flags.ignore_permissions = 1
|
material_request.flags.ignore_permissions = 1
|
||||||
material_request.run_method("set_missing_values")
|
material_request.run_method("set_missing_values")
|
||||||
|
Loading…
Reference in New Issue
Block a user