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 company_id: base.main_company
9 - account_id: account.a_sale
10 name: '[PCSC234] PC Assemble SC234'
13 product_id: product.product_product_3
14 uos_id: product.product_uom_unit
15 journal_id: account.sales_journal
16 partner_id: base.res_partner_12
20 I check that Initially customer invoice is in the draft state
22 !assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}:
25 Now I select USD as new currency
27 !record {model: account.change.currency, id: account_change_currency_0}:
30 I clicked on Change Currency button to change the currency
32 !python {model: account.change.currency}: |
33 self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
34 "active_model": "account.invoice", "tz": False, "active_ids":
35 [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
37 self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
38 "active_model": "account.invoice", "tz": False, "active_ids":
39 [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
42 I change the state of invoice to proforma2 by clicking PRO-FORMA button
44 !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency}
46 I check that now customer invoice is in the "proforma2" state
48 !assert {model: account.invoice, id: account_invoice_currency}:
49 - state == 'proforma2'
51 I can't change the currency of invoice when it is not in draft state so I change the state to cancel
53 !workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency}
55 I change the state to "Draft"
57 !python {model: account.invoice}: |
58 self.action_cancel_draft(cr, uid, [ref("account_invoice_currency")], {"lang": 'en_US',
59 "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
60 "type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
63 I change the currency.
65 !record {model: account.change.currency, id: account_change_currency_0}:
68 I clicked on Change Currency button to change the currency
70 !python {model: account.change.currency}: |
71 self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
72 "active_model": "account.invoice", "tz": False, "active_ids":
73 [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
76 I check that the currency is changed successfully
78 !assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}:
79 - currency_id.id == ref("base.USD")