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