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

62 lines
1.7 KiB
YAML

-
I create a move
-
!record {model: account.move, id: move1}:
journal_id: account.sales_journal
line_id:
- name: Receivable line
account_id: account.a_recv
debit: 1000.0
- name: Sales line
account_id: account.a_sale
credit: 1000.0
-
I check that the move is still draft
-
!assert {model: account.move, id: move1}:
- state == 'draft'
-
I create a wizard
-
!record {model: validate.account.move, id: wiz_marker1}:
action: mark
-
I set the period and the journal on the wizard
-
!python {model: validate.account.move}: |
move = self.pool['account.move'].browse(cr, uid, ref('move1'),
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_marker1'), 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_marker1')], context=context
)
-
I read the UUID from the move, I dequeue the job and run it
-
!python {model: account.move}: |
from openerp.addons.connector.queue.job import OpenERPJobStorage
from openerp.addons.connector.session import ConnectorSession
move = self.browse(cr, uid, ref('move1'), context=context)
uuid = move.post_job_uuid
session = ConnectorSession(cr, uid, context=context)
storage = OpenERPJobStorage(session)
myjob = storage.load(uuid)
myjob.perform(session)
-
I check that the move is now approved
-
!assert {model: account.move, id: move1}:
- state == 'posted'