[MERGE] hr_timesheet_invoice: make YML tests more robust wrt extra demo data, courtesy of Moisés López (Vauxoo)
bzr revid: odo@openerp.com-20131003145428-wdhjxwmdzx7i1nue
This commit is contained in:
@@ -79,7 +79,15 @@
|
||||
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")]})
|
||||
action_result = 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 = action_result['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") ) })
|
||||
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
@@ -90,7 +98,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 +112,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,14 @@
|
||||
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")]})
|
||||
action_result = 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 = action_result['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") ) })
|
||||
-
|
||||
I check that Invoice is created for this timesheet.
|
||||
-
|
||||
@@ -89,7 +96,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 +111,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