[FIX] pos_sale: down_payment product not imported

Current behavior:
If you limit the number of product loaded in the pos to 0, and block
loading product in the background you will have a traceback when trying
to apply a down_payment.

Steps to reproduce:
- Settings > POS > Limit products to load > Set 0
- Disable the option "Load product in the background"
- Start a PoS session
- Go in the Quotation / Order screen
- Apply a down payment
- Results in traceback

opw-3113215

closes odoo/odoo#110883

X-original-commit: 77a5e134dd3c87b3ed0bd5708bf63ed76647306b
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
roen-odoo
2023-01-25 04:05:46 +01:00
parent ba8e25384f
commit 4a05a12ce4
@@ -240,9 +240,15 @@ export class SaleOrderManagementScreen extends ControlButtonsMixin(IndependentTo
total: lines[i].price_total,
};
}
const down_payment_product = this.env.pos.db.get_product_by_id(
let down_payment_product = this.env.pos.db.get_product_by_id(
this.env.pos.config.down_payment_product_id[0]
);
if (!down_payment_product) {
await this.env.pos._addProducts([this.env.pos.config.down_payment_product_id[0]]);
down_payment_product = this.env.pos.db.get_product_by_id(
this.env.pos.config.down_payment_product_id[0]
);
}
const down_payment_tax =
this.env.pos.taxes_by_id[down_payment_product.taxes_id] || false;
let down_payment;