From f76eff791feaba895ca91f920d0cf3d83d3bd0df Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sat, 4 Dec 2010 15:40:37 +0200 Subject: [PATCH] hr_timesheet_invoice: fix yaml test refactored the pythonic code inside the yaml test to use a single browse object and made that "partner = ..." line really work bzr revid: p_christ@hol.gr-20101204134037-c5mjwehlxr443ogv --- .../test/test_hr_timesheet_invoice.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml index 39c2d9c6769..8dee90094ad 100644 --- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml +++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml @@ -44,14 +44,10 @@ I check that Invoice is created for this timesheet. - !python {model: account.analytic.line}: | - account_id = self.pool.get('account.analytic.line') - accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0] - exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0] + aline = self.browse(cr, uid, ref('account_analytic_line_developyamlforhrmodule0')) analytic_account_obj = self.pool.get('account.analytic.account') data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0] - account_ids = accounts['account_id'] - for account in analytic_account_obj.browse(cr, uid, account_ids, context): - partner = account.partner_id.id + partner = aline.account_id.partner_id.id invoice_obj = self.pool.get('account.invoice') invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)]) @@ -63,6 +59,10 @@ product_exp = data['product'] assert product == product_exp + assert aline.invoice_id, "Invoice created, but analytic line wasn't updated." + assert aline.invoice_id == invoice_id, "Invoice doesn't match the one at analytic line" + # The expected amount is hard coded here, please keep updated: + assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed - I create final invoice for this analytic account. -