summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_expense/models/hr_expense.py26
1 files changed, 0 insertions, 26 deletions
diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index cb5292a242b..98cd80a1f02 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -510,37 +510,11 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
move_line_values_by_expense = self._get_account_move_line_values()
for expense in self:
- company_currency = expense.company_id.currency_id
- different_currency = expense.currency_id != company_currency
-
# get the account move of the related sheet
move = move_group_by_sheet[expense.sheet_id.id]
# get move line values
move_line_values = move_line_values_by_expense.get(expense.id)
- move_line_dst = move_line_values[-1]
- total_amount = move_line_dst['debit'] or -move_line_dst['credit']
- total_amount_currency = move_line_dst['amount_currency']
-
- # create one more move line, a counterline for the total on payable account
- if expense.payment_mode == 'company_account':
- if not expense.sheet_id.bank_journal_id.default_account_id:
- raise UserError(_("No account found for the %s journal, please configure one.") % (expense.sheet_id.bank_journal_id.name))
- journal = expense.sheet_id.bank_journal_id
- # create payment
- payment_methods = journal.outbound_payment_method_ids if total_amount < 0 else journal.inbound_payment_method_ids
- journal_currency = journal.currency_id or journal.company_id.currency_id
- payment = self.env['account.payment'].create({
- 'payment_method_id': payment_methods and payment_methods[0].id or False,
- 'payment_type': 'outbound' if total_amount < 0 else 'inbound',
- 'partner_id': expense.employee_id.sudo().address_home_id.commercial_partner_id.id,
- 'partner_type': 'supplier',
- 'journal_id': journal.id,
- 'date': expense.date,
- 'currency_id': expense.currency_id.id if different_currency else journal_currency.id,
- 'amount': abs(total_amount_currency) if different_currency else abs(total_amount),
- 'ref': expense.name,
- })
# link move lines to move, and move to expense sheet
move.write({'line_ids': [(0, 0, line) for line in move_line_values]})