diff --git a/modules/account_budget/tests/scenario_account_budget.rst b/modules/account_budget/tests/scenario_account_budget.rst index a9e3979ba6..3799600e94 100644 --- a/modules/account_budget/tests/scenario_account_budget.rst +++ b/modules/account_budget/tests/scenario_account_budget.rst @@ -131,8 +131,7 @@ Check actual amount of the budget:: Create periods:: - >>> create_periods = Wizard( - ... 'account.budget.line.create_periods', [pl_budget]) + >>> create_periods = pl_budget.click('create_periods') >>> create_periods.execute('create_periods') >>> revenue_budget, expense_budget = pl_budget.children >>> len(pl_budget.periods) diff --git a/modules/account_deposit/tests/scenario_deposit.rst b/modules/account_deposit/tests/scenario_deposit.rst index 199dbc40f2..f1a4e34932 100644 --- a/modules/account_deposit/tests/scenario_deposit.rst +++ b/modules/account_deposit/tests/scenario_deposit.rst @@ -80,7 +80,7 @@ Create final invoice:: Recall deposit:: - >>> recall_deposit = Wizard('account.invoice.recall_deposit', [invoice]) + >>> recall_deposit = invoice.click('recall_deposit') >>> recall_deposit.form.account = accounts['deposit'] >>> recall_deposit.form.description = 'Recall Deposit' >>> recall_deposit.execute('recall') diff --git a/modules/account_invoice/tests/scenario_credit_note.rst b/modules/account_invoice/tests/scenario_credit_note.rst index ec912e35db..6090167c2c 100644 --- a/modules/account_invoice/tests/scenario_credit_note.rst +++ b/modules/account_invoice/tests/scenario_credit_note.rst @@ -108,7 +108,7 @@ Post credit note:: Pay credit note:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('-220.00') >>> pay.form.amount = Decimal('-120.00') @@ -129,7 +129,7 @@ Pay credit note:: >>> pay.state 'end' - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('-100.00') >>> pay.form.amount = Decimal('-100.00') diff --git a/modules/account_invoice/tests/scenario_invoice.rst b/modules/account_invoice/tests/scenario_invoice.rst index 164523640d..949934745e 100644 --- a/modules/account_invoice/tests/scenario_invoice.rst +++ b/modules/account_invoice/tests/scenario_invoice.rst @@ -265,7 +265,7 @@ Pay invoice:: >>> invoice, = invoice.duplicate() >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('240.00') >>> pay.form.amount = Decimal('120.00') @@ -274,7 +274,7 @@ Pay invoice:: >>> pay.state 'end' - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('120.00') >>> pay.form.amount = Decimal('20.00') @@ -293,7 +293,7 @@ Pay invoice:: Decimal('100.00') >>> pay.execute('pay') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('-20.00') >>> pay.form.amount = Decimal('99.00') @@ -369,7 +369,7 @@ Create a paid invoice:: >>> line.quantity = 5 >>> line.unit_price = Decimal('40') >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> pay.state diff --git a/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst b/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst index 5f27a7372d..d0a4369fee 100644 --- a/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst +++ b/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst @@ -156,7 +156,7 @@ Create invoice with alternate currency:: Pay the invoice with rate change:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('460.00') >>> pay.form.payment_method = payment_method diff --git a/modules/account_invoice/tests/scenario_invoice_alternate_currency_lower_rate.rst b/modules/account_invoice/tests/scenario_invoice_alternate_currency_lower_rate.rst index 2dd907bcfb..a04c6e4a1b 100644 --- a/modules/account_invoice/tests/scenario_invoice_alternate_currency_lower_rate.rst +++ b/modules/account_invoice/tests/scenario_invoice_alternate_currency_lower_rate.rst @@ -85,7 +85,7 @@ Create invoice with alternate currency:: Pay the invoice:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount Decimal('400.00') >>> pay.form.currency == eur diff --git a/modules/account_invoice/tests/scenario_invoice_alternative_payee.rst b/modules/account_invoice/tests/scenario_invoice_alternative_payee.rst index b4c4a0789f..3c565375aa 100644 --- a/modules/account_invoice/tests/scenario_invoice_alternative_payee.rst +++ b/modules/account_invoice/tests/scenario_invoice_alternative_payee.rst @@ -116,7 +116,7 @@ Set another payee:: Pay the invoice:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payee = party3 >>> pay.form.amount = Decimal('10.00') >>> pay.form.payment_method = payment_method diff --git a/modules/account_invoice/tests/scenario_invoice_overpayment.rst b/modules/account_invoice/tests/scenario_invoice_overpayment.rst index fc076de8f6..0af8adbfc1 100644 --- a/modules/account_invoice/tests/scenario_invoice_overpayment.rst +++ b/modules/account_invoice/tests/scenario_invoice_overpayment.rst @@ -85,7 +85,7 @@ Create an invoice:: Overpay the invoice with write-off:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount = Decimal('110.00') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') @@ -105,7 +105,7 @@ Overpay the invoice without write-off:: >>> invoice, = invoice.duplicate() >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount = Decimal('110.00') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') diff --git a/modules/account_invoice/tests/scenario_invoice_reschedule_lines.rst b/modules/account_invoice/tests/scenario_invoice_reschedule_lines.rst index 8cc881a9a9..27cf1f7d84 100644 --- a/modules/account_invoice/tests/scenario_invoice_reschedule_lines.rst +++ b/modules/account_invoice/tests/scenario_invoice_reschedule_lines.rst @@ -74,8 +74,7 @@ Post customer invoice:: Reschedule line:: - >>> reschedule = Wizard( - ... 'account.invoice.lines_to_pay.reschedule', [invoice]) + >>> reschedule = invoice.click('reschedule_lines_to_pay') >>> reschedule_lines, = reschedule.actions >>> reschedule_lines.form.total_amount Decimal('10.00') @@ -97,7 +96,7 @@ Reschedule line:: Pay the invoice:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.amount = Decimal('10.00') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') diff --git a/modules/account_invoice_correction/tests/scenario_invoice_correction.rst b/modules/account_invoice_correction/tests/scenario_invoice_correction.rst index 862faaf398..f4ba33ebec 100644 --- a/modules/account_invoice_correction/tests/scenario_invoice_correction.rst +++ b/modules/account_invoice_correction/tests/scenario_invoice_correction.rst @@ -63,7 +63,7 @@ Create invoice:: Correct invoice:: - >>> correct = Wizard('account.invoice.correct', [invoice]) + >>> correct = invoice.click('correct') >>> correct.form.lines.extend(correct.form.lines.find( ... [('description', '=', "Revenue 1")])) >>> correct.execute('correct') diff --git a/modules/account_invoice_watermark/tests/scenario_account_invoice_watermark.rst b/modules/account_invoice_watermark/tests/scenario_account_invoice_watermark.rst index 321bbf2c1c..6f2243c0af 100644 --- a/modules/account_invoice_watermark/tests/scenario_account_invoice_watermark.rst +++ b/modules/account_invoice_watermark/tests/scenario_account_invoice_watermark.rst @@ -95,7 +95,7 @@ Print posted invoice:: Print paid invoice:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> invoice.state diff --git a/modules/account_payment_braintree/tests/scenario_account_payment_braintree.rst b/modules/account_payment_braintree/tests/scenario_account_payment_braintree.rst index c46a405e43..3fdc18cd7e 100644 --- a/modules/account_payment_braintree/tests/scenario_account_payment_braintree.rst +++ b/modules/account_payment_braintree/tests/scenario_account_payment_braintree.rst @@ -96,8 +96,7 @@ Create submitted payment:: Checkout the payment:: - >>> action_id = payment.click('braintree_checkout') - >>> checkout = Wizard('account.payment.braintree.checkout', [payment]) + >>> checkout = payment.click('braintree_checkout') >>> bool(payment.braintree_checkout_id) True diff --git a/modules/account_payment_clearing/tests/scenario_account_negative_payment_clearing.rst b/modules/account_payment_clearing/tests/scenario_account_negative_payment_clearing.rst index 864659b53b..e9336f8880 100644 --- a/modules/account_payment_clearing/tests/scenario_account_negative_payment_clearing.rst +++ b/modules/account_payment_clearing/tests/scenario_account_negative_payment_clearing.rst @@ -99,7 +99,7 @@ Pay the line:: Succeed payment:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> payment.state 'succeeded' diff --git a/modules/account_payment_clearing/tests/scenario_account_payment_clearing.rst b/modules/account_payment_clearing/tests/scenario_account_payment_clearing.rst index 7cfdb1cd1c..f49ab80dc2 100644 --- a/modules/account_payment_clearing/tests/scenario_account_payment_clearing.rst +++ b/modules/account_payment_clearing/tests/scenario_account_payment_clearing.rst @@ -109,7 +109,7 @@ Partially pay the line:: Succeed payment:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.form.date = first >>> succeed.execute('succeed') >>> payment.state @@ -166,7 +166,7 @@ Pay the line:: Succeed payment:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> payment.state 'succeeded' @@ -191,7 +191,7 @@ Fail payment:: Succeed payment and post clearing:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.form.date = yesterday >>> succeed.execute('succeed') >>> payment.state @@ -228,7 +228,7 @@ Fail payment with posted clearing:: Succeed payment to use on statement:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> payment.state 'succeeded' @@ -372,7 +372,7 @@ Pay the line:: Succeed payment:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> debit_line, = [l for l in payment.clearing_move.lines if l.debit > 0] >>> debit_line.debit @@ -414,7 +414,7 @@ Pay the line:: Succeed payment:: - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> credit_line, = [l for l in payment.clearing_move.lines if l.credit > 0] >>> credit_line.credit diff --git a/modules/account_payment_clearing/tests/scenario_account_payment_clearing_invoice_amount_to_pay.rst b/modules/account_payment_clearing/tests/scenario_account_payment_clearing_invoice_amount_to_pay.rst index 7a81bb39b9..c58c60c281 100644 --- a/modules/account_payment_clearing/tests/scenario_account_payment_clearing_invoice_amount_to_pay.rst +++ b/modules/account_payment_clearing/tests/scenario_account_payment_clearing_invoice_amount_to_pay.rst @@ -100,7 +100,7 @@ Create and pay an invoice without clearing:: >>> process_payment = Wizard('account.payment.process', [payment]) >>> process_payment.execute('process') >>> payment.reload() - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> invoice.reload() @@ -133,7 +133,7 @@ Create an invoice and pay it:: >>> process_payment = Wizard('account.payment.process', [payment]) >>> process_payment.execute('process') >>> payment.reload() - >>> succeed = Wizard('account.payment.succeed', [payment]) + >>> succeed = payment.click('succeed_wizard') >>> succeed.execute('succeed') >>> invoice1.reload() diff --git a/modules/account_payment_stripe/tests/scenario_account_payment_stripe.rst b/modules/account_payment_stripe/tests/scenario_account_payment_stripe.rst index 53e264491c..e320f98886 100644 --- a/modules/account_payment_stripe/tests/scenario_account_payment_stripe.rst +++ b/modules/account_payment_stripe/tests/scenario_account_payment_stripe.rst @@ -95,8 +95,7 @@ Create submitted payment:: Checkout the payment:: - >>> action_id = payment.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [payment]) + >>> checkout = payment.click('stripe_checkout') >>> bool(payment.stripe_checkout_id) True @@ -138,8 +137,7 @@ Create failing payment:: >>> payment.click('submit') >>> payment.state 'submitted' - >>> action_id = payment.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [payment]) + >>> checkout = payment.click('stripe_checkout') >>> bool(payment.stripe_checkout_id) True >>> token = stripe.Token.create( @@ -171,8 +169,7 @@ Create a customer:: Checkout the customer:: - >>> action_id = stripe_customer.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [stripe_customer]) + >>> checkout = stripe_customer.click('stripe_checkout') >>> bool(stripe_customer.stripe_checkout_id) True @@ -238,8 +235,7 @@ Make payment with customer:: Detach source:: - >>> detach = Wizard( - ... 'account.payment.stripe.customer.source.detach', [stripe_customer]) + >>> detach = stripe_customer.click('detach_source') >>> detach.form.source = source_id >>> detach.execute('detach') diff --git a/modules/account_payment_stripe/tests/scenario_account_payment_stripe_dispute.rst b/modules/account_payment_stripe/tests/scenario_account_payment_stripe_dispute.rst index 3a8d8077ed..0fdcb8fb54 100644 --- a/modules/account_payment_stripe/tests/scenario_account_payment_stripe_dispute.rst +++ b/modules/account_payment_stripe/tests/scenario_account_payment_stripe_dispute.rst @@ -80,8 +80,7 @@ Create fully disputed payment:: >>> payment.state 'submitted' - >>> _ = payment.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [payment]) + >>> checkout = payment.click('stripe_checkout') >>> bool(payment.stripe_checkout_id) True @@ -173,8 +172,7 @@ Create partial disputed payment:: >>> payment.state 'submitted' - >>> _ = payment.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [payment]) + >>> checkout = payment.click('stripe_checkout') >>> bool(payment.stripe_checkout_id) True @@ -244,8 +242,7 @@ Create won disputed payment:: >>> payment.state 'submitted' - >>> _ = payment.click('stripe_checkout') - >>> checkout = Wizard('account.payment.stripe.checkout', [payment]) + >>> checkout = payment.click('stripe_checkout') >>> bool(payment.stripe_checkout_id) True diff --git a/modules/account_stock_landed_cost/tests/scenario_account_stock_landed_cost.rst b/modules/account_stock_landed_cost/tests/scenario_account_stock_landed_cost.rst index 5875d66036..4fbea50246 100644 --- a/modules/account_stock_landed_cost/tests/scenario_account_stock_landed_cost.rst +++ b/modules/account_stock_landed_cost/tests/scenario_account_stock_landed_cost.rst @@ -170,7 +170,7 @@ Add landed cost:: >>> landed_cost.state 'draft' - >>> post_landed_cost = Wizard('account.landed_cost.post', [landed_cost]) + >>> post_landed_cost = landed_cost.click('post_wizard') >>> post_landed_cost.form.cost Decimal('10.0000') >>> sorted([m.cost for m in post_landed_cost.form.moves]) @@ -185,7 +185,7 @@ Add landed cost:: Show landed cost:: - >>> show_landed_cost = Wizard('account.landed_cost.show', [landed_cost]) + >>> show_landed_cost = landed_cost.click('show') >>> show_landed_cost.form.cost Decimal('10.0000') >>> sorted([m.cost for m in show_landed_cost.form.moves]) diff --git a/modules/account_stock_landed_cost_weight/tests/scenario_account_stock_landed_cost_weight.rst b/modules/account_stock_landed_cost_weight/tests/scenario_account_stock_landed_cost_weight.rst index 62f1006767..150aff7a77 100644 --- a/modules/account_stock_landed_cost_weight/tests/scenario_account_stock_landed_cost_weight.rst +++ b/modules/account_stock_landed_cost_weight/tests/scenario_account_stock_landed_cost_weight.rst @@ -169,7 +169,7 @@ Add landed cost:: >>> landed_cost.save() >>> landed_cost.state 'draft' - >>> post_landed_cost = Wizard('account.landed_cost.post', [landed_cost]) + >>> post_landed_cost = landed_cost.click('post_wizard') >>> post_landed_cost.form.cost Decimal('30.0000') >>> sorted([m.cost for m in post_landed_cost.form.moves]) diff --git a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst index aba3625eba..66d2e295b5 100644 --- a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst +++ b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst @@ -151,7 +151,7 @@ Add shipment cost to both shipments:: 'draft' >>> bool(shipment_cost1.number) True - >>> post_shipment_cost = Wizard('account.shipment_cost.post', [shipment_cost1]) + >>> post_shipment_cost = shipment_cost1.click('post_wizard') >>> post_shipment_cost.form.cost Decimal('10.0000') >>> sorted([s.cost for s in post_shipment_cost.form.shipments]) @@ -164,7 +164,7 @@ Add shipment cost to both shipments:: Show shipment cost:: - >>> show_shipment_cost = Wizard('account.shipment_cost.show', [shipment_cost1]) + >>> show_shipment_cost = shipment_cost1.click('show') >>> show_shipment_cost.form.cost Decimal('10.0000') >>> sorted([s.cost for s in show_shipment_cost.form.shipments]) @@ -194,7 +194,7 @@ Add a second shipment cost to 1 shipment:: >>> shipment_cost2.invoice_lines.append(InvoiceLine(line.id)) >>> shipment_cost2.shipments.append(ShipmentOut(shipment1.id)) >>> shipment_cost2.save() - >>> post_shipment_cost = Wizard('account.shipment_cost.post', [shipment_cost2]) + >>> post_shipment_cost = shipment_cost2.click('post_wizard') >>> post_shipment_cost.form.cost Decimal('2.0000') >>> sorted([s.cost for s in post_shipment_cost.form.shipments]) diff --git a/modules/account_stock_shipment_cost_weight/tests/scenario_account_stock_shipment_cost_weight.rst b/modules/account_stock_shipment_cost_weight/tests/scenario_account_stock_shipment_cost_weight.rst index ff7574cd61..9d22dd64e3 100644 --- a/modules/account_stock_shipment_cost_weight/tests/scenario_account_stock_shipment_cost_weight.rst +++ b/modules/account_stock_shipment_cost_weight/tests/scenario_account_stock_shipment_cost_weight.rst @@ -151,7 +151,7 @@ Add shipment cost to both shipments:: >>> shipment_cost.save() >>> shipment_cost.state 'draft' - >>> post_shipment_cost = Wizard('account.shipment_cost.post', [shipment_cost]) + >>> post_shipment_cost = shipment_cost.click('post_wizard') >>> post_shipment_cost.form.cost Decimal('20.0000') >>> sorted([s.cost for s in post_shipment_cost.form.shipments]) diff --git a/modules/analytic_budget/tests/scenario_analytic_budget.rst b/modules/analytic_budget/tests/scenario_analytic_budget.rst index ca99ed6c29..d88029050e 100644 --- a/modules/analytic_budget/tests/scenario_analytic_budget.rst +++ b/modules/analytic_budget/tests/scenario_analytic_budget.rst @@ -123,7 +123,7 @@ Check actual amount the budget:: Copy the budget without amounts:: - >>> copy_budget = Wizard('analytic_account.budget.copy', [budget]) + >>> copy_budget = budget.click('copy_button') >>> copy_budget.form.start_date = next_period.start_date >>> copy_budget.form.end_date = next_period.end_date >>> copy_budget.form.factor = Decimal('1.2') diff --git a/modules/product_kit/tests/scenario_product_kit_purchase.rst b/modules/product_kit/tests/scenario_product_kit_purchase.rst index e10954b697..5ada8081f4 100644 --- a/modules/product_kit/tests/scenario_product_kit_purchase.rst +++ b/modules/product_kit/tests/scenario_product_kit_purchase.rst @@ -272,7 +272,7 @@ Cancel backorder:: Handle shipment exception:: - >>> shipment_exception = Wizard('purchase.handle.shipment.exception', [purchase]) + >>> shipment_exception = purchase.click('handle_shipment_exception') >>> shipment_exception.execute('handle') >>> len(purchase.moves) diff --git a/modules/product_kit/tests/scenario_product_kit_sale.rst b/modules/product_kit/tests/scenario_product_kit_sale.rst index 25459240bc..2b231d7c8e 100644 --- a/modules/product_kit/tests/scenario_product_kit_sale.rst +++ b/modules/product_kit/tests/scenario_product_kit_sale.rst @@ -263,7 +263,7 @@ Cancel backorder:: Handle shipment exception:: - >>> shipment_exception = Wizard('sale.handle.shipment.exception', [sale]) + >>> shipment_exception = sale.click('handle_shipment_exception') >>> move, = [ ... m for m in shipment_exception.form.recreate_moves ... if m.product == product1] diff --git a/modules/purchase/tests/scenario_purchase.rst b/modules/purchase/tests/scenario_purchase.rst index 9e8bfa87b2..7269e8b0f7 100644 --- a/modules/purchase/tests/scenario_purchase.rst +++ b/modules/purchase/tests/scenario_purchase.rst @@ -525,7 +525,7 @@ Pay the service invoice:: >>> service_invoice.invoice_date = today >>> service_invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [service_invoice]) + >>> pay = service_invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.form.amount = service_invoice.total_amount >>> pay.execute('choice') diff --git a/modules/purchase/tests/scenario_purchase_modify_header.rst b/modules/purchase/tests/scenario_purchase_modify_header.rst index 030e14e665..c8d08e18d0 100644 --- a/modules/purchase/tests/scenario_purchase_modify_header.rst +++ b/modules/purchase/tests/scenario_purchase_modify_header.rst @@ -87,7 +87,7 @@ Create a sale with a line:: Change the party:: - >>> modify_header = Wizard('purchase.modify_header', [purchase]) + >>> modify_header = purchase.click('modify_header') >>> modify_header.form.party == supplier True >>> modify_header.form.party = another diff --git a/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst b/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst index d8314357c5..ecdb715177 100644 --- a/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst +++ b/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst @@ -97,9 +97,7 @@ Create purchase blanket agreement:: Create purchase from blanket agreement:: - >>> create_purchase = Wizard( - ... 'purchase.blanket_agreement.create_purchase', - ... [blanket_agreement]) + >>> create_purchase = blanket_agreement.click('create_purchase') >>> len(create_purchase.form.lines) 1 >>> create_purchase.form.lines[0].remaining_quantity diff --git a/modules/sale/tests/scenario_sale.rst b/modules/sale/tests/scenario_sale.rst index 4b80bfbb4e..2be93f92f8 100644 --- a/modules/sale/tests/scenario_sale.rst +++ b/modules/sale/tests/scenario_sale.rst @@ -333,7 +333,7 @@ Post and Pay Invoice for 4 products:: 5.0 >>> invoice_line.quantity = 4.0 >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> invoice.reload() @@ -595,7 +595,7 @@ Sale services:: Pay the service invoice:: >>> service_invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [service_invoice]) + >>> pay = service_invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> service_invoice.reload() @@ -685,7 +685,7 @@ invoices:: True >>> invoice_line.quantity = 5.0 >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> invoice.reload() diff --git a/modules/sale/tests/scenario_sale_modify_header.rst b/modules/sale/tests/scenario_sale_modify_header.rst index 6dbaaf6016..00b294de7a 100644 --- a/modules/sale/tests/scenario_sale_modify_header.rst +++ b/modules/sale/tests/scenario_sale_modify_header.rst @@ -88,7 +88,7 @@ Create a sale with a line:: Change the party:: - >>> modify_header = Wizard('sale.modify_header', [sale]) + >>> modify_header = sale.click('modify_header') >>> modify_header.form.party == customer True >>> modify_header.form.party = another diff --git a/modules/sale_advance_payment/tests/scenario_advance_payment.rst b/modules/sale_advance_payment/tests/scenario_advance_payment.rst index ec853ec732..fe23a76882 100644 --- a/modules/sale_advance_payment/tests/scenario_advance_payment.rst +++ b/modules/sale_advance_payment/tests/scenario_advance_payment.rst @@ -180,7 +180,7 @@ The advance payment invoice has been created:: Let's pay the advance payment invoice:: - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') @@ -258,7 +258,7 @@ Let's pay the advance payment invoice:: True >>> invoice.invoice_date = None >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> sale.reload() @@ -318,7 +318,7 @@ The advance payment invoice has been created, now pay it:: True >>> invoice.invoice_date = None >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> sale.reload() @@ -363,7 +363,7 @@ Let's cancel the advance invoice:: Handle the exception on the sale level, not recreating the invoice will create the final invoice with the remaining total:: - >>> handle_exception = Wizard('sale.handle.invoice.exception', [sale]) + >>> handle_exception = sale.click('handle_invoice_exception') >>> _ = handle_exception.form.recreate_invoices.pop() >>> handle_exception.execute('handle') @@ -396,7 +396,7 @@ it:: >>> sale.invoice_state 'exception' - >>> handle_exception = Wizard('sale.handle.invoice.exception', [sale]) + >>> handle_exception = sale.click('handle_invoice_exception') >>> handle_exception.execute('handle') >>> sale.reload() >>> _, inv_recreated = sale.advance_payment_invoices @@ -406,7 +406,7 @@ it:: True >>> inv_recreated.invoice_date = None >>> inv_recreated.click('post') - >>> pay = Wizard('account.invoice.pay', [inv_recreated]) + >>> pay = inv_recreated.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') >>> sale.reload() diff --git a/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst b/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst index 1ffff27c16..1ead146905 100644 --- a/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst +++ b/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst @@ -96,9 +96,7 @@ Create sale blanket agreement:: Create sale from blanket agreement:: - >>> create_sale = Wizard( - ... 'sale.blanket_agreement.create_sale', - ... [blanket_agreement]) + >>> create_sale = blanket_agreement.click('create_sale') >>> len(create_sale.form.lines) 1 >>> create_sale.form.lines[0].remaining_quantity diff --git a/modules/sale_gift_card/tests/scenario_sale_point_gift_card.rst b/modules/sale_gift_card/tests/scenario_sale_point_gift_card.rst index fee9bb502b..9f199c5191 100644 --- a/modules/sale_gift_card/tests/scenario_sale_point_gift_card.rst +++ b/modules/sale_gift_card/tests/scenario_sale_point_gift_card.rst @@ -149,7 +149,7 @@ Make a sale:: Overpay:: - >>> payment = Wizard('sale.point.sale.pay', [sale]) + >>> payment = sale.click('pay') >>> payment.form.method = payment_method >>> payment.form.amount = Decimal('600.00') >>> payment.execute('pay') @@ -201,7 +201,7 @@ Make a second sale and pay with gift card:: Pay:: - >>> payment = Wizard('sale.point.sale.pay', [sale]) + >>> payment = sale.click('pay') >>> payment.form.method = payment_method >>> payment.execute('pay') diff --git a/modules/sale_point/tests/scenario_sale_point.rst b/modules/sale_point/tests/scenario_sale_point.rst index 7e2d707d96..b1c0663909 100644 --- a/modules/sale_point/tests/scenario_sale_point.rst +++ b/modules/sale_point/tests/scenario_sale_point.rst @@ -155,7 +155,7 @@ Make a sale:: Overpay by terminal:: - >>> payment = Wizard('sale.point.sale.pay', [sale]) + >>> payment = sale.click('pay') >>> payment.form.method = terminal_method >>> payment.form.amount Decimal('6036.00') diff --git a/modules/sale_point/tests/scenario_sale_point_reporting.rst b/modules/sale_point/tests/scenario_sale_point_reporting.rst index 5bdc9a7af4..bcd812c8be 100644 --- a/modules/sale_point/tests/scenario_sale_point_reporting.rst +++ b/modules/sale_point/tests/scenario_sale_point_reporting.rst @@ -104,7 +104,7 @@ Make a sale:: >>> line.quantity = 1 >>> sale.save() - >>> payment = Wizard('sale.point.sale.pay', [sale]) + >>> payment = sale.click('pay') >>> payment.form.method = cash_method >>> payment.execute('pay') diff --git a/modules/sale_point/tests/scenario_sale_point_session.rst b/modules/sale_point/tests/scenario_sale_point_session.rst index 72a2661d9a..da58f8c255 100644 --- a/modules/sale_point/tests/scenario_sale_point_session.rst +++ b/modules/sale_point/tests/scenario_sale_point_session.rst @@ -147,7 +147,7 @@ Make a sale:: Pay by cash:: - >>> payment = Wizard('sale.point.sale.pay', [sale]) + >>> payment = sale.click('pay') >>> payment.form.method = cash_method >>> payment.form.amount Decimal('20.00') diff --git a/modules/sale_secondary_unit/tests/scenario_sale_blanket_agreement_secondary_unit.rst b/modules/sale_secondary_unit/tests/scenario_sale_blanket_agreement_secondary_unit.rst index 11c0bf68c3..c44faeafcf 100644 --- a/modules/sale_secondary_unit/tests/scenario_sale_blanket_agreement_secondary_unit.rst +++ b/modules/sale_secondary_unit/tests/scenario_sale_blanket_agreement_secondary_unit.rst @@ -86,8 +86,7 @@ Create sale blanket agreement:: Create sale from blanket agreement:: - >>> create_sale = Wizard( - ... 'sale.blanket_agreement.create_sale', [blanket_agreement]) + >>> create_sale = blanket_agreement.click('create_sale') >>> create_sale.form.lines[0].unit == gr True >>> create_sale.execute('create_sale') diff --git a/modules/sale_supply/tests/scenario_sale_supply_shipment_on_invoice.rst b/modules/sale_supply/tests/scenario_sale_supply_shipment_on_invoice.rst index 67349f3484..ad7d00f7fa 100644 --- a/modules/sale_supply/tests/scenario_sale_supply_shipment_on_invoice.rst +++ b/modules/sale_supply/tests/scenario_sale_supply_shipment_on_invoice.rst @@ -103,7 +103,7 @@ Pay for 4 products:: >>> invoice_line, = invoice.lines >>> invoice_line.quantity = 4 >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') @@ -117,7 +117,7 @@ Pay for remaining products:: >>> sale.reload() >>> _, invoice = sale.invoices >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') diff --git a/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment.rst b/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment.rst index cf69b66563..fc53870385 100644 --- a/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment.rst +++ b/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment.rst @@ -253,8 +253,7 @@ As a consequence the sale order is now in exception:: >>> purchase.reload() >>> purchase.shipment_state 'exception' - >>> handle_exception = Wizard('purchase.handle.shipment.exception', - ... [purchase]) + >>> handle_exception = purchase.click('handle_shipment_exception') >>> _ = handle_exception.form.recreate_moves.pop() >>> handle_exception.execute('handle') >>> purchase.reload() @@ -321,9 +320,8 @@ Cancelling the workflow on the purchase step:: Let's reset the purchase request and create a new purchase:: - >>> handle_exception = Wizard( - ... 'purchase.request.handle.purchase.cancellation', - ... [purchase_request]) + >>> handle_exception = purchase_request.click( + ... 'handle_purchase_cancellation_exception') >>> handle_exception.execute('reset') >>> purchase_request.state 'draft' @@ -341,9 +339,8 @@ the sale:: >>> purchase_request.reload() >>> purchase_request.state 'exception' - >>> handle_exception = Wizard( - ... 'purchase.request.handle.purchase.cancellation', - ... [purchase_request]) + >>> handle_exception = purchase_request.click( + ... 'handle_purchase_cancellation_exception') >>> handle_exception.execute('cancel_request') >>> purchase_request.state 'cancelled' @@ -354,7 +351,7 @@ The sale is then in exception:: >>> sale.reload() >>> sale.shipment_state 'exception' - >>> handle_exception = Wizard('sale.handle.shipment.exception', [sale]) + >>> handle_exception = sale.click('handle_shipment_exception') >>> handle_exception.execute('handle') >>> sale.reload() >>> sale.shipment_state diff --git a/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment_on_invoice.rst b/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment_on_invoice.rst index d836c8451d..e04f9c6ba2 100644 --- a/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment_on_invoice.rst +++ b/modules/sale_supply_drop_shipment/tests/scenario_sale_supply_drop_shipment_on_invoice.rst @@ -115,7 +115,7 @@ Pay for 3 products:: >>> invoice_line, = invoice.lines >>> invoice_line.quantity = 3 >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') @@ -134,7 +134,7 @@ Pay for remaining products:: >>> sale.reload() >>> _, invoice = sale.invoices >>> invoice.click('post') - >>> pay = Wizard('account.invoice.pay', [invoice]) + >>> pay = invoice.click('pay') >>> pay.form.payment_method = payment_method >>> pay.execute('choice') diff --git a/modules/stock/tests/scenario_stock_inventory_count.rst b/modules/stock/tests/scenario_stock_inventory_count.rst index 373441a6d9..c362f54431 100644 --- a/modules/stock/tests/scenario_stock_inventory_count.rst +++ b/modules/stock/tests/scenario_stock_inventory_count.rst @@ -65,8 +65,7 @@ Create an inventory:: Count inventory:: - >>> _ = inventory.click('do_count') - >>> count = Wizard('stock.inventory.count', [inventory]) + >>> count = inventory.click('do_count') >>> count.form.search = product diff --git a/modules/stock/tests/scenario_stock_shipment_out.rst b/modules/stock/tests/scenario_stock_shipment_out.rst index bc37fd238a..3380161cf3 100644 --- a/modules/stock/tests/scenario_stock_shipment_out.rst +++ b/modules/stock/tests/scenario_stock_shipment_out.rst @@ -131,7 +131,7 @@ Make 1 unit of the product available:: Assign the shipment now:: - >>> shipment_assign = Wizard('stock.shipment.assign', [shipment_out]) + >>> shipment_assign = shipment_out.click('assign_wizard') >>> len(shipment_assign.form.moves) 1 >>> shipment_assign.execute('end') @@ -155,7 +155,7 @@ Assign the shipment now:: Ignore non assigned moves and pack shipment:: - >>> shipment_assign = Wizard('stock.shipment.assign', [shipment_out]) + >>> shipment_assign = shipment_out.click('assign_wizard') >>> shipment_assign.execute('ignore') >>> sorted([m.quantity for m in shipment_out.inventory_moves]) [0.0, 1.0] diff --git a/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst b/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst index 7d1fd53455..a45348fbc4 100644 --- a/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst +++ b/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst @@ -98,7 +98,7 @@ Make a customer shipment:: Assign manually the first move:: - >>> assign_manual = Wizard('stock.shipment.assign.manual', [shipment]) + >>> assign_manual = shipment.click('assign_manual_wizard') >>> assign_manual.form.move == shipment.inventory_moves[0] True >>> assign_manual.form.move_quantity @@ -129,7 +129,7 @@ Shipment is not yet assigned:: Assign manually remaining move:: - >>> assign_manual = Wizard('stock.shipment.assign.manual', [shipment]) + >>> assign_manual = shipment.click('assign_manual_wizard') >>> assign_manual.form.place = json.dumps([storage_loc2.id, product.id]) >>> assign_manual.execute('assign') diff --git a/modules/stock_lot/tests/scenario_stock_lot_move_add.rst b/modules/stock_lot/tests/scenario_stock_lot_move_add.rst index 683d1fafd9..beaebb838c 100644 --- a/modules/stock_lot/tests/scenario_stock_lot_move_add.rst +++ b/modules/stock_lot/tests/scenario_stock_lot_move_add.rst @@ -59,7 +59,7 @@ Create a lot:: Add few lots:: - >>> add_lots = Wizard('stock.move.add.lots', [move]) + >>> add_lots = move.click('add_lots_wizard') >>> add_lots.form.product== product True >>> add_lots.form.quantity @@ -98,7 +98,7 @@ Check moves:: Add lot to remaining:: - >>> add_lots = Wizard('stock.move.add.lots', [move]) + >>> add_lots = move.click('add_lots_wizard') >>> lot = add_lots.form.lots.new() >>> lot.number = '03' >>> add_lots.execute('add') diff --git a/modules/stock_lot_unit/tests/scenario_stock_lot_unit_move_add.rst b/modules/stock_lot_unit/tests/scenario_stock_lot_unit_move_add.rst index 74f1a9801d..4818dffaa7 100644 --- a/modules/stock_lot_unit/tests/scenario_stock_lot_unit_move_add.rst +++ b/modules/stock_lot_unit/tests/scenario_stock_lot_unit_move_add.rst @@ -61,7 +61,7 @@ Create a lot:: Add a lot:: - >>> add_lots = Wizard('stock.move.add.lots', [move]) + >>> add_lots = move.click('add_lots_wizard') >>> lot = add_lots.form.lots.new() >>> lot.quantity 5.0 diff --git a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst index 8bf00502d2..3d70502a5d 100644 --- a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst +++ b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst @@ -210,7 +210,7 @@ Create the packs and ship the shipment:: >>> pack.moves.append(pack_move) >>> shipment.click('pack') - >>> create_shipping = Wizard('stock.shipment.create_shipping', [shipment]) + >>> create_shipping = shipment.click('create_shipping') >>> shipment.reload() >>> shipment.reference != '' True diff --git a/modules/stock_package_shipping_mygls/tests/scenario_stock_package_shipping_mygls.rst b/modules/stock_package_shipping_mygls/tests/scenario_stock_package_shipping_mygls.rst index 507d32431f..1d1cdfc461 100644 --- a/modules/stock_package_shipping_mygls/tests/scenario_stock_package_shipping_mygls.rst +++ b/modules/stock_package_shipping_mygls/tests/scenario_stock_package_shipping_mygls.rst @@ -193,7 +193,7 @@ Create the packages and ship the shipment:: >>> pack.moves.append(pack_moves[1]) >>> shipment.click('pack') - >>> create_shipping = Wizard('stock.shipment.create_shipping', [shipment]) + >>> create_shipping = shipment.click('create_shipping') >>> shipment.reload() >>> bool(shipment.reference) True diff --git a/modules/stock_package_shipping_sendcloud/tests/scenario_stock_package_shipping_sendcloud.rst b/modules/stock_package_shipping_sendcloud/tests/scenario_stock_package_shipping_sendcloud.rst index e7f956bb2a..43aa4e2298 100644 --- a/modules/stock_package_shipping_sendcloud/tests/scenario_stock_package_shipping_sendcloud.rst +++ b/modules/stock_package_shipping_sendcloud/tests/scenario_stock_package_shipping_sendcloud.rst @@ -210,7 +210,7 @@ Create the packages and ship the shipment:: >>> pack.moves.append(pack_move) >>> shipment.click('pack') - >>> create_shipping = Wizard('stock.shipment.create_shipping', [shipment]) + >>> create_shipping = shipment.click('create_shipping') >>> shipment.reload() >>> bool(shipment.reference) True diff --git a/modules/stock_package_shipping_ups/tests/scenario_shipping_ups.rst b/modules/stock_package_shipping_ups/tests/scenario_shipping_ups.rst index eabd8a0c07..814632534f 100644 --- a/modules/stock_package_shipping_ups/tests/scenario_shipping_ups.rst +++ b/modules/stock_package_shipping_ups/tests/scenario_shipping_ups.rst @@ -217,7 +217,7 @@ Create the packs and ship the shipment:: >>> pack.moves.append(pack_move) >>> shipment.click('pack') - >>> create_shipping = Wizard('stock.shipment.create_shipping', [shipment]) + >>> create_shipping = shipment.click('create_shipping') >>> shipment.reload() >>> shipment.reference != '' True diff --git a/modules/stock_split/tests/scenario_stock_split_shipment.rst b/modules/stock_split/tests/scenario_stock_split_shipment.rst index 4707242a65..f79afc0243 100644 --- a/modules/stock_split/tests/scenario_stock_split_shipment.rst +++ b/modules/stock_split/tests/scenario_stock_split_shipment.rst @@ -77,7 +77,7 @@ Set to waiting and go back to draft to get inventory moves:: Split shipment:: - >>> split_shipment = Wizard('stock.shipment.split', [shipment1]) + >>> split_shipment = shipment1.click('split_wizard') >>> len(split_shipment.form.domain_moves) 2 >>> split_shipment.form.moves.append(Move(move2.id)) diff --git a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst index d20821ea50..62a6e21287 100644 --- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst +++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst @@ -598,7 +598,7 @@ Cancel remaining shipment:: Ignore shipment exception:: - >>> shipment_exception = Wizard('sale.handle.shipment.exception', [sale]) + >>> shipment_exception = sale.click('handle_shipment_exception') >>> move = shipment_exception.form.recreate_moves.pop() >>> shipment_exception.execute('handle') diff --git a/proteus/CHANGELOG b/proteus/CHANGELOG index 032e70b517..14e6195710 100644 --- a/proteus/CHANGELOG +++ b/proteus/CHANGELOG @@ -1,3 +1,5 @@ +* Run action from button + Version 6.6.0 - 2022-10-31 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/proteus/proteus/__init__.py b/proteus/proteus/__init__.py index 654feedb19..0f0c9dfddb 100644 --- a/proteus/proteus/__init__.py +++ b/proteus/proteus/__init__.py @@ -913,7 +913,15 @@ class Model(object): if change is None: cls.save(records) cls.reload(records) # Force reload because save doesn't always - return getattr(proxy, button)([r.id for r in records], context) + record_ids = [r.id for r in records] + action = getattr(proxy, button)(record_ids, context) + if action and not isinstance(action, str): + if isinstance(action, int): + action = config.get_proxy('ir.action').get_action_value( + action, context) + return _convert_action( + action, records, context=context, config=config) + return action else: record, = records values = record._on_change_args(change) @@ -1302,8 +1310,16 @@ class Report(object): def _convert_action(action, data=None, context=None, config=None): if config is None: config = proteus.config.get_config() + records = None if data is None: data = {} + elif isinstance(data, (list, tuple)): + records = data + data = { + 'model': records[0].__class__.__name__, + 'id': records[0].id, + 'ids': [r.id for r in records], + } else: data = data.copy() @@ -1352,7 +1368,9 @@ def _convert_action(action, data=None, context=None, config=None): 'config': config, 'context': context, } - if 'model' in data: + if records is not None: + kwargs['models'] = records + elif 'model' in data: Model_ = Model.get(data['model'], config) config = Model_._config with config.reset_context(), config.set_context(context):