mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-25 06:12:03 +02:00
19.0 vanilla
This commit is contained in:
parent
e1d89e11e3
commit
a1f02d8cc7
225 changed files with 2335 additions and 775 deletions
|
|
@ -331,14 +331,15 @@ class HrExpense(models.Model):
|
|||
).ids
|
||||
)
|
||||
for expense in self:
|
||||
if not expense.company_id:
|
||||
# This would be happening when emptying the required company_id field, triggering the "onchange"s.
|
||||
# This would lead to fields being set as editable, instead of using the env company,
|
||||
# recomputing the interface just to be blocked when trying to save we choose not to recompute anything
|
||||
# and wait for a proper company to be inputted.
|
||||
continue
|
||||
if expense.state not in {'draft', 'submitted', 'approved'} and not self.env.su:
|
||||
# Not editable
|
||||
if (
|
||||
not expense.company_id
|
||||
or (expense.state not in {'draft', 'submitted', 'approved'} and not self.env.su)
|
||||
):
|
||||
# When emptying the required company_id field, onchanges are triggered.
|
||||
# To avoid recomputing the interface without a company (which could
|
||||
# temporarily make fields editable), we do not recompute anything and wait
|
||||
# for a proper company to be set. The interface is also made not editable
|
||||
# when the state is not draft/submitted/approved and the user is not a superuser.
|
||||
expense.is_editable = False
|
||||
continue
|
||||
|
||||
|
|
@ -1081,12 +1082,8 @@ class HrExpense(models.Model):
|
|||
|
||||
expense_description = msg_dict.get('subject', '')
|
||||
|
||||
if employee.user_id:
|
||||
company = employee.user_id.company_id
|
||||
currencies = company.currency_id | employee.user_id.company_ids.mapped('currency_id')
|
||||
else:
|
||||
company = employee.company_id
|
||||
currencies = company.currency_id
|
||||
company = employee.company_id
|
||||
currencies = company.currency_id
|
||||
|
||||
if not company: # ultimate fallback, since company_id is required on expense
|
||||
company = self.env.company
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue