Hello, Im trying to set a domain for my One2many field but its not working, it still showing values out of the condition I set in my domain. In my view I have two one2many fields, 1 who is supposed to show the account with the internal_type = payable and other with the value = receivable, but, when I select 1 account from 1 of the one2many fields for example one of the value as payable, it also set that account to my other one2many field who is supposed to only show the "receivable" accounts.
I also tried to set the domain in the xml but still not working. (for some reason the code of the xml here disappear)
My code:
class PartnerElectronic(models.Model): _inherit = "res.partner"
payable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Payable', domain="[('account_type','='payable')]")
receivable_partner_accounting_entries = fields.One2many('ak.partner.accounting.entries', 'partner_id', string='Receivable', domain="[('account_type','=','receivable')]")
class PartnerPayableAccountingEntries(models.Model):
_description = 'Partner Accounting Entries'
_name = 'ak.partner.accounting.entries'
partner_id = fields.Many2one('res.partner', 'Partner')
account_id = fields.Many2one('account.account', string='Account')
account_type = fields.Selection(related='account_id.internal_type', store = True)
_sql_constraints = [('account_unique','UNIQUE(account_id)',"Partner Account must be unique")]
XML: