[IMP] Add file='...' on <field> tags + [FIX] forced noupdate
bzr revid: fp@openerp.com-20130922093113-80p3pig45qbm7lsn
This commit is contained in:
parent
cc187b884b
commit
29326cd993
|
@ -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):
|
||||||
|
|
|
@ -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/>
|
||||||
|
|
|
@ -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()
|
||||||
|
@ -241,7 +248,9 @@ class xml_import(object):
|
||||||
return val.lower() not in ('0', 'false', 'off')
|
return val.lower() not in ('0', 'false', 'off')
|
||||||
|
|
||||||
def isnoupdate(self, data_node=None):
|
def isnoupdate(self, data_node=None):
|
||||||
return self.noupdate or (len(data_node) and self.nodeattr2bool(data_node, 'noupdate', False))
|
if data_node and data_node.get('noupdate'):
|
||||||
|
return len(data_node) and self.nodeattr2bool(data_node, 'noupdate', False)
|
||||||
|
return self.noupdate
|
||||||
|
|
||||||
def get_context(self, data_node, node, eval_dict):
|
def get_context(self, data_node, node, eval_dict):
|
||||||
data_node_context = (len(data_node) and data_node.get('context','').encode('utf8'))
|
data_node_context = (len(data_node) and data_node.get('context','').encode('utf8'))
|
||||||
|
|
Loading…
Reference in New Issue