From 7b6072ca7bd3cf9732adf2344048bffa2f6dcc5e Mon Sep 17 00:00:00 2001 From: Bruno Zanotti Date: Thu, 16 Nov 2023 07:44:03 -0300 Subject: [PATCH] [FIX] product: make get price public method The purpose of this change is to be able to get the price of the products from external APIs. closes odoo/odoo#142402 X-original-commit: 420406d392dd3764f08ac698b67440a86abb2ca5 Signed-off-by: Victor Feyens (vfe) --- addons/product/models/product_product.py | 3 +++ addons/product/models/product_template.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/product/models/product_product.py b/addons/product/models/product_product.py index 01fa220e3c8..2b2ff81bd45 100644 --- a/addons/product/models/product_product.py +++ b/addons/product/models/product_product.py @@ -794,6 +794,9 @@ class ProductProduct(models.Model): (tmpl_to_deactivate + tmpl_to_activate).toggle_active() return result + def get_contextual_price(self): + return self._get_contextual_price() + def _get_contextual_price(self): self.ensure_one() return self.product_tmpl_id._get_contextual_price(self) diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 74eb4390bcb..5c3d92dd0b4 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -1383,6 +1383,9 @@ class ProductTemplate(models.Model): 'template': '/product/static/xls/product_template.xls' }] + def get_contextual_price(self, product=None): + return self._get_contextual_price(product=product) + def _get_contextual_price(self, product=None): self.ensure_one() pricelist = self._get_contextual_pricelist()