Thibault Delavallée (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-user_img-tde into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-user_img-tde/+merge/97205
-- need lp:~openerp-dev/openobject-server/trunk-user_img-tde --
HR photo specs
==============
This revision modifies the photo for HR employees. Two fields now exist in the
hr.employee model:
- photo, a binary field holding the image
- photo_mini, a binary field holding an automatically resized version of the
avatar. Dimensions of the resized avatar are 180x150.
Employee photo should be used only when dealing with employees, using the
photo_mini field. When dealing with users, use the res.users avatar_mini field
instead.
CRM kanban avatar specs
=======================
Kanban view of opportunities has been updated to use the newly-introduced
avatar_mini field of res.users. The avatar is placed in the right-side of the
containing kanban box. CSS file has been added to hold the css definitions
necessary to update the boxes.
Task kanban avatar specs
========================
Kanban view of tasks has been updated to use the newly-introduced avatar_mini
field of res.users. The avatar is placed in the right-side of the containing
kanban box. CSS file has been added to hold the css definitions necessary to
update the boxes.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-user_img-tde/+merge/97205
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-user_img-tde.
=== modified file 'crm/__openerp__.py'
--- crm/__openerp__.py 2012-02-13 15:27:55 +0000
+++ crm/__openerp__.py 2012-03-13 12:06:10 +0000
@@ -130,6 +130,9 @@
'test/ui/duplicate_lead.yml',
'test/ui/delete_lead.yml'
],
+ 'css': [
+ 'static/src/css/crm_kanban.css',
+ ],
'installable': True,
'application': True,
'auto_install': False,
=== modified file 'crm/crm_lead_view.xml'
--- crm/crm_lead_view.xml 2012-02-13 15:27:55 +0000
+++ crm/crm_lead_view.xml 2012-03-13 12:06:10 +0000
@@ -291,40 +291,42 @@
<t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="border">oe_kanban_color_red</t>
<div t-attf-class="#{kanban_color(record.color.raw_value)} #{border || ''}">
<div class="oe_kanban_box oe_kanban_color_border">
- <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
- <tr>
- <td align="left" valign="middle" width="16">
- <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
- <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
- </td>
- <td align="left" valign="middle" class="oe_kanban_title" tooltip="lead_details">
- <field name="partner_id"/>
- <t t-if="record.planned_revenue.raw_value">
- - <t t-esc="Math.round(record.planned_revenue.value)"/>
- <field name="company_currency"/>
- </t>
- </td>
- <td valign="top" width="22"><img t-att-src="kanban_gravatar(record.user_email.value, 22)" class="oe_kanban_gravatar" t-att-title="record.user_id.value"/></td>
- </tr>
- </table>
-
- <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
- <div>
- <b>
- <a t-if="record.partner_address_email.raw_value" t-attf-href="mailto:#{record.partner_address_email.raw_value}">
- <field name="partner_address_name"/>
- </a>
- <field t-if="!record.partner_address_email.raw_value" name="partner_address_name"/>
- </b>
- </div>
- <div>
- <field name="name"/>
- </div>
- <div style="padding-left: 0.5em">
- <i><field name="date_action"/><t t-if="record.date_action.raw_value"> : </t><field name="title_action"/></i>
- </div>
- </div>
-
+ <div class="oe_proj_task_avatar_box">
+ <img t-att-src="kanban_image('res.users', 'avatar_mini', record.user_id.raw_value[0])" class="oe_kanban_avatar" t-att-title="record.user_id.value"/>
+ </div>
+ <div class="oe_proj_task_content_box">
+ <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
+ <tr>
+ <td align="left" valign="middle" width="16">
+ <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
+ <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
+ </td>
+ <td align="left" valign="middle" class="oe_kanban_title" tooltip="lead_details">
+ <field name="partner_id"/>
+ <t t-if="record.planned_revenue.raw_value">
+ - <t t-esc="Math.round(record.planned_revenue.value)"/>
+ <field name="company_currency"/>
+ </t>
+ </td>
+ </tr>
+ </table>
+ <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
+ <div>
+ <b>
+ <a t-if="record.partner_address_email.raw_value" t-attf-href="mailto:#{record.partner_address_email.raw_value}">
+ <field name="partner_address_name"/>
+ </a>
+ <field t-if="!record.partner_address_email.raw_value" name="partner_address_name"/>
+ </b>
+ </div>
+ <div>
+ <field name="name"/>
+ </div>
+ <div style="padding-left: 0.5em">
+ <i><field name="date_action"/><t t-if="record.date_action.raw_value"> : </t><field name="title_action"/></i>
+ </div>
+ </div>
+ </div>
<div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
<div class="oe_kanban_left">
<a string="Edit" icon="gtk-edit" type="edit"/>
=== added directory 'crm/doc'
=== added file 'crm/doc/crm_kanban_avatar.rst'
--- crm/doc/crm_kanban_avatar.rst 1970-01-01 00:00:00 +0000
+++ crm/doc/crm_kanban_avatar.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,4 @@
+CRM kanban avatar specs
+=======================
+
+Kanban view of opportunities has been updated to use the newly-introduced avatar_mini field of res.users. The avatar is placed in the right-side of the containing kanban box. CSS file has been added to hold the css definitions necessary to update the boxes.
=== added file 'crm/doc/index.rst'
--- crm/doc/index.rst 1970-01-01 00:00:00 +0000
+++ crm/doc/index.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,6 @@
+:orphan:
+
+CRM module documentation
+========================
+
+.. include:: index.rst.inc
=== added file 'crm/doc/index.rst.inc'
--- crm/doc/index.rst.inc 1970-01-01 00:00:00 +0000
+++ crm/doc/index.rst.inc 2012-03-13 12:06:10 +0000
@@ -0,0 +1,8 @@
+
+CRM Module
+''''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ crm_kanban_avatar
=== added directory 'crm/static/src/css'
=== added file 'crm/static/src/css/crm_kanban.css'
--- crm/static/src/css/crm_kanban.css 1970-01-01 00:00:00 +0000
+++ crm/static/src/css/crm_kanban.css 2012-03-13 12:06:10 +0000
@@ -0,0 +1,21 @@
+.openerp .oe_proj_task_content_box {
+ margin-right: 41px;
+}
+
+.openerp .oe_proj_task_avatar_box {
+ float: right;
+ width: 40px;
+}
+
+.openerp .oe_kanban_avatar {
+ display: block;
+ width: 40px;
+ height: auto;
+ clip: rect(5px, 40px, 45px, 0px);
+}
+
+.openerp .oe_kanban_avatar_wide {
+ height: 40px;
+ width: auto;
+ clip: rect(0px, 45px, 40px, 05px);
+}
=== added directory 'hr/doc'
=== added file 'hr/doc/hr_employee_img.rst'
--- hr/doc/hr_employee_img.rst 1970-01-01 00:00:00 +0000
+++ hr/doc/hr_employee_img.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,8 @@
+HR photo specs
+==============
+
+This revision modifies the photo for HR employees. Two fields now exist in the hr.employee model:
+ - photo, a binary field holding the image
+ - photo_mini, a binary field holding an automatically resized version of the avatar. Dimensions of the resized avatar are 180x150.
+
+Employee photo should be used only when dealing with employees, using the photo_mini field. When dealing with users, use the res.users avatar_mini field instead.
=== added file 'hr/doc/index.rst'
--- hr/doc/index.rst 1970-01-01 00:00:00 +0000
+++ hr/doc/index.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,6 @@
+:orphan:
+
+HR module documentation
+=======================
+
+.. include:: index.rst.inc
=== added file 'hr/doc/index.rst.inc'
--- hr/doc/index.rst.inc 1970-01-01 00:00:00 +0000
+++ hr/doc/index.rst.inc 2012-03-13 12:06:10 +0000
@@ -0,0 +1,8 @@
+
+HR Module
+'''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ hr_employee_img
=== modified file 'hr/hr.py'
--- hr/hr.py 2012-01-31 13:36:57 +0000
+++ hr/hr.py 2012-03-13 12:06:10 +0000
@@ -23,6 +23,9 @@
import logging
import addons
+import io, StringIO
+from PIL import Image
+
class hr_employee_category(osv.osv):
def name_get(self, cr, uid, ids, context=None):
@@ -145,6 +148,31 @@
_name = "hr.employee"
_description = "Employee"
_inherits = {'resource.resource': "resource_id"}
+
+ def onchange_photo_mini(self, cr, uid, ids, value, context=None):
+ print 'cacacaporinfeorinf'
+ return {'value': {'photo': value, 'photo_mini': self._photo_resize(cr, uid, value) } }
+
+ def _set_photo_mini(self, cr, uid, id, name, value, args, context=None):
+ return self.write(cr, uid, [id], {'photo': value}, context=context)
+
+ def _photo_resize(self, cr, uid, photo, context=None):
+ image_stream = io.BytesIO(photo.decode('base64'))
+ img = Image.open(image_stream)
+ img.thumbnail((180, 150), Image.ANTIALIAS)
+ img_stream = StringIO.StringIO()
+ img.save(img_stream, "JPEG")
+ return img_stream.getvalue().encode('base64')
+
+ def _get_photo_mini(self, cr, uid, ids, name, args, context=None):
+ result = {}
+ for hr_empl in self.browse(cr, uid, ids, context=context):
+ if not hr_empl.photo:
+ result[hr_empl.id] = False
+ else:
+ result[hr_empl.id] = self._photo_resize(cr, uid, hr_empl.photo)
+ return result
+
_columns = {
'country_id': fields.many2one('res.country', 'Nationality'),
'birthday': fields.date("Date of Birth"),
@@ -171,6 +199,10 @@
'coach_id': fields.many2one('hr.employee', 'Coach'),
'job_id': fields.many2one('hr.job', 'Job'),
'photo': fields.binary('Photo'),
+ 'photo_mini': fields.function(_get_photo_mini, fnct_inv=_set_photo_mini, string='Photo Mini', type="binary",
+ store = {
+ 'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['photo'], 10),
+ }),
'passport_id':fields.char('Passport No', size=64),
'color': fields.integer('Color Index'),
'city': fields.related('address_id', 'city', type='char', string='City'),
@@ -217,11 +249,11 @@
def _get_photo(self, cr, uid, context=None):
photo_path = addons.get_module_resource('hr','images','photo.png')
- return open(photo_path, 'rb').read().encode('base64')
+ return self._photo_resize(cr, uid, open(photo_path, 'rb').read().encode('base64'))
_defaults = {
'active': 1,
- 'photo': _get_photo,
+ 'photo_mini': _get_photo,
'marital': 'single',
'color': 0,
}
=== modified file 'hr/hr_view.xml'
--- hr/hr_view.xml 2012-02-23 14:54:21 +0000
+++ hr/hr_view.xml 2012-03-13 12:06:10 +0000
@@ -33,7 +33,7 @@
<field name="parent_id" />
</group>
<group colspan="2" col="1">
- <field name="photo" widget='image' nolabel="1"/>
+ <field name="photo_mini" widget='image' nolabel="1" on_change="onchange_photo_mini(photo_mini)"/>
</group>
</group>
<notebook colspan="6">
@@ -130,13 +130,12 @@
<field name="model">hr.employee</field>
<field name="type">kanban</field>
<field name="arch" type="xml">
-
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_employee_vignette">
<div class="oe_employee_image">
- <a type="edit"><img t-att-src="kanban_image('hr.employee', 'photo', record.id.value)" class="oe_employee_picture"/></a>
+ <a type="edit"><img t-att-src="kanban_image('hr.employee', 'photo_mini', record.id.value)" class="oe_employee_picture"/></a>
</div>
<div class="oe_employee_details">
<h4><a type="edit"><field name="name"/> (<field name="login"/>)</a></h4>
=== modified file 'project/__openerp__.py'
--- project/__openerp__.py 2012-02-13 15:27:55 +0000
+++ project/__openerp__.py 2012-03-13 12:06:10 +0000
@@ -67,6 +67,9 @@
'test/project_process.yml',
'test/task_process.yml',
],
+ 'css': [
+ 'static/src/css/project_task.css',
+ ],
'installable': True,
'auto_install': False,
'application': True,
=== added directory 'project/doc'
=== added file 'project/doc/index.rst'
--- project/doc/index.rst 1970-01-01 00:00:00 +0000
+++ project/doc/index.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,6 @@
+:orphan:
+
+Project module documentation
+============================
+
+.. include:: index.rst.inc
=== added file 'project/doc/index.rst.inc'
--- project/doc/index.rst.inc 1970-01-01 00:00:00 +0000
+++ project/doc/index.rst.inc 2012-03-13 12:06:10 +0000
@@ -0,0 +1,8 @@
+
+Project Module
+''''''''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ task_kanban_avatar
=== added file 'project/doc/task_kanban_avatar.rst'
--- project/doc/task_kanban_avatar.rst 1970-01-01 00:00:00 +0000
+++ project/doc/task_kanban_avatar.rst 2012-03-13 12:06:10 +0000
@@ -0,0 +1,4 @@
+Task kanban avatar specs
+========================
+
+Kanban view of tasks has been updated to use the newly-introduced avatar_mini field of res.users. The avatar is placed in the right-side of the containing kanban box. CSS file has been added to hold the css definitions necessary to update the boxes.
=== modified file 'project/project_view.xml'
--- project/project_view.xml 2012-02-13 15:27:55 +0000
+++ project/project_view.xml 2012-03-13 12:06:10 +0000
@@ -344,44 +344,46 @@
<t t-if="record.kanban_state.raw_value === 'done'" t-set="border">oe_kanban_color_green</t>
<div t-attf-class="#{kanban_color(record.color.raw_value)} #{border || ''}">
<div class="oe_kanban_box oe_kanban_color_border">
- <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
- <tr>
- <td align="left" valign="middle" width="16">
- <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
- <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
- </td>
- <td align="left" valign="middle" class="oe_kanban_title" tooltip="task_details">
- <field name="name"/>
- </td>
- <td valign="top" width="22">
- <img t-att-src="kanban_gravatar(record.user_email.value, 22)" class="oe_kanban_gravatar" t-att-title="record.user_id.value"/>
- </td>
- </tr>
- </table>
- <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
- <div class="oe_kanban_description">
- <t t-esc="kanban_text_ellipsis(record.description.value, 160)"/>
- <i t-if="record.date_deadline.raw_value">
- <t t-if="record.description.raw_value">, </t>
- <field name="date_deadline"/>
- </i>
- <span class="oe_kanban_project_times" style="white-space: nowrap; padding-left: 5px;">
- <t t-set="hours" t-value="record.remaining_hours.raw_value"/>
- <t t-set="times" t-value="[
- [1, (hours gte 1 and hours lt 2)]
- ,[2, (hours gte 2 and hours lt 5)]
- ,[5, (hours gte 5 and hours lt 10)]
- ,[10, (hours gte 10)]
- ]"/>
- <t t-foreach="times" t-as="time"
- ><a t-if="!time[1]" t-attf-data-name="set_remaining_time_#{time[0]}"
- type="object" class="oe_kanban_button"><t t-esc="time[0]"/></a
- ><b t-if="time[1]" class="oe_kanban_button oe_kanban_button_active"><t t-esc="Math.round(hours)"/></b
- ></t>
- <a name="do_open" states="draft" string="Validate planned time and open task" type="object" class="oe_kanban_button oe_kanban_button_active">!</a>
- </span>
+ <div class="oe_proj_task_avatar_box">
+ <img t-att-src="kanban_image('res.users', 'avatar_mini', record.user_id.raw_value[0])" class="oe_kanban_avatar" t-att-title="record.user_id.value"/>
+ </div>
+ <div class="oe_proj_task_content_box">
+ <table class="oe_kanban_table oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle">
+ <tr>
+ <td align="left" valign="middle" width="16">
+ <a t-if="record.priority.raw_value == 1" icon="star-on" type="object" name="set_normal_priority"/>
+ <a t-if="record.priority.raw_value != 1" icon="star-off" type="object" name="set_high_priority" style="opacity:0.6; filter:alpha(opacity=60);"/>
+ </td>
+ <td align="left" valign="middle" class="oe_kanban_title" tooltip="task_details">
+ <field name="name"/>
+ </td>
+ </tr>
+ </table>
+ <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
+ <div class="oe_kanban_description">
+ <t t-esc="kanban_text_ellipsis(record.description.value, 160)"/>
+ <i t-if="record.date_deadline.raw_value">
+ <t t-if="record.description.raw_value">, </t>
+ <field name="date_deadline"/>
+ </i>
+ <span class="oe_kanban_project_times" style="white-space: nowrap; padding-left: 5px;">
+ <t t-set="hours" t-value="record.remaining_hours.raw_value"/>
+ <t t-set="times" t-value="[
+ [1, (hours gte 1 and hours lt 2)]
+ ,[2, (hours gte 2 and hours lt 5)]
+ ,[5, (hours gte 5 and hours lt 10)]
+ ,[10, (hours gte 10)]
+ ]"/>
+ <t t-foreach="times" t-as="time"
+ ><a t-if="!time[1]" t-attf-data-name="set_remaining_time_#{time[0]}"
+ type="object" class="oe_kanban_button"><t t-esc="time[0]"/></a
+ ><b t-if="time[1]" class="oe_kanban_button oe_kanban_button_active"><t t-esc="Math.round(hours)"/></b
+ ></t>
+ <a name="do_open" states="draft" string="Validate planned time and open task" type="object" class="oe_kanban_button oe_kanban_button_active">!</a>
+ </span>
+ </div>
+ <div class="oe_kanban_clear"/>
</div>
- <div class="oe_kanban_clear"/>
</div>
<div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
<div class="oe_kanban_left">
=== added directory 'project/static/src/css'
=== added file 'project/static/src/css/project_task.css'
--- project/static/src/css/project_task.css 1970-01-01 00:00:00 +0000
+++ project/static/src/css/project_task.css 2012-03-13 12:06:10 +0000
@@ -0,0 +1,21 @@
+.openerp .oe_proj_task_content_box {
+ margin-right: 41px;
+}
+
+.openerp .oe_proj_task_avatar_box {
+ float: right;
+ width: 40px;
+}
+
+.openerp .oe_kanban_avatar {
+ display: block;
+ width: 40px;
+ height: auto;
+ clip: rect(5px, 40px, 45px, 0px);
+}
+
+.openerp .oe_kanban_avatar_wide {
+ height: 40px;
+ width: auto;
+ clip: rect(0px, 45px, 40px, 05px);
+}
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp