Ignore:
Timestamp:
10/05/11 11:42:12 (8 years ago)
Author:
pcosquer
Message:

When a new object is created, sets the sponsor as the signer if
the sponsor is not the company

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/controllers/plmobject.py

    r367 r375  
    105105        # add links 
    106106        models.PLMObjectUserLink.objects.create(plmobject=obj, user=user, role="owner") 
     107        try: 
     108            l = models.DelegationLink.objects.get(delegatee=user, 
     109                    role=models.ROLE_SPONSOR) 
     110            sponsor = l.delegator 
     111            if sponsor.username == settings.COMPANY: 
     112                sponsor = user 
     113        except models.DelegationLink.DoesNotExist: 
     114            sponsor = user 
    107115        for i in range(len(obj.lifecycle.to_states_list()) - 1): 
    108             models.PLMObjectUserLink.objects.create(plmobject=obj, user=user, 
     116            models.PLMObjectUserLink.objects.create(plmobject=obj, user=sponsor, 
    109117                                                    role=level_to_sign_str(i)) 
    110118        return res 
Note: See TracChangeset for help on using the changeset viewer.