Skip to content

Commit

Permalink
[FIX] pos_sale: remove redundant try-catch block
Browse files Browse the repository at this point in the history
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#156836

Signed-off-by: Vlad Stroia (vlst) <[email protected]>
  • Loading branch information
adda-odoo committed Mar 7, 2024
1 parent 7d817e9 commit 455081d
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ odoo.define('pos_sale.SaleOrderManagementScreen', function (require) {
if(confirmed){
let currentPOSOrder = this.env.pos.get_order();
let sale_order = await this._getSaleOrder(clickedOrder.id);
try {
await this.env.pos.load_new_partners();
}
catch (error){
}
let order_partner = this.env.pos.db.get_partner_by_id(sale_order.partner_id[0])
if(order_partner){
currentPOSOrder.set_client(order_partner);
Expand Down

0 comments on commit 455081d

Please sign in to comment.