|
@ -15,9 +15,9 @@ from openerp.tools import mute_logger |
|
|
from .validate_email import validate_email |
|
|
from .validate_email import validate_email |
|
|
|
|
|
|
|
|
import openerp |
|
|
import openerp |
|
|
from openerp.osv import orm |
|
|
|
|
|
from openerp.osv import fields |
|
|
|
|
|
from openerp.osv.orm import browse_record |
|
|
|
|
|
|
|
|
import openerp.osv.fields as fields |
|
|
|
|
|
from openerp.osv.orm import TransientModel, browse_record |
|
|
|
|
|
from openerp.exceptions import except_orm |
|
|
from openerp.tools.translate import _ |
|
|
from openerp.tools.translate import _ |
|
|
|
|
|
|
|
|
pattern = re.compile(r"&(\w+?);") |
|
|
pattern = re.compile(r"&(\w+?);") |
|
@ -58,7 +58,7 @@ def is_integer_list(ids): |
|
|
return all(isinstance(i, (int, long)) for i in ids) |
|
|
return all(isinstance(i, (int, long)) for i in ids) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MergePartnerLine(orm.TransientModel): |
|
|
|
|
|
|
|
|
class MergePartnerLine(TransientModel): |
|
|
_name = 'base.partner.merge.line' |
|
|
_name = 'base.partner.merge.line' |
|
|
|
|
|
|
|
|
_columns = { |
|
|
_columns = { |
|
@ -71,7 +71,7 @@ class MergePartnerLine(orm.TransientModel): |
|
|
_order = 'min_id asc' |
|
|
_order = 'min_id asc' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MergePartnerAutomatic(orm.TransientModel): |
|
|
|
|
|
|
|
|
class MergePartnerAutomatic(TransientModel): |
|
|
""" |
|
|
""" |
|
|
The idea behind this wizard is to create a list of potential partners to |
|
|
The idea behind this wizard is to create a list of potential partners to |
|
|
merge. We use two objects, the first one is the wizard for the end-user. |
|
|
merge. We use two objects, the first one is the wizard for the end-user. |
|
@ -338,7 +338,7 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
if parent_id and parent_id != dst_partner.id: |
|
|
if parent_id and parent_id != dst_partner.id: |
|
|
try: |
|
|
try: |
|
|
dst_partner.write({'parent_id': parent_id}) |
|
|
dst_partner.write({'parent_id': parent_id}) |
|
|
except (orm.except_orm, orm.except_orm): |
|
|
|
|
|
|
|
|
except except_orm: |
|
|
_logger.info('Skip recursive partner hierarchies for ' |
|
|
_logger.info('Skip recursive partner hierarchies for ' |
|
|
'parent_id %s of partner: %s', |
|
|
'parent_id %s of partner: %s', |
|
|
parent_id, dst_partner.id) |
|
|
parent_id, dst_partner.id) |
|
@ -353,7 +353,7 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
if len(partner_ids) > 3: |
|
|
if len(partner_ids) > 3: |
|
|
raise orm.except_orm( |
|
|
|
|
|
|
|
|
raise except_orm( |
|
|
_('Error'), |
|
|
_('Error'), |
|
|
_("For safety reasons, you cannot merge more than 3 contacts " |
|
|
_("For safety reasons, you cannot merge more than 3 contacts " |
|
|
"together. You can re-open the wizard several times if " |
|
|
"together. You can re-open the wizard several times if " |
|
@ -363,7 +363,7 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
len(set(partner.email for partner |
|
|
len(set(partner.email for partner |
|
|
in proxy.browse(cr, uid, partner_ids, |
|
|
in proxy.browse(cr, uid, partner_ids, |
|
|
context=context))) > 1): |
|
|
context=context))) > 1): |
|
|
raise orm.except_orm( |
|
|
|
|
|
|
|
|
raise except_orm( |
|
|
_('Error'), |
|
|
_('Error'), |
|
|
_("All contacts must have the same email. Only the " |
|
|
_("All contacts must have the same email. Only the " |
|
|
"Administrator can merge contacts with different emails.")) |
|
|
"Administrator can merge contacts with different emails.")) |
|
@ -388,7 +388,7 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
[('partner_id', 'in', [partner.id for partner |
|
|
[('partner_id', 'in', [partner.id for partner |
|
|
in src_partners])], |
|
|
in src_partners])], |
|
|
context=context)): |
|
|
context=context)): |
|
|
raise orm.except_orm( |
|
|
|
|
|
|
|
|
raise except_orm( |
|
|
_('Error'), |
|
|
_('Error'), |
|
|
_("Only the destination contact may be linked to existing " |
|
|
_("Only the destination contact may be linked to existing " |
|
|
"Journal Items. Please ask the Administrator if you need to" |
|
|
"Journal Items. Please ask the Administrator if you need to" |
|
@ -525,7 +525,7 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
if not groups: |
|
|
if not groups: |
|
|
raise orm.except_orm(_('Error'), |
|
|
|
|
|
|
|
|
raise except_orm(_('Error'), |
|
|
_("You have to specify a filter for your " |
|
|
_("You have to specify a filter for your " |
|
|
"selection")) |
|
|
"selection")) |
|
|
|
|
|
|
|
|