[FIX] sale: expense price unit
The company currency is EUR, and GBP rates are: - 0.8414 at day 1 - 0.8389 at day 2 Then: - Create a SO in GBP at day 1 and confirm - Create an expense in GBP at day 2 and choose the analytic account of the SO - Validate the expense and post the journal entries Problem: - The amount of the expense is 93 GBP - The amount of the sale order line is 93.28 GBP opw-696375
This commit is contained in:
@@ -47,6 +47,12 @@ class AccountAnalyticLine(models.Model):
|
||||
def _get_invoice_price(self, order):
|
||||
if self.unit_amount == 0.0:
|
||||
return 0.0
|
||||
|
||||
# Prevent unnecessary currency conversion that could be impacted by exchange rate
|
||||
# fluctuations
|
||||
if self.currency_id and self.amount_currency and self.currency_id == order.currency_id:
|
||||
return abs(self.amount_currency / self.unit_amount)
|
||||
|
||||
price_unit = abs(self.amount / self.unit_amount)
|
||||
currency_id = self.company_id.currency_id
|
||||
if currency_id and currency_id != order.currency_id:
|
||||
|
||||
Reference in New Issue
Block a user