Merge pull request #12633 from vishdha/issue_12388
[fix] Sales order link to purchase order not working fixed
This commit is contained in:
commit
32a5f38595
@ -124,7 +124,8 @@ def make_purchase_order(source_name, target_doc=None):
|
||||
["name", "supplier_quotation_item"],
|
||||
["parent", "supplier_quotation"],
|
||||
["material_request", "material_request"],
|
||||
["material_request_item", "material_request_item"]
|
||||
["material_request_item", "material_request_item"],
|
||||
["sales_order", "sales_order"]
|
||||
],
|
||||
"postprocess": update_item
|
||||
},
|
||||
|
@ -1326,6 +1326,37 @@
|
||||
"unique": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Order",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@ -1614,7 +1645,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-14 09:37:47.427897",
|
||||
"modified": "2018-01-25 15:04:40.171617",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation Item",
|
||||
|
@ -486,4 +486,5 @@ erpnext.patches.v10_0.add_guardian_role_for_parent_portal
|
||||
erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
|
||||
erpnext.patches.v10_0.update_assessment_plan
|
||||
erpnext.patches.v10_0.update_assessment_result
|
||||
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
||||
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
||||
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
|
@ -0,0 +1,18 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("buying", "doctype", "supplier_quotation_item")
|
||||
|
||||
for doctype in ['Purchase Order','Supplier Quotation']:
|
||||
frappe.db.sql("""
|
||||
Update
|
||||
`tab{doctype} Item`, `tabMaterial Request Item`
|
||||
set
|
||||
`tab{doctype} Item`.sales_order = `tabMaterial Request Item`.sales_order
|
||||
where
|
||||
`tab{doctype} Item`.material_request= `tabMaterial Request Item`.parent
|
||||
and `tab{doctype} Item`.material_request_item = `tabMaterial Request Item`.name
|
||||
and `tabMaterial Request Item`.sales_order is not null""".format(doctype=doctype))
|
@ -65,7 +65,7 @@ class MaterialRequest(BuyingController):
|
||||
self.status = "Draft"
|
||||
|
||||
from erpnext.controllers.status_updater import validate_status
|
||||
validate_status(self.status,
|
||||
validate_status(self.status,
|
||||
["Draft", "Submitted", "Stopped", "Cancelled", "Pending",
|
||||
"Partially Ordered", "Ordered", "Issued", "Transferred"])
|
||||
|
||||
@ -240,7 +240,8 @@ def make_purchase_order(source_name, target_doc=None):
|
||||
["name", "material_request_item"],
|
||||
["parent", "material_request"],
|
||||
["uom", "stock_uom"],
|
||||
["uom", "uom"]
|
||||
["uom", "uom"],
|
||||
["sales_order", "sales_order"]
|
||||
],
|
||||
"postprocess": update_item,
|
||||
"condition": lambda doc: doc.ordered_qty < doc.stock_qty
|
||||
@ -344,7 +345,8 @@ def make_supplier_quotation(source_name, target_doc=None):
|
||||
"doctype": "Supplier Quotation Item",
|
||||
"field_map": {
|
||||
"name": "material_request_item",
|
||||
"parent": "material_request"
|
||||
"parent": "material_request",
|
||||
"sales_order": "sales_order"
|
||||
}
|
||||
}
|
||||
}, target_doc, postprocess)
|
||||
|
@ -472,8 +472,8 @@ def get_projected_qty(item_code, warehouse):
|
||||
@frappe.whitelist()
|
||||
def get_bin_details(item_code, warehouse):
|
||||
return frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse},
|
||||
["projected_qty", "actual_qty"], as_dict=True) \
|
||||
or {"projected_qty": 0, "actual_qty": 0}
|
||||
["projected_qty", "actual_qty", "ordered_qty"], as_dict=True) \
|
||||
or {"projected_qty": 0, "actual_qty": 0, "ordered_qty": 0}
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_serial_no_details(item_code, warehouse, stock_qty, serial_no):
|
||||
|
Loading…
Reference in New Issue
Block a user