Changeset 1256 in main


Ignore:
Timestamp:
06/25/12 15:04:36 (9 years ago)
Author:
zali
Message:

Document Controller : allow users to cancel a document even if it contains file(s)

Location:
trunk/openPLM/plmapp
Files:
2 edited

Legend:

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

    r1232 r1256  
    500500            res = res and not self.get_attached_parts() 
    501501            if (not res) and raise_ : 
    502                 raise PermissionError("This document has is related to a part.") 
    503             res = res and not models.DocumentFile.objects.filter(document=self.object).exists() 
    504             if (not res) and raise_ : 
    505                 raise PermissionError("This document contains one or more files. ") 
     502                raise PermissionError("This document is related to a part.") 
    506503        return res 
  • trunk/openPLM/plmapp/tests/controllers/document.py

    r1234 r1256  
    344344        res = super(DocumentControllerTest, self).assertCancelError(ctrl) 
    345345        res = res or bool(ctrl.get_attached_parts()) 
    346         res = res or models.DocumentFile.objects.filter(document=ctrl.object).exists() 
    347346        self.assertTrue(res) 
    348347         
     
    354353        self.assertCancelError(self.controller) 
    355354         
    356     def test_cancel_has_file_related(self): 
    357         """ Tests that a document with at least one file can *not* be cancelled. """ 
    358         f = self.get_file() 
    359         self.controller.add_file(f) 
    360         files = self.controller.files.all() 
    361         self.assertEqual(len(files), 1) 
    362         self.assertCancelError(self.controller) 
Note: See TracChangeset for help on using the changeset viewer.