[FIX] tests and use new api

This commit is contained in:
Pierrick Brun
2018-10-11 12:37:44 +02:00
parent b023a9bc31
commit 27aa2e34dd
6 changed files with 26 additions and 30 deletions

View File

@@ -30,7 +30,7 @@
I prepare the wizard context.
-
!python {model: account.invoice.refund}: |
claim_lines = self.pool.get('claim.line').search(cr, uid, [('claim_id','=',ref('claim_refund'))])
claim_lines = self.env['claim.line'].search([('claim_id','=',ref('claim_refund'))])
context.update({'active_model': 'crm_claim', 'active_id': ref('claim_refund'), 'claim_id': ref('claim_refund'), 'invoice_ids': [ref('account_invoice_claim_refund')] })
-
I create a refund wizard
@@ -42,15 +42,15 @@
I launch the refund wizard
-
!python {model: account.invoice.refund}: |
self.compute_refund(cr, uid, [ref('wizard_claim_refund')], 'refund', context=context)
self.compute_refund([ref('wizard_claim_refund')], 'refund', context=context)
-
I check that a refund linked to the claim has been created.
-
!python {model: account.invoice}: |
refund = self.search(cr, uid, [('type', '=', 'out_refund'),('claim_id', '=', ref('claim_refund'))])
refund = self.search([('type', '=', 'out_refund'),('claim_id', '=', ref('claim_refund'))])
assert refund, "The refund is created"
refund_line_ids = self.pool.get('account.invoice.line').search(cr, uid, [('invoice_id','=',refund[0])])
refund_line_ids = self.env['account.invoice.line'].search([('invoice_id','=',refund[0])])
assert len(refund_line_ids) == 2, "It contains 2 lines, as excepted"
refund_lines = self.pool.get('account.invoice.line').browse(cr, uid, refund_line_ids)
refund_lines = self.env['account.invoice.line'].browse(refund_line_ids)
assert ref('product.product_product_4') in [refund_lines[0].product_id.id, refund_lines[1].product_id.id], "First line is checked"
assert ref('product.product_product_5') in [refund_lines[0].product_id.id, refund_lines[1].product_id.id], "Second line is checked"