Hi, I have a boolean field in account.journal , and I have this function in account.payment:
@api.onchange('payment_type')
def _onchange_payment_type(self):
if not self.invoice_ids:
# Set default partner type for the payment type
if self.payment_type == 'inbound':
self.partner_type = 'customer'
# Set payment method domain
res = self._onchange_journal()
if not res.get('domain', {}):
res['domain'] = {}
res['domain']['journal_id'] = self.payment_type == 'inbound' and [('at_least_one_inbound', '=', True)] or []
res['domain']['journal_id'].append(('type', 'in', ('bank', 'cash')))
if self.invoice_ids:
res['domain']['journal_id'].append(('ap_ar', '=', True))
return res
What this function does is that if I activate the boolean that is in account.journal in any of the journals (in this case for banks and cash), those journals will be hidden when registering a payment in customer invoices... but for some reason it is also applied when registering a payment in vendor invoices, when I only want the function to be applied to customer invoices...
What can I do so that the function does not apply to both customers and suppliers and that it only applies to customer invoices?
Odoo 10, thank you.