Author: |
Davide Corio, Odoo Community Association (OCA) |
License: |
no license |
Branch: |
10-pos_epson_epos-tnvr |
Repository: |
dcorio/pos |
Dependencies: |
base,
point_of_sale,
pos_restaurant,
and
web |
Languages: |
JavaScript (1808, 67.1%),
Python (643, 23.9%),
XML (166, 6.2%),
and
reStructuredText (76, 2.8%) |
Other branches: |
10-add-pos_epson_epos |
<a name="epson-printer-integration"></a>
<h2>Epson printer integration</h2>
<p>This module allows using Epson fiscal printers from within Odoo POS.</p>
<a name="features"></a>
<h3>Features</h3>
<p>POS frontend:</p>
<ul class="simple">
<li>update summary of current bill on the printer</li>
<li>print receipt with printer</li>
<li>possibility to write xml files for receipts to FS</li>
</ul>
<p>POS backend:</p>
<ul class="simple">
<li>buttons to print ZReport ("Chiusura fiscale") and XReport ("Stampa rapporto finanziario")</li>
</ul>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">ZReport button is visible only to users in the group <cite>Chiusura Fiscale (ZReport)</cite></p>
</div>
<a name="configuration"></a>
<h3>Configuration</h3>
<p>Ogni postazione POS (<cite>pos.config</cite>) deve avere questi parametri.</p>
<p>Per la stampa:</p>
<ul class="simple">
<li><cite>Indirizzo IP</cite>: "http(s)://localhost"</li>
<li><cite>Scontrino XML Epson FP</cite>: enabled</li>
<li><cite>Epson receipt action</cite>: "Print it"</li>
<li><cite>Epson printer IP</cite>: ip della stampante nella rete del PC locale</li>
</ul>
<p>Per la scrittura su FS</p>
<ul class="simple">
<li><cite>Indirizzo IP</cite>: "http(s)://localhost"</li>
<li><cite>Scontrino XML Epson FP</cite>: enabled</li>
<li><cite>Epson receipt action</cite>: "Store to FS"</li>
<li><cite>Cartella Epson XML</cite>: path assoluto del PC locale nel quale salvare gli XML</li>
</ul>
<a name="technical-details"></a>
<h2>Technical details</h2>
<a name="javascript"></a>
<h3>Javascript</h3>
<ul>
<li><p class="first"><cite>/static/src/js/pos_epson_epos.js</cite> hooks into POS widget to:</p>
<blockquote>
<ul class="simple">
<li>proxy calls to the printer via <cite>proxy_ip</cite> field on pos.config (usually localhost)</li>
<li>create xml to send to the printer</li>
</ul>
</blockquote>
</li>
<li><p class="first"><cite>/static/src/js/form_button_widget.js</cite> overrides button widget to allow defining specific buttons for printing Z/Xreport</p>
</li>
</ul>
<a name="controllers"></a>
<h3>Controllers</h3>
<p>Defined in <cite>controllers/main.py</cite>:</p>
<ul class="simple">
<li><cite>/pos_epson_epos/<string:action></cite></li>
</ul>
<p>Receives POS calls and send xml to the printer or write it into FS (path defined by <cite>epson_xml_path</cite>)</p>
<ul class="simple">
<li><cite>/pos_epson_epos/zreport_update/<int:company_id></cite></li>
</ul>
<p>Called by the button for ZReport to set the last ZReport date on the company.
You should not be able to print more than one ZReport per day.</p>
<a name="epson-connection"></a>
<h3>Epson connection</h3>
<p><cite>controllers.printer.EpsonPrinter</cite> is responsible for sending/receiving data to/from the printer.</p>
<p>To test the connection you can do:</p>
<pre>
<code># cd path/to/pos_epson_epos/controllers
# python test_printer.py $PRINTER_IP</code>
</pre>
<p>If the printer is connected then you will see the output of its status.</p>
<a name="debug"></a>
<h3>Debug</h3>
<p>Attivare l'inspector di Chrome e controllare che:</p>
<ol class="arabic simple">
<li>controllare che non ci siano errori JS in generale</li>
<li>quando si aggiunge qualcosa al conto si veda nel log <cite>POS: call update_summary</cite></li>
<li>nel log delle chiamate XHR compaia la relativa chiamata a <cite>http://{ip proxy o doman}/pos_epson_epos/update_summary</cite></li>
<li>la response di tale chiamata deve contenere un dizionario con chiave <cite>@success: true</cite> con relativa serie di metadati</li>
</ol>
<p>Fatti i precedenti controlli, per verificare la stampa:</p>
<ol class="arabic simple">
<li>andare a schermata di stampa</li>
<li>nel log delle chiamate XHR compaia la relativa chiamata a <cite>http://{ip proxy o doman}/pos_epson_epos/print_receipt</cite></li>
<li>la response di tale chiamata deve contenere un dizionario con chiave <cite>@success: true</cite> con relativa serie di metadati</li>
</ol>
<a name="epson-docs"></a>
<h3>Epson Docs</h3>
<p>Official Epson docs is "ePOS Fiscal Print Solution Development Guide (for Europe)"</p>
<p>available here <a class="reference external" href="https://download.epson-biz.com/modules/pos/index.php?page=doc&dcat=26">https://download.epson-biz.com/modules/pos/index.php?page=doc&dcat=26</a></p>
<p>The version used to develop this module as of v1 is attached in this module as <cite>ePOS_Fiscal_Print_Solution_Development_Guide_Rev_O.pdf</cite>.</p>
<a name="roadmap"></a>
<h2>Roadmap</h2>
<p>TODO</p>