[IMP] hr: Put a fields.binary, picture field on the top-right corner of an employee form

bzr revid: mra@tinyerp.com-20100521130552-hzpn30lcvl9wt3ie
This commit is contained in:
mra (Open ERP)
2010-05-21 18:35:52 +05:30
parent e34fb1ffd9
commit b00423ca93
3 changed files with 29 additions and 11 deletions
+14 -3
View File
@@ -18,7 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import os
from osv import fields, osv
import tools
from tools.translate import _
class hr_employee_category(osv.osv):
@@ -109,11 +112,19 @@ class hr_employee(osv.osv):
'category_id' : fields.many2one('hr.employee.category', 'Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'),
'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'),
'coach_id':fields.many2one('res.users','Coach'),
'job_id':fields.many2one('hr.job', 'Job'),
'coach_id': fields.many2one('res.users','Coach'),
'job_id': fields.many2one('hr.job', 'Job'),
'photo': fields.binary('Photo')
}
def _get_photo(self, cr, uid, context=None):
return open(os.path.join(
tools.config['addons_path'], 'hr/image', 'photo.png'),
'rb') .read().encode('base64')
_defaults = {
'active' : lambda *a: True,
'active' : 1,
'photo': _get_photo,
}
def _check_recursion(self, cr, uid, ids):
+15 -8
View File
@@ -21,13 +21,20 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Employee">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="user_id"/>
<field name="active" groups="base.group_extended"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<group colspan="4" col="8">
<group colspan="6" col="6">
<field colspan="6" name="name" select="1"/>
<field name="user_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active" groups="base.group_extended"/>
<field name="parent_id" />
<field name="coach_id" />
</group>
<group colspan="2" col="1">
<field name="photo" widget='image' nolabel="1"/>
</group>
</group>
<notebook colspan="4">
<notebook colspan="6">
<page string="Personal Information">
<group col="2" colspan="2">
<separator string="Contact Information" colspan="2"/>
@@ -51,9 +58,9 @@
<field name="job_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<field name="category_id" />
<separator string="Managers" colspan="2"/>
<!--<separator string="Managers" colspan="2"/>
<field name="parent_id" />
<field name="coach_id" />
<field name="coach_id" />-->
</group>
<group col="2" colspan="2">
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB