-   |
    In order to test the Document Management System In OpenERP.
-
    In order to test behaviour of resource Directory I will make one resource Directory "Partner Labels" in OpenERP having type "Other Resources" and Directory mapped to object "Partner"
-
    !record {model: 'document.directory', id: dir_partner_label}:
        name : "Partner Labels"
        storage_id : storage_default
        type : ressource
        content_ids:
            - name: "Label"
              report_id :  base.res_partner_address_report
-
    Assign "res.partner" object to ressource_type_id. 
-
    !python {model: document.directory}: |
        ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')])
        id = self.write(cr, uid, [ref("dir_partner_label")], {'ressource_type_id' : ids[0]}, context)
-
    In order to check static directory in OpenERP which is the real directory just like system's local folders, 
    First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory"
-
    !record {model: 'document.directory', id: directory_1}:
        name : "Directory 1"
        storage_id : storage_default
        type : directory
-
    In order to make a directory hierarchy in OpenERP I will make other static directory "Directory 2" and I put its Parent Item as "Directory 1",
    So I can see the directory hierarchy in OpenERP's client like :- Directory1 -> Directory2
-
    !record {model: 'document.directory', id: directory_2}:
        name : "Directory 2"
        storage_id : storage_default
        type : directory
        parent_id : directory_1
-
    I am create a one Document Attachment name "My document" and select "Directory 2" as its Directory,
    And in order to put a File content.
-
    When I am creating the document then "Resource Title" is filled automatic  with "My document".
-
    !record {model: 'ir.attachment', id: document_1}:
        name : "My document"
        parent_id : directory_2
-
    Attach a pdf file in "My document"
-
    !python {model: 'ir.attachment'}: |
        import tools
        import base64
        pdf_file = open(tools.config['addons_path'] + '/document/test/partner.pdf')
        self.write(cr, uid, [ref("document_1")], {'datas_fname': 'partner.pdf', 'datas' : base64.encodestring(pdf_file.read())}, context)

