Commit 1eaca183 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_printer: be able to use sale fast input on ERP5JS

not a generic way
it should add a real epson gadget
parent d7166422
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_onlyjio_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_onlyjio_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>print_by_epson</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>8.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Print By Epson</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SaleOrder_viewPrintByEpsonDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<registered_skin_selection>
<skin_folder_selection>
<skin_folder>erp5_printer</skin_folder>
<skin_selection>View</skin_selection>
<skin_selection>Hal,HalRestricted,RJS,View</skin_selection>
</skin_folder_selection>
</registered_skin_selection>
\ No newline at end of file
<!doctype html>
<html tal:define="data_dict here/Order_getODTDataDict;
<html tal:define="dummy_variable python:context.REQUEST.response.setHeader('Access-Control-Allow-Origin', '*');
data_dict here/Order_getODTDataDict;
portal_url here/portal_url;
reservation python: request.get('reservation_only');
form_id python: request.get('form_id');
......@@ -8,7 +9,7 @@
price_renderer nocall:here/Base_viewTradeFieldLibrary_printer_custom/my_view_mode_total_price/render_pdf;
default_language python:test(request.get('international_form'), 'en', here.Localizer.get_selected_language());
printer_url python:context.SaleOrder_getPrinterUrl();
order_number python:data_dict['reference'];">
order_number python:data_dict['reference']; ">
<head>
<meta charset="utf-8">
<title>Receipt</title>
......@@ -28,7 +29,7 @@
</span>
</h2>
<div tal:define="logo_path python: '%s?display=default_image?pre_converted_only=True&quality=75.0&display=thumbnail&format=png' % data_dict['source_section_image_path'];">
<div tal:define="logo_path python: '%s?quality=75.0&display=small&format=png' % data_dict['source_section_image_absolute_url'];">
<canvas id="canvas" width="512" style="display:none;" height="480"></canvas>
<img id="company_logo" alt="" tal:attributes="src logo_path;" width="250" height="45">
</div>
......@@ -268,7 +269,7 @@
<br />
<br />
<div id="loyalty_information_header" style="width:350px;text-align:center;"
tal:condition="order_number">
tal:condition="python: False # order_number">
<span> Programme de fidélité </span> <br />
<span> www.weinparis.com/loyalty </span>
</div>
......@@ -283,7 +284,7 @@
</div>
<br />
<div id="loyalty_information_bottom" style="width:350px;text-align:center;"
tal:condition="order_number">
tal:condition="python: False # order_number">
<span>en vous inscrivant, bénéficiez de 12% de</span>
<br />
<span>réduction sur votre prochain achat</span>
......@@ -298,7 +299,7 @@
<br>
</article>
<footer>Generated with ERP5 <br /> Open Source ERP suite (www.erp5.com)</footer>
<button tal:condition="python: not request.get('preview_only', 0)"
<button i18n:translate="" i18n:domain="ui" tal:condition="python: not request.get('preview_only', 0)"
id="print_button"
tal:attributes="onclick python:'printInvoiceOnEpson(\'%s\')' % printer_url"
onclick='printInvoiceOnEpson()'>Print by Epson</button>
......@@ -310,18 +311,24 @@
})
</script>
<a tal:condition="python: not reservation" href="./SaleOrder_confirmAndReturn">
<span i18n:translate='' i18n:domain=''> Confirm Order and Return </span>
<span i18n:translate='' i18n:domain='ui'>Confirm Order and Return </span>
</a>
<a tal:condition="reservation" href="./SaleOrderModule_viewReservedItemFastInputDialog">
<span i18n:translate='' i18n:domain=''> Return </span>
</a>
<a style="float:right" tal:attributes="href python:'./SaleOrder_cancelAndReturn?reservation=%s' % reservation">
<span i18n:translate='' i18n:domain=''> Cancel Order and Return</span>
<span i18n:translate='' i18n:domain='ui'>Return</span>
</a>
<div style="float:right">
<a tal:attributes="href python:'./SaleOrder_cancelAndReturn?reservation=%s' % reservation">
<span i18n:translate='' i18n:domain='ui'>Cancel Order and Return</span>
</a>
<br/>
<a href="./" target="_blank" tal:condition="nothing">
<span i18n:translate='' i18n:domain='ui'>Edit Order</span>
</a>
</div>
</tal:block>
<tal:block tal:condition="python: form_id and not request.get('auto_print', 0)">
<a tal:attributes="href string:./${form_id}">
<span i18n:translate='' i18n:domain=''> Return </span>
<a tal:attributes="href string:./${form_id}">
<span i18n:translate='' i18n:domain='ui'>Return</span>
</a>
</tal:block>
<tal:block tal:condition="python: request.get('js_error_log', 1)">
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_viewEpsonPrintoutAsGadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
return context.restrictedTraverse(relative_url).SaleOrder_viewEpsonPrintoutAsGadget()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>relative_url,**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_viewEpsonPrintoutWrapper</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>preview</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_viewPrintByEpsonDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOrder_viewEpsonPrintoutWrapper</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, document*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, document) {
"use strict";
var gadget_klass = rJS(window);
gadget_klass
.declareAcquiredMethod("submitContent", "submitContent")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareMethod("render", function (options) {
var gadget = this;
gadget.state.jio_key = options.jio_key;
return gadget.getSetting('hateoas_url')
.push(function (hateoas_url) {
gadget.state.hateoas_url = hateoas_url;
});
})
.onEvent('submit', function submit(options) {
var method = document.activeElement.value,
gadget = this;
return gadget.submitContent(
gadget.state.jio_key,
gadget.state.hateoas_url + gadget.state.jio_key + "/" + method,
{})
.push(function (result) {
return gadget.redirect({
command: 'display',
options: {
"jio_key": result.jio_key,
"view": result.view
}
});
})
.push(undefined, function(error) {
if (! error instanceof RSVP.CancellationError) {
throw error
}
});
});
}(window, rJS, document));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>erp5_epson_gadget.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Sale Order | order_epson_print
\ No newline at end of file
Sale Order | order_epson_print
Sale Order | print_by_epson
\ No newline at end of file
erp5_printer | Hal
erp5_printer | HalRestricted
erp5_printer | RJS
erp5_printer | View
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment