Skip to content

Commit 134e4b7

Browse files
fix: update status of quotation in patch (backport #54577) (#54580)
fix: update status of quotation in patch (#54577) (cherry picked from commit 2088a01) Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
1 parent 15b6633 commit 134e4b7

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

erpnext/patches/v16_0/set_ordered_qty_in_quotation_item.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ def execute():
1010
)
1111
if data:
1212
frappe.db.auto_commit_on_many_writes = 1
13-
frappe.db.bulk_update(
14-
"Quotation Item", {d.quotation_item: {"ordered_qty": d.ordered_qty} for d in data}
15-
)
16-
frappe.db.auto_commit_on_many_writes = 0
13+
try:
14+
frappe.db.bulk_update(
15+
"Quotation Item", {d.quotation_item: {"ordered_qty": d.ordered_qty} for d in data}
16+
)
17+
quotations = frappe.get_all(
18+
"Quotation Item",
19+
filters={"name": ["in", [d.quotation_item for d in data]]},
20+
pluck="parent",
21+
distinct=True,
22+
)
23+
for quotation in quotations:
24+
doc = frappe.get_doc("Quotation", quotation)
25+
doc.set_status(update=True, update_modified=False)
26+
finally:
27+
frappe.db.auto_commit_on_many_writes = 0

erpnext/selling/doctype/quotation/quotation.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext.
132132
frappe.datetime.get_diff(doc.valid_till, frappe.datetime.get_today()) >= 0)
133133
) {
134134
this.frm.add_custom_button(__("Sales Order"), () => this.make_sales_order(), __("Create"));
135+
cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
135136
this.frm.add_custom_button(__("Update Items"), () => {
136137
erpnext.utils.update_child_items({
137138
frm: this.frm,
@@ -146,8 +147,6 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext.
146147
this.frm.trigger("set_as_lost_dialog");
147148
});
148149
}
149-
150-
cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
151150
}
152151

153152
if (this.frm.doc.docstatus === 0 && frappe.model.can_read("Opportunity")) {

0 commit comments

Comments
 (0)