Improve Code.

bzr revid: jir@tinyerp.com-20130607131646-kkeo1nuue6klbikj
This commit is contained in:
Jignesh Rathod (OpenERP) 2013-06-07 18:46:46 +05:30
parent b117b19ac0
commit c46526a9dc
6 changed files with 27 additions and 15 deletions

View File

@ -199,6 +199,9 @@
<xpath expr="//filter[@name='my_documents_filter']" position="replace">
<filter name="my_documents_filter" string="My Document(s)" icon="terp-personal" domain="[('user_id','=',uid)]" help="Filter on my documents"/>
</xpath>
<xpath expr="//field[@name='name']" position="replace">
<field name="name" filter_domain="['|','|',('name', 'ilike', self), ('datas_fname', 'ilike', self),('index_content', 'ilike', self)]" string="Attachment"/>
</xpath>
<xpath expr="//field[@name='create_uid']" position="replace">
<field name="user_id"/>
<field name="parent_id" />

View File

@ -185,6 +185,24 @@ class hr_applicant(base_stage, osv.Model):
res[issue.id][field] = abs(float(duration))
return res
def attachment_tree_view(self, cr, uid, ids, context):
domain = ['&', ('res_model', '=', 'hr.applicant'), ('res_id', 'in', ids)]
res_id = ids and ids[0] or False
return {
'name': _('Attachments'),
'domain': domain,
'res_model': 'ir.attachment',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'tree,form',
'view_type': 'form',
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
}
def _compute_attachments(self, cr, uid, ids, fields, args, context=None):
res = {}
attachment_pool = self.pool.get('ir.attachment')

View File

@ -89,6 +89,7 @@
<button name="action_print_survey" type="object"
string="Print Interview" help="Print interview report"
attrs="{'invisible':[('survey','=',False)]}"/>
<button name="attachment_tree_view" string="Documents" type="object"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -241,6 +242,7 @@
<field name="department_id"/>
<field name="categ_ids"/>
<field name="message_summary"/>
<field name="attachments"/>
<templates>
<t t-name="kanban-tooltip">
<ul class="oe_kanban_tooltip">
@ -293,10 +295,10 @@
</div>
<div class="oe_kanban_footer_left" style="margin-top:5px;">
<t t-raw="record.message_summary.raw_value"/>
<span>
<span class="oe_e">'</span>
<field name="attachments"/>
</span>
<a t-if="record.attachments.raw_value == 1" name="attachment_tree_view" type="object" style="margin-right: 10px"> <field name="attachments"/> Document</a>
<a t-if="record.attachments.raw_value gt 1" name="attachment_tree_view" type="object" style="margin-right: 10px"> <field name="attachments"/> Documents</a>
</div>
</div>

View File

@ -29,9 +29,5 @@ class hr_applicant_settings(osv.osv_memory):
'module_document_ftp': fields.boolean('Allow the automatic indexation of resumes',
help="""Manage your CV's and motivation letter related to all applicants.
This installs the module document_ftp. This will install the knowledge management module in order to allow you to search using specific keywords through the content of all documents (PDF, .DOCx...)"""),
'fetchmail_applicants': fields.boolean('Create applicants from an incoming email account',
fetchmail_model='hr.applicant', fetchmail_name='Incoming HR Applications',
help ="""Allow applicants to send their job application to an email address (jobs@mycompany.com),
and create automatically application documents in the system."""),
}

View File

@ -14,12 +14,6 @@
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
<field name="arch" type="xml">
<div name="recruitment" position="inside">
<div>
<field name="fetchmail_applicants" class="oe_inline"/>
<label for="fetchmail_applicants"/>
<button name="configure_fetchmail_applicants" type="object" string="Configure" icon="gtk-go-forward"
attrs="{'invisible': [('fetchmail_applicants','=',False)]}" class="oe_link"/>
</div>
<div>
<field name="module_document_ftp" class="oe_inline"/>
<label for="module_document_ftp"/>

View File

@ -9,6 +9,5 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>