mirror of
https://github.com/bringout/oca-ocb-hr.git
synced 2026-04-24 21: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
|
|
@ -33,14 +33,7 @@ class AccountPayment(models.Model):
|
|||
|
||||
def action_open_expense(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'name': self.expense_ids.name,
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'views': [(False, 'form')],
|
||||
'res_model': 'hr.expense',
|
||||
'res_id': self.expense_ids.id,
|
||||
}
|
||||
return self.expense_ids._get_records_action(name=_("Expenses"))
|
||||
|
||||
def _creation_message(self):
|
||||
# EXTENDS mail
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ class AccountTax(models.Model):
|
|||
WHERE EXISTS(
|
||||
SELECT 1
|
||||
FROM expense_tax AS exp
|
||||
WHERE tax_id IN %s
|
||||
AND account_tax.id = exp.tax_id
|
||||
)
|
||||
WHERE account_tax.id = exp.tax_id
|
||||
) AND id IN %s
|
||||
""", [tuple(taxes_to_compute)])
|
||||
|
||||
used_taxes.update([tax[0] for tax in self.env.cr.fetchall()])
|
||||
|
|
|
|||
|
|
@ -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