Skip to content

Commit

Permalink
fixup! fixup! Merge branch '10.0' into 10.0-partner_multi_relation-ex…
Browse files Browse the repository at this point in the history
…tendable
  • Loading branch information
NL66278 committed Oct 19, 2017
1 parent 9ca7ebc commit 26dbac2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions partner_multi_relation/models/res_partner_relation_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# pylint: disable=method-required-super
"""Abstract model to show each relation from two sides."""
import collections
import logging

from psycopg2.extensions import AsIs

Expand All @@ -12,6 +13,9 @@
from openerp.tools import drop_view_if_exists


_logger = logging.getLogger(__name__)


class ResPartnerRelationAll(models.AbstractModel):
"""Abstract model to show each relation from two sides."""
_auto = False
Expand Down Expand Up @@ -98,7 +102,10 @@ def _register_select_specification(
%(is_inverse)s as is_inverse: used to determine type_selection_id,
"""
key_name = base_name + (is_inverse and '_inverse' or '')
assert key_name not in self._specification_register
if key_name in self._specification_register:
_logger.info(
"Key %s already registered in view specifications."
" Key will be replaced." % key_name)
assert '%%(padding)s' in select_sql
assert '%(key_offset)s' in select_sql
assert '%(is_inverse)s' in select_sql
Expand Down Expand Up @@ -378,12 +385,12 @@ def _correct_vals(self, vals, type_selection):
if 'other_partner_id' in vals:
vals['right_partner_id'] = vals['other_partner_id']
del vals['other_partner_id']
if 'type_selection_id' not in vals:
return vals
if 'type_selection_id' in vals:
vals['type_id'] = type_selection.type_id.id
del vals['type_selection_id']
# Need to switch right and left partner if we are in reverse id:
# Need to switch right and left partner if we are in inverse type:
# TODO: Check correct handling for changing from is_inverse type
# of type_selection to not is_inverse or vice versa:
if 'left_partner_id' in vals or 'right_partner_id' in vals:
if type_selection.is_inverse:
left_partner_id = False
Expand Down

0 comments on commit 26dbac2

Please sign in to comment.