80 lines
3.2 KiB
YAML
80 lines
3.2 KiB
YAML
-
|
|
In order to test change currency wizard I create an invoice with currency "EUR" and change it to "USD" using the wizard
|
|
-
|
|
!record {model: account.invoice, id: account_invoice_currency}:
|
|
account_id: account.a_recv
|
|
company_id: base.main_company
|
|
currency_id: base.EUR
|
|
invoice_line:
|
|
- account_id: account.a_sale
|
|
name: '[PC1] Basic PC'
|
|
price_unit: 450.0
|
|
quantity: 1.0
|
|
product_id: product.product_product_pc1
|
|
uos_id: product.product_uom_unit
|
|
journal_id: account.sales_journal
|
|
partner_id: base.res_partner_desertic_hispafuentes
|
|
reference_type: none
|
|
|
|
-
|
|
I check that Initially customer invoice is in the draft state
|
|
-
|
|
!assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}:
|
|
- state == 'draft'
|
|
-
|
|
Now I select USD as new currency
|
|
-
|
|
!record {model: account.change.currency, id: account_change_currency_0}:
|
|
currency_id: base.USD
|
|
-
|
|
I clicked on Change Currency button to change the currency
|
|
-
|
|
!python {model: account.change.currency}: |
|
|
self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
|
"active_model": "account.invoice", "tz": False, "active_ids":
|
|
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
|
})
|
|
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
|
"active_model": "account.invoice", "tz": False, "active_ids":
|
|
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
|
})
|
|
-
|
|
I change the state of invoice to proforma2 by clicking PRO-FORMA button
|
|
-
|
|
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency}
|
|
-
|
|
I check that now customer invoice is in the "proforma2" state
|
|
-
|
|
!assert {model: account.invoice, id: account_invoice_currency}:
|
|
- state == 'proforma2'
|
|
-
|
|
I can't change the currency of invoice when it is not in draft state so I change the state to cancel
|
|
-
|
|
!workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency}
|
|
-
|
|
I change the state to "Draft"
|
|
-
|
|
!python {model: account.invoice}: |
|
|
self.action_cancel_draft(cr, uid, [ref("account_invoice_currency")], {"lang": 'en_US',
|
|
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
|
|
"type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
|
|
})
|
|
-
|
|
I change the currency.
|
|
-
|
|
!record {model: account.change.currency, id: account_change_currency_0}:
|
|
currency_id: base.USD
|
|
-
|
|
I clicked on Change Currency button to change the currency
|
|
-
|
|
!python {model: account.change.currency}: |
|
|
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
|
|
"active_model": "account.invoice", "tz": False, "active_ids":
|
|
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
|
|
})
|
|
-
|
|
I check that the currency is changed successfully
|
|
-
|
|
!assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}:
|
|
- currency_id.id == ref("base.USD")
|