Hi,
I want to set value on payment method & customer bank account field in customer payment form (in invoicing module). change will be triggered based on choice in Journal field.
how can I do that?
I already try with customize on change and compute, but still didn't work.
Please provide on change/compute code you were using in order to understand the issue better. Also, which odoo version you're using?
Hi @Karan BK, I'm using Odoo 16
this is compute that I'm using
@api.depends('available_payment_method_line_ids')
def _compute_payment_method_line_id(self):
''' Compute the 'payment_method_line_id' field.
This field is not computed in '_compute_payment_method_line_fields' because it's a stored editable one.
'''
for pay in self:
available_payment_method_lines = pay.available_payment_method_line_ids
# Select the first available one by default.
if pay.payment_method_line_id in available_payment_method_lines:
pay.payment_method_line_id = pay.payment_method_line_id
elif available_payment_method_lines:
pay.payment_method_line_id = available_payment_method_lines[0]._origin
else:
pay.payment_method_line_id = False
and this is the field
payment_method_line_id = fields.Many2one('account.payment.method.line', string='Payment Method',
readonly=False, store=True, copy=False,
compute='_compute_payment_method_line_id',
domain="[('id', 'in', available_payment_method_line_ids)]"