Skip to content

Commit

Permalink
Merge pull request #487 from StefanRijnhart/fix/10.0/483-account_invo…
Browse files Browse the repository at this point in the history
…ice_change_currency_rounding_in_test

[FIX] account_invoice_change_currency: round per line to fix test
  • Loading branch information
pedrobaeza committed Jan 23, 2019
2 parents 56bd92d + cd6c468 commit d922fac
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,18 @@ def create_simple_invoice(self, date):

def test_change_invoice_currency(self):
inv = self.create_simple_invoice(fields.Date.today())
before_curr = inv.currency_id
before_amount = inv.amount_total
before_curr = inv.currency_id.with_context(
date=fields.Date.today())
after_curr = self.env.ref('base.USD')
expected_value = sum(
[line.quantity * before_curr.compute(
line.price_unit, after_curr)
for line in inv.invoice_line_ids])

wiz = self.env['wizard.change.invoice.currency'].\
with_context(active_id=inv.id).create(
{'currency_id': after_curr.id})
wiz.button_change_currency()
expected_value = before_curr.with_context(date=fields.Date.today()).\
compute(before_amount, after_curr)

self.assertEqual(
inv.amount_total, expected_value,
Expand Down

0 comments on commit d922fac

Please sign in to comment.