[IMP] Minore changes
authorDBR (OpenERP) <dbr@tinyerp.com>
Thu, 7 Mar 2013 07:43:08 +0000 (13:13 +0530)
committerDBR (OpenERP) <dbr@tinyerp.com>
Thu, 7 Mar 2013 07:43:08 +0000 (13:13 +0530)
bzr revid: dbr@tinyerp.com-20130307074308-nsbxibxk128mjker

addons/account_analytic_analysis/test/account_analytic_analysis.yml

index f789a74..d5dc272 100644 (file)
             'name': 'Agrement of the loan EMI',
             'template_id': ref("account_analytic_account_0"),
     }
-    context = None
-    contract_id = self.create(cr, uid, data, context=context)
+    contract_id = self.create(cr, uid, data)
     assert contract_id, "contract has not been created correctly"
-    template = self.browse(cr, uid, ref('account_analytic_account_0'),context=context)
-    res = self.on_change_template(cr, uid, [contract_id], template.id, context=context)
-    self.write(cr, uid, [contract_id], res['value'], context=context)
+    template = self.browse(cr, uid, ref('account_analytic_account_0'))
+    res = self.on_change_template(cr, uid, [contract_id], template.id)
+    self.write(cr, uid, [contract_id], res['value'])
     line_obj = self.pool.get('account.analytic.invoice.line')
-    contract = self.browse(cr, uid, contract_id, context=context)
+    contract = self.browse(cr, uid, contract_id)
     assert template.partner_id.id == contract.partner_id.id or res['value']['partner_id'], "Customer of contract is not match with Contract Template"
     assert template.company_id.id == contract.company_id.id, "Company of contract is not match with Contract Template"
     assert template.date_start == contract.date_start, "Start Date of contract is not match with Contract Template"
 -
   !python {model: account.analytic.account}: |
     context = None
-    contract_id = self.search(cr, uid, [('name','=','Agrement of the loan EMI')])
+    contract_id = self.search(cr, uid, [('name','=','Agrement of the loan EMI')])[0]
     assert contract_id, "contract has not been created."
     template = self.browse(cr, uid, ref('account_analytic_account_0'),context=context)
-    res = self.on_change_template(cr, uid, contract_id, template.id, context=context)
+    res = self.on_change_template(cr, uid, [contract_id], template.id, context=context)
     self.cron_create_invoice(cr, uid, False, False, None)
     invoice_obj = self.pool.get('account.invoice')
     contract_invoice = invoice_obj.search(cr, uid, [('origin','=','Agrement of the loan EMI')])
-    template_invoice = invoice_obj.search(cr, uid, [('origin','=','Loan EMI Agrement')])
-    inv = invoice_obj.browse(cr ,uid, contract_invoice, context=context)[0]
-    contract = self.browse(cr, uid, contract_id, context=context)[0]
+    inv = invoice_obj.browse(cr ,uid, contract_invoice)[0]
+    contract = self.browse(cr, uid, contract_id)
     result = invoice_obj._amount_all(cr, uid, contract_invoice, '', {}, {})
     assert inv.state == 'draft', 'Contract created invoice not in draft state.'
     assert inv.amount_untaxed == contract.amount_untaxed, "Contract Invoice's Total tax excluded is not same as contract"