Do not compute carrier price without a company in the context

Closes #13364
(grafted from b500a599f8f4d01024a57b6751c6c66cf476e6ef)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-06-26 13:37:01 +02:00
1 parent c7953c1d26
commit 1f4d5959e9
1 file changed
+4 -2
+4 -2
View File
@@ -46,7 +46,8 @@ class Carrier(DeactivableMixin, ModelSQL, ModelView):
'Compute carrier sale price with currency'
pool = Pool()
Company = pool.get('company.company')
if self.carrier_cost_method == 'product':
if (self.carrier_cost_method == 'product'
and self.carrier_product._context.get('company') is not None):
list_price = self.carrier_product.list_price_used
if list_price is not None:
company = Company(self.carrier_product._context['company'])
@@ -57,7 +58,8 @@ class Carrier(DeactivableMixin, ModelSQL, ModelView):
'Compute carrier purchase price with currency'
pool = Pool()
Company = pool.get('company.company')
if self.carrier_cost_method == 'product':
if (self.carrier_cost_method == 'product'
and self.carrier_product._context.get('company') is not None):
cost_price = self.carrier_product.cost_price
if cost_price is not None:
company = Company(self.carrier_product._context['company'])