[Issue] Fixed, supplier quotation item uom conversion
This commit is contained in:
parent
541e8504a6
commit
b44efef094
@ -41,10 +41,6 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
|
|||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
$.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|
||||||
// no need to trigger updation of stock uom, as this field doesn't exist in supplier quotation
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.fields_dict['items'].grid.get_field('project').get_query =
|
cur_frm.fields_dict['items'].grid.get_field('project').get_query =
|
||||||
function(doc, cdt, cdn) {
|
function(doc, cdt, cdn) {
|
||||||
return{
|
return{
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe.utils import flt
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
|
||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
@ -62,7 +63,7 @@ def make_purchase_order(source_name, target_doc=None):
|
|||||||
target.run_method("calculate_taxes_and_totals")
|
target.run_method("calculate_taxes_and_totals")
|
||||||
|
|
||||||
def update_item(obj, target, source_parent):
|
def update_item(obj, target, source_parent):
|
||||||
target.conversion_factor = 1
|
target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor)
|
||||||
|
|
||||||
doclist = get_mapped_doc("Supplier Quotation", source_name, {
|
doclist = get_mapped_doc("Supplier Quotation", source_name, {
|
||||||
"Supplier Quotation": {
|
"Supplier Quotation": {
|
||||||
@ -76,8 +77,6 @@ def make_purchase_order(source_name, target_doc=None):
|
|||||||
"field_map": [
|
"field_map": [
|
||||||
["name", "supplier_quotation_item"],
|
["name", "supplier_quotation_item"],
|
||||||
["parent", "supplier_quotation"],
|
["parent", "supplier_quotation"],
|
||||||
["uom", "stock_uom"],
|
|
||||||
["uom", "uom"],
|
|
||||||
["material_request", "material_request"],
|
["material_request", "material_request"],
|
||||||
["material_request_item", "material_request_item"]
|
["material_request_item", "material_request_item"]
|
||||||
],
|
],
|
||||||
|
@ -303,6 +303,33 @@
|
|||||||
"unique": 0,
|
"unique": 0,
|
||||||
"width": "60px"
|
"width": "60px"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "stock_uom",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Stock UOM",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "UOM",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 1,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -409,6 +436,32 @@
|
|||||||
"unique": 0,
|
"unique": 0,
|
||||||
"width": "100px"
|
"width": "100px"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "conversion_factor",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "UOM Conversion Factor",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 1,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -1106,6 +1159,57 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "section_break_44",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "stock_qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Qty as per Stock UOM",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 1,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 1,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -1144,7 +1248,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-08-26 04:51:44.857545",
|
"modified": "2016-09-06 02:40:11.022104",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Quotation Item",
|
"name": "Supplier Quotation Item",
|
||||||
|
@ -323,3 +323,4 @@ erpnext.patches.v7_0.update_missing_employee_in_timesheet
|
|||||||
erpnext.patches.v7_0.update_status_for_timesheet
|
erpnext.patches.v7_0.update_status_for_timesheet
|
||||||
erpnext.patches.v7_0.set_party_name_in_payment_entry
|
erpnext.patches.v7_0.set_party_name_in_payment_entry
|
||||||
erpnext.patches.v7_1.set_student_guardian
|
erpnext.patches.v7_1.set_student_guardian
|
||||||
|
erpnext.patches.v7_0.update_conversion_factor_in_supplier_quotation_item
|
@ -0,0 +1,19 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc('buying', 'doctype', 'supplier_quotation_item')
|
||||||
|
|
||||||
|
frappe.db.sql("""update
|
||||||
|
`tabSupplier Quotation Item` as sqi_t,
|
||||||
|
(select sqi.item_code as item_code, sqi.uom as uom, ucd.conversion_factor as conversion_factor
|
||||||
|
from `tabSupplier Quotation Item` sqi left join `tabUOM Conversion Detail` ucd
|
||||||
|
on ucd.uom = sqi.uom and sqi.item_code = ucd.parent) as conversion_data,
|
||||||
|
`tabItem` as item
|
||||||
|
set
|
||||||
|
sqi_t.conversion_factor= ifnull(conversion_data.conversion_factor, 1),
|
||||||
|
sqi_t.stock_qty = (ifnull(conversion_data.conversion_factor, 1) * sqi_t.qty),
|
||||||
|
sqi_t.stock_uom = item.stock_uom
|
||||||
|
where
|
||||||
|
sqi_t.item_code = conversion_data.item_code and
|
||||||
|
sqi_t.uom = conversion_data.uom and sqi_t.item_code = item.name""")
|
Loading…
Reference in New Issue
Block a user