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:
parent
50be667595
commit
f76eff791f
|
@ -44,14 +44,10 @@
|
||||||
I check that Invoice is created for this timesheet.
|
I check that Invoice is created for this timesheet.
|
||||||
-
|
-
|
||||||
!python {model: account.analytic.line}: |
|
!python {model: account.analytic.line}: |
|
||||||
account_id = self.pool.get('account.analytic.line')
|
aline = self.browse(cr, uid, ref('account_analytic_line_developyamlforhrmodule0'))
|
||||||
accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0]
|
|
||||||
exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0]
|
|
||||||
analytic_account_obj = self.pool.get('account.analytic.account')
|
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]
|
data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0]
|
||||||
account_ids = accounts['account_id']
|
partner = aline.account_id.partner_id.id
|
||||||
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
|
|
||||||
partner = account.partner_id.id
|
|
||||||
|
|
||||||
invoice_obj = self.pool.get('account.invoice')
|
invoice_obj = self.pool.get('account.invoice')
|
||||||
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)])
|
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)])
|
||||||
|
@ -63,6 +59,10 @@
|
||||||
product_exp = data['product']
|
product_exp = data['product']
|
||||||
|
|
||||||
assert product == product_exp
|
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.
|
I create final invoice for this analytic account.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Reference in New Issue