Small script to find duplicate contact_mechanisms for parties in tryton

(0 comments)

Just a little script to find duplicate contact_mechanism entries on parties in tryton (how i run tryton stuff using ipython and proteus):

 for p in Party.find():
     cms = p.contact_mechanisms
     if cms:
         nos = []
         for cm in cms:
             if f'{cm.type} {cm.value_compact}' in nos:
                 print(f'duplicate contact mechanism {p.code=} {p.name=} {cm.value} {cm.type}')
             else:
                 nos.append(f'{cm.type} {cm.value_compact}')

I just ran this from ipython to find out if there are a lot of duplicates - turns out i had barely anything (and i fixed that before re-running the imports for good in the old system).

Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

Recent Posts

Archive

2021
2020
2019
2018
2014
2012
2011
2010
2009
2008
2007

Categories

Authors

Feeds

RSS / Atom