feat: automatically create quotation for down payment orders and remove user confirmation prompt.
This commit is contained in:
parent
f938be25f2
commit
db67645436
@ -31,9 +31,9 @@ patch(Order.prototype, {
|
||||
|
||||
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
|
||||
// we prompt the user to create a quotation.
|
||||
const needsQuotation = downPaymentLines.length > 0 && standardLines.some(line => line.price > 0 || line.get_unit_price() > 0);
|
||||
// If there is a down payment, we require a customer and automatically
|
||||
// create a quotation without prompting.
|
||||
const needsQuotation = downPaymentLines.length > 0;
|
||||
|
||||
if (needsQuotation && !this.is_quotation_line_converted) {
|
||||
if (!this.get_partner()) {
|
||||
@ -44,14 +44,6 @@ patch(Order.prototype, {
|
||||
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 {
|
||||
// Prepare data for backend
|
||||
const linesData = standardLines.map(line => ({
|
||||
@ -100,9 +92,6 @@ patch(Order.prototype, {
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return; // User cancelled
|
||||
}
|
||||
}
|
||||
|
||||
return super.pay(...arguments);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user