[IMP] use const SUPERUSER_ID insteand of int 1
[odoo/odoo.git] / addons / document / test / document_test.yml
1 -   |
2     In order to test the Document Management System In OpenERP.
3 -
4     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"
5 -
6     !record {model: 'document.directory', id: dir_partner_label}:
7         name : "Partner Labels"
8         storage_id : storage_default
9         type : ressource
10         content_ids:
11             - name: "Label"
12               report_id :  base.res_partner_address_report
13 -
14     Assign "res.partner" object to ressource_type_id. 
15 -
16     !python {model: document.directory}: |
17         ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')])
18         id = self.write(cr, uid, [ref("dir_partner_label")], {'ressource_type_id' : ids[0]}, context)
19 -
20     In order to check static directory in OpenERP which is the real directory just like system's local folders, 
21     First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory"
22 -
23     !record {model: 'document.directory', id: directory_1}:
24         name : "Directory 1"
25         storage_id : storage_default
26         type : directory
27 -
28     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",
29     So I can see the directory hierarchy in OpenERP's client like :- Directory1 -> Directory2
30 -
31     !record {model: 'document.directory', id: directory_2}:
32         name : "Directory 2"
33         storage_id : storage_default
34         type : directory
35         parent_id : directory_1
36 -
37     I am create a one Document Attachment name "My document" and select "Directory 2" as its Directory,
38     And in order to put a File content.
39 -
40     When I am creating the document then "Resource Title" is filled automatic  with "My document".
41 -
42     !record {model: 'ir.attachment', id: document_1}:
43         name : "My document"
44         parent_id : directory_2
45 -
46     Attach a pdf file in "My document"
47 -
48     !python {model: 'ir.attachment'}: |
49         import tools
50         import base64
51         pdf_file = open(tools.config['addons_path'] + '/document/test/partner.pdf')
52         self.write(cr, uid, [ref("document_1")], {'datas_fname': 'partner.pdf', 'datas' : base64.encodestring(pdf_file.read())}, context)
53