[FIX] hr_expense: correct check for bank settings
TLDR: fix a mess in journal fields check Steps: * Create expense "paid by Company" * Click Post Before: * AttributeError: 'account.journal' object has no attribute 'default_credit_account_id' After: * Either posted or shows user error about journal misconfiguration Notes: * Field ``default_credit_account_id`` is replaced in https://github.com/odoo/odoo/commit/41f119d5325dfbbf916d1d34e63946646ed4d44c * The error is introduced during incorrect forward-port #58852 --- task-2355177 closes odoo/odoo#59780 X-original-commit: 5c0fca662279702115b5e61c8227f82086693e38 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -1036,6 +1036,13 @@ msgstr ""
|
||||
|
||||
#. module: hr_expense
|
||||
#: code:addons/hr_expense/models/hr_expense.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"No Outstanding Payments Account found for the %s journal, please configure "
|
||||
"one."
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_expense
|
||||
#: code:addons/hr_expense/models/hr_expense.py:0
|
||||
#, python-format
|
||||
msgid "No account found for the %s journal, please configure one."
|
||||
|
||||
@@ -387,8 +387,8 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
|
||||
self.ensure_one()
|
||||
account_dest = self.env['account.account']
|
||||
if self.payment_mode == 'company_account':
|
||||
if not self.sheet_id.bank_journal_id.default_credit_account_id:
|
||||
raise UserError(_("No credit account found for the %s journal, please configure one.") % (self.sheet_id.bank_journal_id.name))
|
||||
if not self.sheet_id.bank_journal_id.payment_credit_account_id:
|
||||
raise UserError(_("No Outstanding Payments Account found for the %s journal, please configure one.") % (self.sheet_id.bank_journal_id.name))
|
||||
account_dest = self.sheet_id.bank_journal_id.payment_credit_account_id.id
|
||||
else:
|
||||
if not self.employee_id.sudo().address_home_id:
|
||||
|
||||
Reference in New Issue
Block a user