mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] currency_rate_update should now work in multi-company
This commit is contained in:
@@ -165,22 +165,22 @@ class CurrencyRateUpdateService(models.Model):
|
||||
for curr in srv.currency_to_update:
|
||||
if curr == main_currency:
|
||||
continue
|
||||
do_create = True
|
||||
for rate in curr.rate_ids:
|
||||
if rate.name == rate_name:
|
||||
rate.rate = res[curr.name]
|
||||
do_create = False
|
||||
break
|
||||
if do_create:
|
||||
rates = rate_obj.search([
|
||||
('currency_id', '=', curr.id),
|
||||
('company_id', '=', company.id),
|
||||
('name', '=', rate_name)])
|
||||
if not rates:
|
||||
vals = {
|
||||
'currency_id': curr.id,
|
||||
'rate': res[curr.name],
|
||||
'name': rate_name
|
||||
'name': rate_name,
|
||||
'company_id': company.id,
|
||||
}
|
||||
rate_obj.create(vals)
|
||||
_logger.info(
|
||||
'Updated currency %s via service %s',
|
||||
curr.name, srv.service)
|
||||
'Updated currency %s via service %s '
|
||||
'in company %s',
|
||||
curr.name, srv.service, company.name)
|
||||
|
||||
# Show the most recent note at the top
|
||||
msg = '%s \n%s currency updated. %s' % (
|
||||
|
||||
Reference in New Issue
Block a user