Random generation of default avatar

bzr revid: mit@openerp.com-20120831131216-c5j02m8q7kwnn5pv
This commit is contained in:
Minh Tran 2012-08-31 15:12:16 +02:00
parent 8239412dd5
commit c0d5a80682
13 changed files with 34 additions and 9 deletions

View File

@ -69,7 +69,7 @@
<t t-set="installed" t-value="record.state.raw_value == 'installed'"/>
<img t-attf-src="#{record.icon.value}" class="oe_module_icon"/>
<div class="oe_module_desc">
<h4><a type="edit"><field name="shortdesc"/></a></h4>
<h4><a type="open"><field name="shortdesc"/></a></h4>
<p class="oe_module_name">
<t t-if="record.summary.raw_value"><field name="summary"/><br/></t>
<i><field name="name" groups="base.group_no_one"/></i>

View File

@ -227,10 +227,35 @@ class res_partner(osv.osv):
def _get_default_image(self, cr, uid, is_company, context=None):
if is_company:
image_path = openerp.modules.get_module_resource('base', 'static/src/img', 'company_image.png')
image = open(openerp.modules.get_module_resource('base', 'static/src/img', 'company_image.png')).read()
else:
image_path = openerp.modules.get_module_resource('base', 'static/src/img', 'partner_image.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
<<<<<<< TREE
from PIL import Image
from StringIO import StringIO
from random import random
color = (int(random() * 192 + 32), int(random() * 192 + 32), int(random() * 192 + 32))
face = Image.open(openerp.modules.get_module_resource('base', 'static/src/img', 'avatar.png'))
avatar = Image.new('RGB', face.size)
avatar.paste(color)
avatar.paste(face, mask=face)
buffer = StringIO()
avatar.save(buffer, 'PNG')
image = buffer.getvalue()
return tools.image_resize_image_big(image.encode('base64'))
=======
from PIL import Image
from StringIO import StringIO
from random import random
color = (int(random() * 256), int(random() * 256), int(random() * 256))
face = open(openerp.modules.get_module_resource('base', 'static/src/img', 'avatar.png')).read()
avatar = Image.new('RGB', face.size)
avatar.paste(color)
avatar.paste(face, mask=face)
buffer = StringIO()
avatar.save(buffer, 'PNG')
image = buffer.getvalue()
return tools.image_resize_image_big(image.encode('base64'))
>>>>>>> MERGE-SOURCE
_defaults = {
'active': True,

View File

@ -176,7 +176,7 @@
<div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')" style="position: relative">
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
<div class="oe_module_vignette">
<a type="edit">
<a type="open">
<img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
</a>
<div class="oe_module_desc">
@ -184,7 +184,7 @@
<table class="oe_kanban_table">
<tr>
<td class="oe_kanban_title1" align="left" valign="middle">
<h4><a type="edit"><field name="name"/></a></h4>
<h4><a type="open"><field name="name"/></a></h4>
<i><div t-if="record.function.raw_value">
<field name="function"/><br/></div></i>
</td>
@ -302,11 +302,11 @@
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_vignette">
<a type="edit">
<a type="open">
<img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)" class="oe_kanban_image"/>
</a>
<div class="oe_kanban_details">
<h4 class="oe_partner_heading"><a type="edit"><field name="name"/></a></h4>
<h4 class="oe_partner_heading"><a type="open"><field name="name"/></a></h4>
<div class="oe_kanban_partner_categories"/>
<div class="oe_kanban_partner_links"/>
<ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -95,7 +95,7 @@ setuptools.setup(
'docutils',
'feedparser',
'gdata',
'lxml',
'lxml < 3',
'mako',
'psycopg2',
'pydot',