Merge lp:~openerp-commiter/openobject-server/trunk-import-binary-file into lp:openobject-server
Status: | Rejected |
---|---|
Rejected by: | Fabien (Open ERP) |
Proposed branch: | lp:~openerp-commiter/openobject-server/trunk-import-binary-file |
Merge into: | lp:openobject-server |
Diff against target: |
132 lines (+28/-2) (has conflicts) 5 files modified
bin/import_xml.rng (+1/-0) bin/osv/orm.py (+4/-0) bin/tools/convert.py (+12/-0) bin/tools/yaml_import.py (+1/-1) bin/tools/yaml_tag.py (+10/-1) Text conflict in bin/tools/convert.py |
To merge this branch: | bzr merge lp:~openerp-commiter/openobject-server/trunk-import-binary-file |
Related bugs: | |
Related blueprints: |
Import file in binary field
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fabien (Open ERP) | Disapprove | ||
Nicolas DS (community) | Approve | ||
Christophe Simonis (OpenERP) | Approve | ||
Olivier Dony (Odoo) | Pending | ||
Review via email: mp+27799@code.launchpad.net |
Description of the change
To import binary data in a binary field for now you can only does this:
- Use XML-RPC, NET-RPC.
- Using direct python code. (Not nice)
- Convert manually all binary file in Base64 and put it in XML, CSV or YAML file.
This merge allows to import binary file directly into binary field with module by using XML, CSV or YAML.
Usage:
======
* Put a binary file in your module path
ie: my_module/
In CSV ("my_model.csv):
-------
id, name, image (binary field)
pict1,My pict,@my_
pict2,Robot pict,@pict/
In XML:
-------
<record model="my_model" id="pict1">
<field name="name">My pict</field>
<field name="image" filename=
</record>
<record model="my_model" id="pict2">
<field name="name">Robot pict</field/>
<field name="image" filename=
</record>
In YAML:
-------------
-
!record {model: my_model, id: pict1}:
name: My pict
image: !filename my_picture.png
-
!record {model: my_model, id: pict2}:
name: Robot pict
image: !filename pict/robot.jpg
Test module available at:
http://
Forum topic:
http://
Unmerged revisions
- 2392. By Nicolas DS
-
[FIX] Def beginning with "_" is local only in module
- 2391. By Nicolas DS
-
[FIX] Small fix for last merge
- 2390. By Nicolas DS
-
[MERGE] from official trunk
- 2389. By Nicolas DS
-
[MERGE] with official trunk
- 2388. By Nicolas DS
-
[FIX] Typos in function name
- 2387. By Nicolas DS
-
[FIX] Use filename attribute for XML and !filename for YAML instead of @
- 2386. By Nicolas DS
-
[IMP] Import @ targeted file in binary field, for CSV, XML and YAML
Usage:
- Put a file (picture, data,...) in your module path. Ie: mymodule/my_picture. png
- In XML, YAML, or CSV put the relative path preceded by a @. Ie: @my_picture.png
The "@" is a hack.
Why not just add a new attribute "filename" to the xml ?
and a "!! filename" directive to the yaml parser ?
the csv parser could possibly keep the "@" hack.