2
In order to test change currency wizard I create an invoice with currency "EUR" and change it to "USD" using the wizard
4
!record {model: account.invoice, id: account_invoice_currency}:
5
account_id: account.a_recv
6
address_contact_id: base.res_partner_address_3000
7
address_invoice_id: base.res_partner_address_3000
8
company_id: base.main_company
11
- account_id: account.a_sale
12
name: '[PC1] Basic PC'
15
product_id: product.product_product_pc1
16
uos_id: product.product_uom_unit
17
journal_id: account.sales_journal
18
partner_id: base.res_partner_desertic_hispafuentes
22
I check that Initially customer invoice is in the draft state
24
!assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}:
27
Now I select USD as new currency
29
!record {model: account.change.currency, id: account_change_currency_0}:
32
I clicked on Change Currency button to change the currency
34
!python {model: account.change.currency}: |
35
self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
36
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
37
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
39
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
40
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
41
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
44
I change the state of invoice to proforma2 by clicking PRO-FORMA button
46
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency}
48
I check that now customer invoice is in the "proforma2" state
50
!assert {model: account.invoice, id: account_invoice_currency}:
51
- state == 'proforma2'
53
I can't change the currency of invoice when it is not in draft state so I change the state to cancel
55
!workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency}
57
I change the state to "Draft"
59
!python {model: account.invoice}: |
60
self.action_cancel_draft(cr, uid, [ref("account_invoice_currency")], {"lang": 'en_US',
61
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
62
"type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
65
I change the currency.
67
!record {model: account.change.currency, id: account_change_currency_0}:
70
I clicked on Change Currency button to change the currency
72
!python {model: account.change.currency}: |
73
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
74
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
75
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
78
I check that the currency is changed successfully
80
!assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}:
81
- currency_id.id == ref("base.USD")