[REM] product: unused company fallback logic

This method & logic is not used nor necessary anymore with
the multi-company fixes and improvements done in the recent years.
* All requests coming from website are automatically done in the website
company.
* check_company restrictions forbid the use of records from different companies
* multi-company security rules restrict the access to records from the current
company.

Part-of: odoo/odoo#121986
This commit is contained in:
Victor Feyens
2023-09-14 18:09:48 +00:00
parent ae7d23ef2e
commit 6c940679c9
-28
View File
@@ -1322,34 +1322,6 @@ class ProductTemplate(models.Model):
return _("There are no possible combination.")
combination = combination[:-1]
def _get_current_company(self, **kwargs):
"""Get the most appropriate company for this product.
If the company is set on the product, directly return it. Otherwise,
fallback to a contextual company.
:param kwargs: kwargs forwarded to the fallback method.
:return: the most appropriate company for this product
:rtype: recordset of one `res.company`
"""
self.ensure_one()
return self.company_id or self._get_current_company_fallback(**kwargs)
def _get_current_company_fallback(self, **kwargs):
"""Fallback to get the most appropriate company for this product.
This should only be called from `_get_current_company` but is defined
separately to allow override.
The final fallback will be the current user's company.
:return: the fallback company for this product
:rtype: recordset of one `res.company`
"""
self.ensure_one()
return self.env.company
def _get_placeholder_filename(self, field):
image_fields = ['image_%s' % size for size in [1920, 1024, 512, 256, 128]]
if field in image_fields: