[FIX] point_of_sale: default partner price list
Before, when we tried to open the Partner detail screen, we had an issue when the price list weren't loaded. But since this commit: 40f0482b680a7872d338fa8fd10eec4663637b46 The price list are not mandatory anymore, we can get rid of the check that consisted of verifying the price list were set on the partners. closes odoo/odoo#111665 Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user