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
This commit is contained in:
P. Christeas 2010-12-04 15:40:37 +02:00
parent 50be667595
commit f76eff791f
1 changed files with 6 additions and 6 deletions

View File

@ -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.
-