[FIX] hr_timesheet_invoice: make YML tests more robust wrt extra demo data, courtesy of Moisés López (Vauxoo)
lp bug: https://launchpad.net/bugs/1222201 fixed bzr revid: odo@openerp.com-20131003100042-g1fjtk36c4dcehng
This commit is contained in:
@@ -79,7 +79,18 @@
|
||||
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
|
||||
-
|
||||
!python {model: hr.timesheet.invoice.create}: |
|
||||
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]})
|
||||
created=self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {
|
||||
"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]
|
||||
})
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
invoice_domain = created.get('domain', False)
|
||||
if invoice_domain:
|
||||
invoice_ids = invoice_pool.search(cr, uid, invoice_domain)
|
||||
invoice_pool.write(cr, uid, invoice_ids, {'origin': 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) \
|
||||
+ '_aaldyfhrm0_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0") ) })
|
||||
else:
|
||||
pass#Assert missed invoice in next section
|
||||
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
@@ -90,7 +101,9 @@
|
||||
partner = aline.account_id.partner_id.id
|
||||
|
||||
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),
|
||||
('origin', '=', 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) + '_aaldyfhrm0_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0") ))
|
||||
])
|
||||
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
|
||||
|
||||
for invoice in invoice_id.invoice_line:
|
||||
@@ -102,4 +115,4 @@
|
||||
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"
|
||||
assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed
|
||||
assert invoice_id.amount_tax == 50, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
assert invoice_id.amount_tax == 50, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
|
||||
@@ -78,7 +78,17 @@
|
||||
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
|
||||
-
|
||||
!python {model: hr.timesheet.invoice.create}: |
|
||||
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1")]})
|
||||
created=self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {
|
||||
"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1")]
|
||||
})
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
invoice_domain = created.get('domain', False)
|
||||
if invoice_domain:
|
||||
invoice_ids = invoice_pool.search(cr, uid, invoice_domain)
|
||||
invoice_pool.write(cr, uid, invoice_ids, {'origin': 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0"))\
|
||||
+ '_aaldyfhrm1_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1") ) })
|
||||
else:
|
||||
pass#Assert missed invoice in next section
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
@@ -89,7 +99,10 @@
|
||||
partner = aline.account_id.partner_id.id
|
||||
|
||||
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),
|
||||
('origin', '=', 'test-hrtsic0_id_'+str( ref("hr_timesheet_invoice_create_0")) + '_aaldyfhrm1_id_'+str( ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule1") ))
|
||||
])
|
||||
|
||||
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
|
||||
|
||||
for invoice in invoice_id.invoice_line:
|
||||
@@ -101,4 +114,4 @@
|
||||
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"
|
||||
assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed
|
||||
assert invoice_id.amount_tax == 40, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
assert invoice_id.amount_tax == 40, "Invoice tax mismatch: %s" % invoice_id.amount_tax
|
||||
|
||||
Reference in New Issue
Block a user