Browse Source

Merge PR #896 into 12.0

Signed-off-by NL66278
12.0
OCA-git-bot 5 years ago
parent
commit
e3631c5808
  1. 7
      partner_multi_relation/models/res_partner_relation_all.py
  2. 2
      partner_multi_relation/tests/test_partner_relation_all.py

7
partner_multi_relation/models/res_partner_relation_all.py

@ -7,7 +7,7 @@ import logging
from psycopg2.extensions import AsIs
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.exceptions import MissingError, ValidationError
from odoo.tools import drop_view_if_exists
@ -466,6 +466,9 @@ CREATE OR REPLACE VIEW %%(table)s AS
"""For model 'res.partner.relation' call unlink on underlying model.
"""
for rec in self:
base_resource = rec.get_base_resource()
try:
base_resource = rec.get_base_resource()
except MissingError:
continue
rec.unlink_resource(base_resource)
return True

2
partner_multi_relation/tests/test_partner_relation_all.py

@ -170,6 +170,8 @@ class TestPartnerRelation(TestPartnerRelationCommon):
base_relation = base_model.browse([relation.res_id])
relation.unlink()
self.assertFalse(base_relation.exists())
# Check unlinking record sets with both derived relation records
self.assertTrue(self.relation_all_model.search([]).unlink())
def test_on_change_type_selection(self):
"""Test on_change_type_selection."""

Loading…
Cancel
Save