[FIX] pos_sale: remove redundant try-catch block

Issue -->

In `_onClickSaleOrder`, we load in the partner on the sale order using
`load_new_partners()`. However, the search on the `res.partner` model made in
this method has the potential to return every single `res.partner` record
because of the domain that it uses --> https://github.com/odoo/odoo/blob/6c2dd5fbd9898f0efecdc35593af69bfd7d4eb50/addons/point_of_sale/static/src/js/models.js#L783-L785

After doing so, we check if the parter has been loaded and we grab the id using
`get_partner_by_id`. If the partner is not loaded, we use `_loadPartners` to
load them.

Since we are already checking and reloading the partner on the sale order
using `_loadPartners`, using `load_new_partners()` earlier is redundant.

Solution -->

Remove the try-catch block that loads multiple `res.partner` records during
the process of clicking a sale order via POS.

opw-3619941

closes odoo/odoo#157469

X-original-commit: b47e7bdd15e0738b479153fec495d009aeae9967
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
Signed-off-by: Aditya Dasgupta (adda) <adda@odoo.com>
This commit is contained in:
adda-odoo
2024-03-12 21:35:08 +00:00
parent e70798f6cc
commit e330f345ff
@@ -130,11 +130,6 @@ export class SaleOrderManagementScreen extends ControlButtonsMixin(Component) {
}
}
try {
await this.pos.load_new_partners();
} catch {
// FIXME Universal catch seems ill advised
}
const order_partner = this.pos.db.get_partner_by_id(sale_order.partner_id[0]);
if (order_partner) {
currentPOSOrder.set_partner(order_partner);