diff --git a/addons/point_of_sale/models/product.py b/addons/point_of_sale/models/product.py index 2ab5f867424..32db9580623 100644 --- a/addons/point_of_sale/models/product.py +++ b/addons/point_of_sale/models/product.py @@ -66,7 +66,7 @@ class ProductProduct(models.Model): pricelists = config.available_pricelist_ids else: pricelists = config.pricelist_id - price_per_pricelist_id = pricelists._price_get(self, quantity) + price_per_pricelist_id = pricelists._price_get(self, quantity) if pricelists else False pricelist_list = [{'name': pl.name, 'price': price_per_pricelist_id[pl.id]} for pl in pricelists] # Warehouses diff --git a/addons/point_of_sale/static/src/js/Screens/PartnerListScreen/PartnerDetailsEdit.js b/addons/point_of_sale/static/src/js/Screens/PartnerListScreen/PartnerDetailsEdit.js index 8b1bfcc0df7..bd8e78e5ddf 100644 --- a/addons/point_of_sale/static/src/js/Screens/PartnerListScreen/PartnerDetailsEdit.js +++ b/addons/point_of_sale/static/src/js/Screens/PartnerListScreen/PartnerDetailsEdit.js @@ -17,10 +17,8 @@ export class PartnerDetailsEdit extends PosComponent { this.changes = { country_id: partner.country_id && partner.country_id[0], state_id: partner.state_id && partner.state_id[0], + property_product_pricelist: this.setDefaultPricelist(partner) }; - if (!partner.property_product_pricelist) { - this.changes["property_product_pricelist"] = this.env.pos.default_pricelist.id; - } onMounted(() => { this.env.bus.on("save-partner", this, this.saveChanges); @@ -30,6 +28,16 @@ export class PartnerDetailsEdit extends PosComponent { this.env.bus.off("save-partner", this); }); } + setDefaultPricelist(partner) { + if (partner.property_product_pricelist) { + return partner.property_product_pricelist[0] + } + else if (this.env.pos.default_pricelist) { + return this.env.pos.default_pricelist.id; + } + return false; + } + get partnerImageUrl() { // We prioritize image_1920 in the `changes` field because we want // to show the uploaded image without fetching new data from the server.