[IMP] document: add new field company_id in document and directory model

bzr revid: hmo@tinyerp.com-20100623115349-ik8webt0myj6l43l
This commit is contained in:
Harry (OpenERP) 2010-06-23 17:23:49 +05:30
parent 312681ccd5
commit d2cb812814
3 changed files with 12 additions and 1 deletions

View File

@ -98,6 +98,7 @@ class document_file(osv.osv):
('binary','Binary'),
],'Type', help="Type is used to separate URL and binary File"),
'company_id': fields.many2one('res.company', 'Company'),
}
def __get_def_directory(self, cr, uid, context=None):
@ -105,6 +106,7 @@ class document_file(osv.osv):
return dirobj._get_root_directory(cr, uid, context)
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.attachment', context=c),
'user_id': lambda self, cr, uid, ctx:uid,
'file_size': lambda self, cr, uid, ctx:0,
'store_method': lambda *args: 'db',

View File

@ -60,6 +60,7 @@ class document_directory(osv.osv):
'ressource_tree': fields.boolean('Tree Structure',
help="Check this if you want to use the same tree structure as the object selected in the system."),
'dctx_ids': fields.one2many('document.directory.dctx', 'dir_id', 'Context fields'),
'company_id': fields.many2one('res.company', 'Company'),
}
@ -92,6 +93,7 @@ class document_directory(osv.osv):
return None
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'document.directory', context=c),
'user_id': lambda self,cr,uid,ctx: uid,
'domain': lambda self,cr,uid,ctx: '[]',
'type': lambda *args: 'directory',

View File

@ -85,6 +85,7 @@
<field name="user_id"/>
<field name="parent_id"/>
<field name="storage_id" />
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<notebook colspan="4">
<page string="Definition">
<separator string="Directory Type" colspan="4"/>
@ -226,7 +227,8 @@
<group colspan="4" col="6">
<field name="name" select="1" />
<field name="type"/>
<field name="parent_id"/>
<field name="parent_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="Attachment">
@ -291,11 +293,15 @@
help="Filter on my Attachment" />
</field>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-personal" domain="[]"
context="{'group_by':'partner_id'}" />
<filter string="Directory" icon="terp-folder-green" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Type" domain="[]" context="{'group_by':'type'}"/>
<filter string="Owner" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
@ -319,6 +325,7 @@
</record>
<record model="ir.actions.act_window" id="action_document_file_form">
<field name="name">Documents</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.attachment</field>
<field name="view_type">form</field>