[FIX] loyalty: amount conversion of rules without company
In the present when in a multi-company environment it is possible to create loyalty programs without a company associated to it. This cause a problem when computing conversion rates as conversion rates are associated to a company. After this commit if no company is setted on the loyalty program then when computing the amout to deduce on the loyalty program we fallback to the env company (this is the same way the company is initially deduced on the loyalty program). Task - 3001177 closes odoo/odoo#101922 Forward-port-of: odoo/odoo#101631 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -134,4 +134,8 @@ class LoyaltyRule(models.Model):
|
||||
def _compute_amount(self, currency_to):
|
||||
self.ensure_one()
|
||||
return self.currency_id._convert(
|
||||
self.minimum_amount, currency_to, self.company_id, fields.Date.today())
|
||||
self.minimum_amount,
|
||||
currency_to,
|
||||
self.company_id or self.env.company,
|
||||
fields.Date.today()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user