mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 18:52:02 +02:00
19.0 vanilla
This commit is contained in:
parent
e1d89e11e3
commit
a1f02d8cc7
225 changed files with 2335 additions and 775 deletions
|
|
@ -1095,3 +1095,20 @@ class TestExpenses(TestExpenseCommon):
|
|||
|
||||
# Check that there is no fourth autobalancing line on the account move
|
||||
self.assertEqual(expense.account_move_id.line_ids.mapped('balance'), [86.96, 13.04, -100.0])
|
||||
|
||||
def test_remove_company_id_from_hr_expense(self):
|
||||
expense = self.create_expenses({
|
||||
'name': 'Company PC 1000 + 15%',
|
||||
'employee_id': self.expense_employee.id,
|
||||
'product_id': self.product_c.id,
|
||||
'total_amount_currency': 1000.00,
|
||||
'date': '2021-10-12',
|
||||
'payment_mode': 'company_account',
|
||||
'company_id': self.company_data['company'].id,
|
||||
'tax_ids': [Command.set(self.tax_purchase_a.ids)],
|
||||
})
|
||||
form = Form(expense)
|
||||
form.company_id = self.env['res.company']
|
||||
self.assertEqual(form.is_editable, False)
|
||||
form.company_id = self.env.company
|
||||
self.assertEqual(form.is_editable, True)
|
||||
|
|
|
|||
|
|
@ -228,3 +228,27 @@ class TestExpensesMailImport(TestExpenseCommon):
|
|||
|
||||
expense = self.env['hr.expense'].message_new(message)
|
||||
self.assertRaisesRegex(UserError, r"You can not submit an expense without a category\.", expense.action_submit)
|
||||
|
||||
def test_import_expense_from_email_several_companies_one_employee(self):
|
||||
""" Import an expense for a user who has access to several companies,
|
||||
but has only one employee profile in the company that is not his default one.
|
||||
"""
|
||||
user = self.expense_user_employee
|
||||
company_2 = user.company_ids[1]
|
||||
# Change the default company of the user to the second one,
|
||||
# which is different from the company of the employee
|
||||
user.company_id = company_2.id
|
||||
|
||||
message_parsed = {
|
||||
'message_id': "XYZ",
|
||||
'subject': 'New expense',
|
||||
'email_from': user.email,
|
||||
'to': 'catchall@yourcompany.com',
|
||||
'body': "For which company is this expense?",
|
||||
'attachments': [],
|
||||
}
|
||||
expense = self.env['hr.expense'].message_new(message_parsed)
|
||||
self.assertRecordValues(expense, [{
|
||||
'employee_id': self.expense_employee.id,
|
||||
'company_id': self.expense_employee.company_id.id,
|
||||
}])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue