merged with trunk
[odoo/odoo.git] / addons / account / test / account_change_currency.yml
1 -
2   In order to test change currency wizard I create an invoice with currency "EUR" and change it to "USD" using the wizard
3 -
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
9     currency_id: base.EUR
10     invoice_line:
11       - account_id: account.a_sale
12         name: '[PC1] Basic PC'
13         price_unit: 450.0
14         quantity: 1.0
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
19     reference_type: none
20
21 -
22   I check that Initially customer invoice is in the draft state
23 -
24   !assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}:
25     - state == 'draft'
26 -
27   Now I select USD as new currency
28 -
29   !record {model: account.change.currency, id: account_change_currency_0}:
30     currency_id: base.USD
31 -
32   I clicked on Change Currency button to change the currency
33 -
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"),
38     })
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"),
42     })
43 -
44   I change the state of invoice to proforma2 by clicking PRO-FORMA button
45 -
46   !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency}
47 -
48   I check that now customer invoice is in the "proforma2" state
49 -
50   !assert {model: account.invoice, id: account_invoice_currency}:
51     - state == 'proforma2'
52 -
53   I can't change the currency of invoice when it is not in draft state so I change the state to cancel
54 -
55   !workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency}
56 -
57   I change the state to "Draft"
58 -
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"),
63       })
64 -
65   I change the currency.
66 -
67   !record {model: account.change.currency, id: account_change_currency_0}:
68     currency_id: base.USD
69 -
70   I clicked on Change Currency button to change the currency
71 -
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"),
76       })
77 -
78   I check that the currency is changed successfully
79 -
80   !assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}:
81     - currency_id.id == ref("base.USD")