Run action from button with proteus

This commit is contained in:
Cédric Krier
2023-01-17 14:39:18 +01:00
parent 9ae4f0e80c
commit 68753ff402
52 changed files with 110 additions and 109 deletions
@@ -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)
@@ -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')
@@ -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')
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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')
@@ -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')
@@ -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')
@@ -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
@@ -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
@@ -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'
@@ -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
@@ -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()
@@ -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')
@@ -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
@@ -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])
@@ -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])
@@ -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])
@@ -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])
@@ -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')
@@ -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)
@@ -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]
+1 -1
View File
@@ -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')
@@ -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
@@ -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
+3 -3
View File
@@ -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()
@@ -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
@@ -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()
@@ -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
@@ -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')
@@ -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')
@@ -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')
@@ -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')
@@ -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')
@@ -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')
@@ -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
@@ -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')
@@ -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
@@ -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]
@@ -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')
@@ -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')
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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))
@@ -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')
+2
View File
@@ -1,3 +1,5 @@
* Run action from button
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
+20 -2
View File
@@ -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):