Skip to content

Commit

Permalink
fix: Maintain same rate between Quotation and Sales Order
Browse files Browse the repository at this point in the history
(cherry picked from commit 362ec7b)
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Nov 10, 2022
1 parent 6f61685 commit 6c155d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion erpnext/selling/doctype/quotation/quotation.py
Expand Up @@ -247,7 +247,7 @@ def update_item(obj, target, source_parent):
"Quotation": {"doctype": "Sales Order", "validation": {"docstatus": ["=", 1]}},
"Quotation Item": {
"doctype": "Sales Order Item",
"field_map": {"parent": "prevdoc_docname"},
"field_map": {"parent": "prevdoc_docname", "name": "quotation_item"},
"postprocess": update_item,
"condition": lambda doc: doc.qty > 0,
},
Expand Down
3 changes: 3 additions & 0 deletions erpnext/selling/doctype/sales_order/sales_order.py
Expand Up @@ -193,6 +193,9 @@ def validate_with_previous_doc(self):
{"Quotation": {"ref_dn_field": "prevdoc_docname", "compare_fields": [["company", "="]]}}
)

if cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate")):
self.validate_rate_with_reference_doc([["Quotation", "prev_docname", "quotation_item"]])

def update_enquiry_status(self, prevdoc, flag):
enq = frappe.db.sql(
"select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.name=%s",
Expand Down
11 changes: 10 additions & 1 deletion erpnext/selling/doctype/sales_order_item/sales_order_item.json
Expand Up @@ -70,6 +70,7 @@
"warehouse",
"target_warehouse",
"prevdoc_docname",
"quotation_item",
"col_break4",
"against_blanket_order",
"blanket_order",
Expand Down Expand Up @@ -838,12 +839,20 @@
"label": "Purchase Order Item",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "quotation_item",
"fieldtype": "Data",
"hidden": 1,
"label": "quotation_item",
"no_copy": 1,
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2022-10-26 16:05:02.712705",
"modified": "2022-11-10 18:20:30.137455",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
Expand Down

0 comments on commit 6c155d2

Please sign in to comment.