[FIX] hr_expense : remove the default_partner_bank_id
If we try to register payments for multiple expenses with multiple bank accounts from the expenses app, there is a traceback regarding the bank ids, as a singleton value was expected. We can do the same process from the vendor bills and the payment will be registered fine. 1. Create two expenses against two employees having different bank accounts. 2. Approve and post both of them. 3. In the 'To Pay' expense list, select the both expense reports and click on register payment. Current Behaviour: A traceback is thrown that a singleton value was expected. This is because there were multiple bank accounts against that payment. Expected Behaviour: The payment should be registered without any problem. OPW-3272500 closes odoo/odoo#132774 X-original-commit: c7f62dca74e89659230ebc7a02d290cd62dd8323 Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com> Signed-off-by: Hamza Islam (hisl) <hisl@odoo.com>
This commit is contained in:
@@ -1366,10 +1366,12 @@ class HrExpenseSheet(models.Model):
|
||||
|
||||
def action_register_payment(self):
|
||||
''' Open the account.payment.register wizard to pay the selected journal entries.
|
||||
There can be more than one bank_account_id in the expense sheet when registering payment for multiple expenses.
|
||||
The default_partner_bank_id is set only if there is one available, if more than one the field is left empty.
|
||||
:return: An action opening the account.payment.register wizard.
|
||||
'''
|
||||
return self.account_move_ids.with_context(
|
||||
default_partner_bank_id=self.employee_id.sudo().bank_account_id.id
|
||||
default_partner_bank_id=self.employee_id.sudo().bank_account_id.id if len(self.employee_id.sudo().bank_account_id.ids) <= 1 else None,
|
||||
).action_register_payment()
|
||||
|
||||
def action_open_expense_view(self):
|
||||
|
||||
Reference in New Issue
Block a user