There is company_id field in res.partner model. I also have a relational field named 'property_account_payable_id'
property_account_payable_id = fields.Many2one('account.account')
property_account_payable_id field is related to 'account.account' model.
I want to make a condition where on creating or updating a partner will check if 'res.partner' model's company_id is same as relational 'account.account' model's company_id. This is not only for 'res.partner' model, I want to make this condition globally on all the models where there is own company_id and relational table company_id field.
How can I achieve this in odoo?