[MERGE] from trunk

bzr revid: xmo@openerp.com-20130923111950-uk163cp891zl021h
This commit is contained in:
Xavier Morel 2013-09-23 13:19:50 +02:00
commit be59c06403
4 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,7 @@
</record> </record>
<record id="main_partner" model="res.partner"> <record id="main_partner" model="res.partner">
<field name="name">Dunder Mufflin</field> <field name="name">YourCompany</field>
<field name="street">1725 Slough Ave.</field> <field name="street">1725 Slough Ave.</field>
<field name="city">Scranton</field> <field name="city">Scranton</field>
<field name="zip">18540</field> <field name="zip">18540</field>
@ -85,7 +85,7 @@ BZrmED0AAAAASUVORK5CYII=
</record> </record>
<record id="main_company" model="res.company"> <record id="main_company" model="res.company">
<field name="name">Dunder Mufflin</field> <field name="name">YourCompany</field>
</record> </record>

View File

@ -44,6 +44,7 @@ class ir_attachment(osv.osv):
The default implementation is the file:dirname location that stores files The default implementation is the file:dirname location that stores files
on the local filesystem using name based on their sha1 hash on the local filesystem using name based on their sha1 hash
""" """
_order = 'id desc'
def _name_get_resname(self, cr, uid, ids, object, method, context): def _name_get_resname(self, cr, uid, ids, object, method, context):
data = {} data = {}
for attachment in self.browse(cr, uid, ids, context=context): for attachment in self.browse(cr, uid, ids, context=context):

View File

@ -167,6 +167,10 @@
<rng:ref name="any"/> <rng:ref name="any"/>
</rng:oneOrMore> </rng:oneOrMore>
</rng:group> </rng:group>
<rng:group>
<rng:attribute name="file"/>
<rng:empty/>
</rng:group>
<rng:group> <rng:group>
<rng:attribute name="ref"/> <rng:attribute name="ref"/>
<rng:empty/> <rng:empty/>

View File

@ -175,6 +175,13 @@ def _eval_xml(self, node, pool, cr, uid, idref, context=None):
if t == 'html': if t == 'html':
return _process("".join([etree.tostring(n, encoding='utf-8') return _process("".join([etree.tostring(n, encoding='utf-8')
for n in node]), idref) for n in node]), idref)
if node.get('file'):
import openerp.tools
import base64
fp = openerp.tools.file_open(node.get('file'))
result = base64.b64encode(fp.read())
return result
if t == 'file': if t == 'file':
from ..modules import module from ..modules import module
path = node.text.strip() path = node.text.strip()