File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from . import splitter
55from . import splitter_json
66from . 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 <sebastien.beau@akretion.com>
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):
2020 [
2121 ("json" , "Json" ),
2222 ("xml" , "XML" ),
23+ ("txt" , "Txt" ),
2324 ]
2425 )
2526 xml_split_xpath = fields .Char ()
You can’t perform that action at this time.
0 commit comments