feat: automatically create quotation for down payment orders and remove user confirmation prompt.

This commit is contained in:
Suherdy Yacob 2026-03-02 08:16:59 +07:00
parent f938be25f2
commit db67645436

View File

@ -31,9 +31,9 @@ patch(Order.prototype, {
const standardLines = lines.filter(line => line.product.id !== downPaymentProductId); const standardLines = lines.filter(line => line.product.id !== downPaymentProductId);
// If there is a down payment AND standard products that haven't been zeroed out yet // If there is a down payment, we require a customer and automatically
// we prompt the user to create a quotation. // create a quotation without prompting.
const needsQuotation = downPaymentLines.length > 0 && standardLines.some(line => line.price > 0 || line.get_unit_price() > 0); const needsQuotation = downPaymentLines.length > 0;
if (needsQuotation && !this.is_quotation_line_converted) { if (needsQuotation && !this.is_quotation_line_converted) {
if (!this.get_partner()) { if (!this.get_partner()) {
@ -44,14 +44,6 @@ patch(Order.prototype, {
return; return;
} }
const { confirmed } = await this.env.services.popup.add(ConfirmPopup, {
title: _t("Create Quotation?"),
body: _t("This cart contains a down payment and standard products. Do you want to create a backend Quotation for the standard products and proceed to pay only the down payment?"),
confirmText: _t("Yes"),
cancelText: _t("No")
});
if (confirmed) {
try { try {
// Prepare data for backend // Prepare data for backend
const linesData = standardLines.map(line => ({ const linesData = standardLines.map(line => ({
@ -100,9 +92,6 @@ patch(Order.prototype, {
}); });
return; return;
} }
} else {
return; // User cancelled
}
} }
return super.pay(...arguments); return super.pay(...arguments);