[FIX] account_voucher: right domain on payment method
When creating a receipt with immediate payment: Before this commit, the field payment method displayed all the journals bank or cash After this commit, only journals made for receiving/sending payment (in function of the type of receipt) are displayed OPW 1819672 closes #23677
This commit is contained in:
@@ -146,6 +146,7 @@ class AccountVoucher(models.Model):
|
||||
|
||||
@api.onchange('partner_id', 'pay_now')
|
||||
def onchange_partner_id(self):
|
||||
pay_journal_domain = [('type', 'in', ['cash', 'bank'])]
|
||||
if self.pay_now != 'pay_now':
|
||||
if self.partner_id:
|
||||
self.account_id = self.partner_id.property_account_receivable_id \
|
||||
@@ -155,6 +156,12 @@ class AccountVoucher(models.Model):
|
||||
domain = [('deprecated', '=', False), ('internal_type', '=', account_type)]
|
||||
|
||||
self.account_id = self.env['account.account'].search(domain, limit=1)
|
||||
else:
|
||||
if self.voucher_type == 'purchase':
|
||||
pay_journal_domain.append(('outbound_payment_method_ids', '!=', False))
|
||||
else:
|
||||
pay_journal_domain.append(('inbound_payment_method_ids', '!=', False))
|
||||
return {'domain': {'payment_journal_id': pay_journal_domain}}
|
||||
|
||||
@api.multi
|
||||
def proforma_voucher(self):
|
||||
|
||||
Reference in New Issue
Block a user