Files
account-financial-tools/account_move_batch_validate/test/batch_validate_then_unmark.yml
2018-10-24 12:50:37 +03:00

88 lines
2.6 KiB
YAML

-
I create a move
-
!record {model: account.move, id: move2}:
journal_id: account.sales_journal
line_id:
- name: Receivable line
account_id: account.a_recv
debit: 2000.0
- name: Sales line
account_id: account.a_sale
credit: 2000.0
-
I check that the move is still draft
-
!assert {model: account.move, id: move2}:
- state == 'draft'
-
I create a wizard with a long ETA
-
!record {model: validate.account.move, id: wiz_marker2}:
action: mark
eta: 10000
-
I set the period and the journal on the wizard
-
!python {model: validate.account.move}: |
move = self.pool['account.move'].browse(cr, uid, ref('move2'),
context=context)
journal_ids = [(6, 0, [move.journal_id.id])]
period_ids = [(6, 0, [move.period_id.id])]
vals = {'journal_ids': journal_ids,
'period_ids': period_ids,
}
self.write(cr, uid, ref('wiz_marker2'), vals, context=context)
-
I run the wizard
-
!python {model: validate.account.move}: |
context['automated_test_execute_now'] = True
self.validate_move(
cr, uid, [ref('wiz_marker2')], context=context
)
-
Now I change my mind and I create a wizard to unmark the moves
-
!record {model: validate.account.move, id: wiz_unmarker3}:
action: unmark
-
I set the period and the journal on the wizard
-
!python {model: validate.account.move}: |
move = self.pool['account.move'].browse(cr, uid, ref('move2'),
context=context)
journal_ids = [(6, 0, [move.journal_id.id])]
period_ids = [(6, 0, [move.period_id.id])]
vals = {'journal_ids': journal_ids,
'period_ids': period_ids,
}
self.write(cr, uid, ref('wiz_unmarker3'), vals, context=context)
-
I run the wizard
-
!python {model: validate.account.move}: |
self.validate_move(
cr, uid, [ref('wiz_unmarker3')], context=context
)
-
Now I checked that my job is done, and the move is still draft
-
!python {model: account.move}: |
from openerp.addons.connector.queue.job import OpenERPJobStorage
from openerp.addons.connector.session import ConnectorSession
session = ConnectorSession(cr, uid, context=context)
storage = OpenERPJobStorage(session)
move = self.browse(cr, uid, ref('move2'), context=context)
myjob = storage.load(move.post_job_uuid)
assert myjob.state == 'done', 'Job is in state {0}, should be done'.format(
myjob.state
)
-
I check that the move is still draft
-
!assert {model: account.move, id: move2}:
- state == 'draft'