File tree 3 files changed +21
-0
lines changed
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 4
4
from . import splitter
5
5
from . import splitter_json
6
6
from . import splitter_xml
7
+ from . import splitter_txt
Original file line number Diff line number Diff line change
1
+ # Copyright 2021 Akretion (https://www.akretion.com).
2
+ # @author Sébastien BEAU <[email protected] >
3
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4
+
5
+ from odoo .addons .component .core import Component
6
+
7
+
8
+ class ChunkSplitterTxt (Component ):
9
+ _inherit = "chunk.splitter"
10
+ _name = "chunk.splitter.txt"
11
+ _usage = "txt"
12
+ _end_of_line = b"\n "
13
+
14
+ def _parse_data (self , data ):
15
+ for idx , item in enumerate (data .split (self ._end_of_line )):
16
+ yield idx + 1 , item
17
+
18
+ def _convert_items_to_data (self , items ):
19
+ return self ._end_of_line .join ([x [1 ] for x in items ])
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class ChunkGroup(models.Model):
20
20
[
21
21
("json" , "Json" ),
22
22
("xml" , "XML" ),
23
+ ("txt" , "Txt" ),
23
24
]
24
25
)
25
26
xml_split_xpath = fields .Char ()
You can’t perform that action at this time.
0 commit comments