|
@ -123,8 +123,8 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
context = {} |
|
|
context = {} |
|
|
res = super(MergePartnerAutomatic, self |
|
|
res = super(MergePartnerAutomatic, self |
|
|
).default_get(cr, uid, fields, context) |
|
|
).default_get(cr, uid, fields, context) |
|
|
if (context.get('active_model') == 'res.partner' |
|
|
|
|
|
and context.get('active_ids')): |
|
|
|
|
|
|
|
|
if (context.get('active_model') == 'res.partner' and |
|
|
|
|
|
context.get('active_ids')): |
|
|
partner_ids = context['active_ids'] |
|
|
partner_ids = context['active_ids'] |
|
|
res['state'] = 'selection' |
|
|
res['state'] = 'selection' |
|
|
res['partner_ids'] = partner_ids |
|
|
res['partner_ids'] = partner_ids |
|
@ -212,8 +212,8 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
'%(column)s IN %%s') % query_dic |
|
|
'%(column)s IN %%s') % query_dic |
|
|
cr.execute(query, (dst_partner.id, partner_ids,)) |
|
|
cr.execute(query, (dst_partner.id, partner_ids,)) |
|
|
|
|
|
|
|
|
if (column == proxy._parent_name |
|
|
|
|
|
and table == 'res_partner'): |
|
|
|
|
|
|
|
|
if (column == proxy._parent_name and |
|
|
|
|
|
table == 'res_partner'): |
|
|
query = """ |
|
|
query = """ |
|
|
WITH RECURSIVE cycle(id, parent_id) AS ( |
|
|
WITH RECURSIVE cycle(id, parent_id) AS ( |
|
|
SELECT id, parent_id FROM res_partner |
|
|
SELECT id, parent_id FROM res_partner |
|
@ -316,8 +316,8 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
|
|
|
|
|
|
values = dict() |
|
|
values = dict() |
|
|
for column, field in columns.iteritems(): |
|
|
for column, field in columns.iteritems(): |
|
|
if (field._type not in ('many2many', 'one2many') |
|
|
|
|
|
and not isinstance(field, fields.function)): |
|
|
|
|
|
|
|
|
if (field._type not in ('many2many', 'one2many') and |
|
|
|
|
|
not isinstance(field, fields.function)): |
|
|
for item in itertools.chain(src_partners, [dst_partner]): |
|
|
for item in itertools.chain(src_partners, [dst_partner]): |
|
|
if item[column]: |
|
|
if item[column]: |
|
|
values[column] = write_serializer(column, |
|
|
values[column] = write_serializer(column, |
|
@ -350,8 +350,8 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
"together. You can re-open the wizard several times if " |
|
|
"together. You can re-open the wizard several times if " |
|
|
"needed.")) |
|
|
"needed.")) |
|
|
|
|
|
|
|
|
if (openerp.SUPERUSER_ID != uid |
|
|
|
|
|
and len(set(partner.email for partner |
|
|
|
|
|
|
|
|
if (openerp.SUPERUSER_ID != uid and |
|
|
|
|
|
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 orm.except_orm( |
|
@ -371,10 +371,10 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
src_partners = ordered_partners[:-1] |
|
|
src_partners = ordered_partners[:-1] |
|
|
_logger.info("dst_partner: %s", dst_partner.id) |
|
|
_logger.info("dst_partner: %s", dst_partner.id) |
|
|
|
|
|
|
|
|
if (openerp.SUPERUSER_ID != uid |
|
|
|
|
|
and self._model_is_installed(cr, uid, 'account.move.line', |
|
|
|
|
|
context=context) |
|
|
|
|
|
and self.pool.get('account.move.line' |
|
|
|
|
|
|
|
|
if (openerp.SUPERUSER_ID != uid and |
|
|
|
|
|
self._model_is_installed(cr, uid, 'account.move.line', |
|
|
|
|
|
context=context) and |
|
|
|
|
|
self.pool.get('account.move.line' |
|
|
).search(cr, openerp.SUPERUSER_ID, |
|
|
).search(cr, openerp.SUPERUSER_ID, |
|
|
[('partner_id', |
|
|
[('partner_id', |
|
|
'in', |
|
|
'in', |
|
@ -617,8 +617,8 @@ class MergePartnerAutomatic(orm.TransientModel): |
|
|
models['res.users'] = 'partner_id' |
|
|
models['res.users'] = 'partner_id' |
|
|
|
|
|
|
|
|
if (self._model_is_installed(cr, uid, 'account.move.line', |
|
|
if (self._model_is_installed(cr, uid, 'account.move.line', |
|
|
context=context) |
|
|
|
|
|
and this.exclude_journal_item): |
|
|
|
|
|
|
|
|
context=context) and |
|
|
|
|
|
this.exclude_journal_item): |
|
|
models['account.move.line'] = 'partner_id' |
|
|
models['account.move.line'] = 'partner_id' |
|
|
|
|
|
|
|
|
return models |
|
|
return models |
|
|