Changeset 1048 in main


Ignore:
Timestamp:
04/26/12 10:16:36 (7 years ago)
Author:
agalech
Message:

new attribute for class document3D.Product and the relative migration

Location:
trunk/openPLM/document3D
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/document3D/views.py

    r1034 r1048  
    8383                except: 
    8484                    pass 
    85          
     85 
     86        else: 
     87            try: 
     88 
     89                doc = Document3D.objects.get(PartDecompose=self.part) 
     90                file_stp = is_decomposable(doc) 
     91                if file_stp and msg: 
     92                    decompose_valid.append((doc, file_stp)) 
     93                elif file_stp: 
     94                    return True 
     95            except: 
     96                pass  
     97       
    8698         
    8799        self.decompose_valid = decompose_valid 
     
    179191    if not stp_file.document_id in doc_linked_to_part: 
    180192        raise ValueError("Not allowed operation.The Document and the Part are not linked") 
    181     if Document3D.objects.filter(PartDecompose=obj.object).exists(): 
    182         raise ValueError("Not allowed operation.This Part already forms a part of another decomposition") 
     193    if Document3D.objects.filter(PartDecompose=obj.object).exists() and not Document3D.objects.get(PartDecompose=obj.object).id==stp_file.document.id: #a same document could be re-decomposed for the same part 
     194         
     195        raise ValueError("Not allowed operation.This Part already forms a part of another decomposition ") 
    183196    try: 
    184197        doc3D=Document3D.objects.get(id=stp_file.document_id) 
     
    186199        raise ValueError("Not allowed operation.The document is not a subtype of document3D") 
    187200 
    188     if doc3D.PartDecompose: 
     201    if doc3D.PartDecompose and not doc3D.PartDecompose.id==obj.object.id: 
    189202        raise ValueError("Not allowed operation.This Document already forms a part of another decomposition") 
    190203         
     
    195208 
    196209        extra_errors="" 
    197         product=ArbreFile_to_Product(stp_file) 
     210        product=ArbreFile_to_Product(stp_file,recursif=None) 
    198211        last_time_modification=Form_save_time_last_modification(request.POST) 
    199212        obj.block_mails() 
     
    277290 
    278291        last_time_modification.fields["last_modif_microseconds"].initial=document_controller.mtime.microsecond 
    279         product=ArbreFile_to_Product(stp_file) 
     292        product=ArbreFile_to_Product(stp_file,recursif=None) 
    280293        if not product or not product.links: 
    281294            return HttpResponseRedirect(obj.plmobject_url+"BOM-child/") 
Note: See TracChangeset for help on using the changeset viewer.