Skip to content

Commit 247e5c5

Browse files
committed
[FIX] sale_order_currency_rate
1 parent 680c061 commit 247e5c5

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

sale_order_currency_rate/models/sale_order.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77
class SaleOrder(models.Model):
88
_inherit = "sale.order"
99

10-
currency_rate = fields.Float(
11-
compute="_compute_currency_rate",
12-
digits="Currency Rate Precision",
13-
)
14-
1510
inverse_currency_rate = fields.Float(
16-
compute="_compute_currency_rate",
11+
compute="_compute_inverse_currency_rate",
1712
digits="Currency Rate Precision",
1813
)
1914

@@ -23,23 +18,15 @@ class SaleOrder(models.Model):
2318
)
2419

2520
@api.depends("currency_id", "company_id.currency_id")
26-
def _compute_currency_rate(self):
21+
def _compute_inverse_currency_rate(self):
2722
for order in self:
2823
if order.currency_id != order.company_id.currency_id:
29-
order.currency_rate = order.currency_id._convert(
24+
order.inverse_currency_rate = order.currency_id._convert(
3025
1.0,
3126
order.company_id.currency_id,
3227
order.company_id,
3328
order.date_order,
3429
round=False,
3530
)
36-
order.inverse_currency_rate = order.company_id.currency_id._convert(
37-
1.0,
38-
order.currency_id,
39-
order.company_id,
40-
order.date_order,
41-
round=False,
42-
)
4331
else:
44-
order.currency_rate = 1.0
4532
order.inverse_currency_rate = 1.0

0 commit comments

Comments
 (0)