Search 1.9 billion lines of Odoo code on GitHub

excel_import_export

Author: Ecosoft,Odoo Community Association (OCA)
License: AGPL-3
Branch: 12.0
Repository: 001101/server-tools
Dependencies: mail, and web
Languages: HTML (459, 14.2%), JavaScript (74, 2.3%), PO File (617, 19.0%), Python (1581, 48.8%), XML (346, 10.7%), and reStructuredText (163, 5.0%)
Other branches: 12.0-ocabot-merge-pr-1625-by-gurneyalex-bump-major
Other repositories: 0yik/server-tools, 2FM/server-tools, 50611/server-tools, AITIC/server-tools, AMhadhbi/server-tools, Alfa-90/server-tools, Artielkami/server-tools, CB-Gran-Canaria/server-tools, CGenie/server-tools, Callino/server-tools, ChanFeei/server-tools, Change2improve/server-tools, ChinaShrimp/server-tools, CodeFishEG/server-tools, Colorlessgold/server-tools, ComitorDevTeam/server-tools, Comunitea/server-tools, ContrerasTorrez/server-tools, CrazyJET/server-tools, CustomOdoo/server-tools, DITIntl/server-tools, Danielzhulin/server-tools, Digital5-Odoo/server-tools, Dobtor-OCA/server-tools, DucTruongKomit/server-tools, DulingLai/server-tools, ERPLibre/server-tools, FernandoRomera/server-tools, ForgeFlow/server-tools, GSLabIt/server-tools, Gabinete-Digital/server-tools, Gebesa-Dev/server-tools, GleydsonHudson/server-tools, Glue-Software-Engineering-AG/server-tools, HomerDeoDatu/server-tools, Ingeos/server-tools, Intesco2-0/server-tools, IvanShirokikh/server-tools, Jarsa/server-tools, Jeisonpernia/server-tools, JuaniFreedoo/server-tools, JuniorKRnd/server-tools, Koesj/server-tools, KonaERP/server-tools, KottmannM/server-tools, LevelPrime/server-tools, LlywelynLi/server-tools, LourenzoH/server-tools, MathBenTech/server-tools, MediaJockey/server-tools, Mefistous/server-tools, Melodivo/server-tools, NGTS-AUS/server-tools, NL66278/server-tools, Numigi/server-tools, OCA-MUK/server-tools, OCA/server-tools, OdooIndonesia/server-tools, Othniel1796/server-tools, PieterPaulussen/server-tools, PlanetaTIC/server-tools, QubiQ/server-tools, Rad0van/server-tools, Reinhard-sheng/server-tools, SanteLibre/server-tools, ScopeaFrance/server-tools, SequarSrl/server-tools, SeuMarco/server-tools, SilvioGregorini/server-tools, SimoneVagile/server-tools, SokreamPhanqrl/server-tools, SportPursuit/server-tools, StefanRijnhart/server-tools, Syci-Consulting/server-tools, TRESCLOUD/server-tools, Tecnativa/server-tools, Thorncrag/server-tools, TimLai125/server-tools, Tonow-c2c/server-tools, UnknownInfo/server-tools, VanMoof/server-tools, Vauxoo/server-tools, Yaman-als/server-tools, YannickB/server-tools, YogeshMahera-SerpentCS/server-tools, aadarsh977/server-tools, aaltinisik/server-tools, abakus-it/server-tools, abdulhalim-cu/server-tools, abdulrhmans/server-tools, acsone/server-tools, adhoc-dev/server-tools, aitorbouzas/server-tools, ajayjaviya/server-tools, ajinvn2019/server-tools, akretion/server-tools, alan80080/server-tools, albertvimlet/server-tools, alfadil/server-tools, anassahmed/server-tools, andriisem/server-tools, anhvu-sg/server-tools, anodino-dev/server-tools, ansinaesmejor/server-tools, antilhue/server-tools, area-scm/server-tools, aurestic/server-tools, avoinsystems/server-tools, azmeuk/server-tools, bacgdev/server-tools, bacgroup/server-tools, bala07123/server-tools, bangil0/server-tools, bealdav/server-tools, bicomm/server-tools, blooparksystems/server-tools, bmya/server-tools, bodi000/server-tools, boky1993/server-tools, boutitinizar/server-tools, brain-tec/server-tools, camptocamp/server-tools, captivea-dcr/server-tools, cheikhousy/server-tools, claro5/server-tools, cogitoweb/server-tools, connect-to-ak/server-tools, coopiteasy/server-tools, corsojulian7/server-tools, crnd-inc/server-tools, dalal-intellisoft/server-tools, dani-xtendoo/server-tools, daramousk/server-tools, davidwah/server-tools, ddico/server-tools, delgerS/server-tools, dennybiasiolli/server-tools, diggy128/server-tools, dipakthapaofficial/server-tools, dmsergio/server-tools, dndoanh/server-tools, dong-z/server-tools, druidoo-dev/server-tools, eLBati/server-tools, ebirbe/server-tools, ecosoft-odoo/rjc, ecosoft-odoo/server-tools, eezee-it/server-tools, emagdalenaC2i/server-tools, enocare/server-tools, erfanjahanshahlo/server-tools, ermannognan/server-tools, etobella/server-tools, eversatis/server-tools, ewac-nl/server-tools, exosoftware/oca-server-tools, ferdiansahgg/server-tools, fmdl/server-tools, focusate/oca-server-tools, gab-net/server-tools, gdgellatly/server-tools, gitguohao/server-tools, goanzaloo/server-tools, grindtildeath/server-tools, guewen/server-tools, gurneyalex/server-tools, hbrunn/server-tools, hdb1234/server-tools, henrryyanez/server-tools, hibou-io/oca-server-tools, hiisoc/server-tools, hinfo506/server-tools, hparfr/server-tools, hq8399/server-tools, ideaspositivas-group/server-tools, igallart/server-tools, initOS/server-tools, insscn/server-tools, intero-chz/server-tools, invitu/server-tools, ip-candres/server-tools, izzihector/server-tools, jaballate/server-tools, jackxusho/server-tools, jacky82669513/server-tools, janverb/server-tools, jcarlosmontoya/server-tools, jeanpaul-mupagasi/server-tools, josueBulle/server-tools, josuf567/server-tools, jphatig/server-tools, julianram/server-tools, kait-avalah/server-tools, kikopeiro/server-tools, kittiu/server-tools, kmee/server-tools, kos94ok-3D/server-tools, legalsylvain/server-tools, lembregtse/server-tools, lideritjnma/server-tools, liehu1/server-tools, lilotter45/server-tools, lincersolucoes/oca-server-tools, liweijie0812/server-tools, loftwah/server-tools, lonelyleaves/server-tools, maherjaballi/server-tools, marcelomora/server-tools, merchise-autrement/server-tools, mikolodz/server-tools, modoolar/server-tools, msdeek/server-tools, mulaudzicalvin/server-tools, multidadosti-erp/server-tools, myonnet/oca-server-tools, nabima/server-tools, nehaksolves/server-tools, newtratip/server-tools, nicolasjelincic/server-tools, nilshamerlinck/server-tools, niulinlnc/server-tools, njeudy/server-tools, ntsirintanis/server-tools, nuobit/server-tools, odoo247/server-tools, odooerpdevelopers/server-tools, omalbastin/server-tools, onesteinbv/server-tools, onurugur/server-tools, p-tombez/server-tools, percypalomino/server-tools, petrus-v/server-tools, phillipstack/server-tools, piensom/server-tools, praxigento/oca-server-tools, presenceverte/server-tools, programadorzurita/server-tools, pythoner-3k/server-tools, raizs/server-tools, rdeheele/server-tools, rifki/server-tools, rm-jamotion/server-tools, robertsvx27/server-tools, romendil/server-tools, royalline1/server-tools, rrgaona/server-tools, rsullivan2704/server-tools, rudisulistyo/server-tools, rwfnf/server-tools, sanube/server-tools, savoirfairelinux/server-tools, schout-it/server-tools, sebalix/server-tools, sergiocorato/server-tools, sewisoft/server-tools, shepilov-vladislav/server-tools, skukered/server-tools, sodexis/server-tools, solvosci/server-tools, ssaid/server-tools, steingabelgaard/server-tools, sunflowerit/server-tools, sunshineLhj/server-tools, suprielfath/server-tools, swbs-co/server-tools, sysprocesarcastro/server-tools, tafaRU/server-tools, takinobori/oca-server-tools, tegin/server-tools, tirma-sa/server-tools, tmasson/server-tools, tongjiou/server-tools, trevi-software/server-tools, tuanna7593/server-tools, unitek-solusi/OCA-server-tools, ursais/server-tools, valentinthirion/server-tools, valmarnet/server-tools, vdedyukhin/server-tools, ventor-tech/server-tools, versada/server-tools, victoralmau/server-tools, vmelnych/server-tools, willmakenoise/server-tools, xAlphaOmega/server-tools, xcgd/server-tools, xtjie/server-tools, xuanmu/server-tools, xwh123807/server-tools, xwh1238070/server-tools, yalabsio/server-tools, ycp1015/server-tools, ygdmxy/server-tools, ypapouin/server-tools, yuzhengxing/server-tools, zarumaru/server-tools, zhaohengzeng/server-tools, and zhaohuaw/server-tools

<h1 class="title">Excel Import/Export/Report</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/excel_import_export"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>The module provide pre-built functions and wizards for developer to build excel import / export / report with ease.</p> <p>Without having to code to create excel file, developer do,</p> <ul class="simple"> <li>Create menu, action, wizard, model, view a normal Odoo development.</li> <li>Design excel template using standard Excel application, e.g., colors, fonts, formulas, etc.</li> <li>Instruct how the data will be located in Excel with simple dictionary instruction or from Odoo UI.</li> <li>Odoo will combine instruction with excel template, and result in final excel file.</li> </ul> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#installation" id="id7">Installation</a></li> <li><a class="reference internal" href="#usage" id="id8">Usage</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id9">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#changelog" id="id10">Changelog</a><ul> <li><a class="reference internal" href="#id1" id="id11">12.0.1.0.5 (2019-12-19)</a></li> <li><a class="reference internal" href="#id2" id="id12">12.0.1.0.4 (2019-08-28)</a></li> <li><a class="reference internal" href="#id3" id="id13">12.0.1.0.3 (2019-08-09)</a></li> <li><a class="reference internal" href="#id4" id="id14">12.0.1.0.2 (2019-08-07)</a></li> <li><a class="reference internal" href="#id5" id="id15">12.0.1.0.1 (2019-06-24)</a></li> <li><a class="reference internal" href="#id6" id="id16">12.0.1.0.0 (2019-02-24)</a></li> </ul> </li> <li><a class="reference internal" href="#bug-tracker" id="id17">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id18">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id19">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id20">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id21">Maintainers</a></li> </ul> </li> </ul> </div> <a name="installation"></a> <h2><a class="toc-backref" href="#id7">Installation</a></h2> <p>To install this module, you need to install following python library, <strong>xlrd, xlwt, openpyxl</strong>.</p> <p>Then, simply install <strong>excel_import_export</strong>.</p> <p>For demo, install <strong>excel_import_export_demo</strong>.</p> <a name="usage"></a> <h2><a class="toc-backref" href="#id8">Usage</a></h2> <p>This module contain pre-defined function and wizards to make exporting, importing and reporting easy.</p> <p>At the heart of this module, there are 2 <cite>main methods</cite></p> <ul class="simple"> <li><code>self.env['xlsx.export'].export_xlsx(...)</code></li> <li><code>self.env['xlsx.import'].import_xlsx(...)</code></li> </ul> <p>For reporting, also call <cite>export_xlsx(...)</cite> but through following method</p> <ul class="simple"> <li><code>self.env['xslx.report'].report_xlsx(...)</code></li> </ul> <p>After install this module, go to Settings &gt; Excel Import/Export &gt; XLSX Templates, this is where the key component located.</p> <p>As this module provide tools, it is best to explain as use cases. For example use cases, please install <strong>excel_import_export_demo</strong></p> <p><strong>Use Case 1:</strong> Export/Import Excel on existing document</p> <p>This add export/import action menus in existing document (example - excel_import_export_demo/import_export_sale_order)</p> <ol class="arabic simple"> <li>Create export action menu on document, &lt;act_window&gt; with res_model=&quot;export.xlsx.wizard&quot; and src_model=&quot;&lt;document_model&gt;&quot;, and context['template_domain'] to locate the right template -- actions.xml</li> <li>Create import action menu on document, &lt;act_window&gt; with res_model=&quot;import.xlsx.wizard&quot; and src_model=&quot;&lt;document_model&gt;&quot;, and context['template_domain'] to locate the right template -- action.xml</li> <li>Create/Design Excel Template File (.xlsx), in the template, name the underlining tab used for export/import -- &lt;file&gt;.xlsx</li> <li>Create instruction dictionary for export/import in xlsx.template model -- templates.xml</li> </ol> <p><strong>Use Case 2:</strong> Import Excel Files</p> <p>With menu wizard to create new documents (example - excel_import_export_demo/import_sale_orders)</p> <ol class="arabic simple"> <li>Create report menu with search wizard, res_model=&quot;import.xlsx.wizard&quot; and context['template_domain'] to locate the right template -- menu_action.xml</li> <li>Create Excel Template File (.xlsx), in the template, name the underlining tab used for import -- &lt;import file&gt;.xlsx</li> <li>Create instruction dictionary for import in xlsx.template model -- templates.xml</li> </ol> <p><strong>Use Case 3:</strong> Create Excel Report</p> <p>This create report menu with criteria wizard. (example - excel_import_export_demo/report_sale_order)</p> <ol class="arabic simple"> <li>Create report's menu, action, and add context['template_domain'] to locate the right template for this report -- &lt;report&gt;.xml</li> <li>Create report's wizard for search criteria. The view inherits <code>excel_import_export.xlsx_report_view</code> and mode=&quot;primary&quot;. In this view, you only need to add criteria fields, the rest will reuse from interited view -- &lt;report.xml&gt;</li> <li>Create report model as models.Transient, then define search criteria fields, and get reporing data into <code>results</code> field -- &lt;report&gt;.py</li> <li>Create/Design Excel Template File (.xlsx), in the template, name the underlining tab used for report results -- &lt;report_file&gt;.xlsx</li> <li>Create instruction dictionary for report in xlsx.template model -- templates.xml</li> </ol> <p><strong>Note:</strong></p> <p>Another option for reporting is to use report action (report_type='excel'), I.e.,</p> <pre> <code lang="xml">&lt;report id='action_report_saleorder_excel' string='Quotation / Order (.xlsx)' model='sale.order' name='sale_order.xlsx' file='sale_order' report_type='excel' /&gt;</code> </pre> <p>By using report action, Odoo will find template using combination of model and name, then do the export for the underlining record. Please see example in excel_import_export_demo/report_action, which shows,</p> <ol class="arabic simple"> <li>Print excel from an active sale.order</li> <li>Run partner list report based on search criteria.</li> </ol> <a name="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id9">Known issues / Roadmap</a></h2> <ul class="simple"> <li>Module extension e.g., excel_import_export_async, that add ability to execute as async process.</li> <li>Ability to add contextual action in XLSX Tempalte, e.g., Add import action, Add export action. In similar manner as in Server Action.</li> </ul> <a name="changelog"></a> <h2><a class="toc-backref" href="#id10">Changelog</a></h2> <a name="id1"></a> <h3><a class="toc-backref" href="#id11">12.0.1.0.5 (2019-12-19)</a></h3> <ul class="simple"> <li>Speed up export when dealing with many rows</li> </ul> <a name="id2"></a> <h3><a class="toc-backref" href="#id12">12.0.1.0.4 (2019-08-28)</a></h3> <ul class="simple"> <li>Fix style sum in footer</li> </ul> <a name="id3"></a> <h3><a class="toc-backref" href="#id13">12.0.1.0.3 (2019-08-09)</a></h3> <ul class="simple"> <li>Add report action for report_type = 'excel'</li> </ul> <a name="id4"></a> <h3><a class="toc-backref" href="#id14">12.0.1.0.2 (2019-08-07)</a></h3> <ul class="simple"> <li>Small fix, to ensure that system parameter 'path_temp_file' (ir.config_parameter) is readable</li> </ul> <a name="id5"></a> <h3><a class="toc-backref" href="#id15">12.0.1.0.1 (2019-06-24)</a></h3> <ul class="simple"> <li>Fix wizard on v12 can't download sample template file - <a class="reference external" href="https://github.com/OCA/server-tools/issues/1574">https://github.com/OCA/server-tools/issues/1574</a></li> </ul> <a name="id6"></a> <h3><a class="toc-backref" href="#id16">12.0.1.0.0 (2019-02-24)</a></h3> <ul class="simple"> <li>Start of the history</li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id17">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20excel_import_export%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id18">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id19">Authors</a></h3> <ul class="simple"> <li>Ecosoft</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id20">Contributors</a></h3> <ul class="simple"> <li>Kitti Upariphutthiphong. &lt;<a class="reference external" href="mailto:kittiu&#64;gmail.com">kittiu&#64;gmail.com</a>&gt; (<a class="reference external" href="http://ecosoft.co.th">http://ecosoft.co.th</a>)</li> <li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</a>&gt; (<a class="reference external" href="http://ecosoft.co.th">http://ecosoft.co.th</a>)</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id21">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p><a class="reference external" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/excel_import_export">OCA/server-tools</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>