diff --git a/erpnext/patches/v16_0/set_ordered_qty_in_quotation_item.py b/erpnext/patches/v16_0/set_ordered_qty_in_quotation_item.py index 93a6323eb6f..314bc6dfe9e 100644 --- a/erpnext/patches/v16_0/set_ordered_qty_in_quotation_item.py +++ b/erpnext/patches/v16_0/set_ordered_qty_in_quotation_item.py @@ -10,7 +10,18 @@ def execute(): ) if data: frappe.db.auto_commit_on_many_writes = 1 - frappe.db.bulk_update( - "Quotation Item", {d.quotation_item: {"ordered_qty": d.ordered_qty} for d in data} - ) - frappe.db.auto_commit_on_many_writes = 0 + try: + frappe.db.bulk_update( + "Quotation Item", {d.quotation_item: {"ordered_qty": d.ordered_qty} for d in data} + ) + quotations = frappe.get_all( + "Quotation Item", + filters={"name": ["in", [d.quotation_item for d in data]]}, + pluck="parent", + distinct=True, + ) + for quotation in quotations: + doc = frappe.get_doc("Quotation", quotation) + doc.set_status(update=True, update_modified=False) + finally: + frappe.db.auto_commit_on_many_writes = 0 diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index bb82310d9c5..a692aa3e3ca 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -132,6 +132,7 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. frappe.datetime.get_diff(doc.valid_till, frappe.datetime.get_today()) >= 0) ) { this.frm.add_custom_button(__("Sales Order"), () => this.make_sales_order(), __("Create")); + cur_frm.page.set_inner_btn_group_as_primary(__("Create")); this.frm.add_custom_button(__("Update Items"), () => { erpnext.utils.update_child_items({ frm: this.frm, @@ -146,8 +147,6 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. this.frm.trigger("set_as_lost_dialog"); }); } - - cur_frm.page.set_inner_btn_group_as_primary(__("Create")); } if (this.frm.doc.docstatus === 0 && frappe.model.can_read("Opportunity")) {