[MOD]Developer Documentation
@@ -1,8 +1,8 @@
|
||||
:orphan:
|
||||
|
||||
======================================
|
||||
=========================================
|
||||
JSDoc parser/Sphinx extension for Flectra
|
||||
======================================
|
||||
=========================================
|
||||
|
||||
Why?
|
||||
====
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
</div>
|
||||
<ul class="o_primary_nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle">Apps</a>
|
||||
<div class="dropdown-menu o_secondary_nav">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@@ -149,9 +148,6 @@
|
||||
<a href="http://flectrahq.com/apps/modules" class="o_store_link"><i class="fa fa-cube fa-fw"></i> Third party apps</a>
|
||||
</div>
|
||||
</li>
|
||||
<li><a href="https://flectrahq.com/page/tour">Tour</a></li>
|
||||
<li><a href="https://flectrahq.com/pricing">Pricing</a></li>
|
||||
<li><a href="https://flectrahq.com/page/docs">Docs</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<nav class="navbar o_sub_nav">
|
||||
@@ -225,21 +221,25 @@
|
||||
<div class="o_content row">
|
||||
{% if 'has-toc' not in meta and not (pagename in toc) %}
|
||||
<aside>
|
||||
<div class="navbar-aside text-center">
|
||||
{{ toc }}
|
||||
{% if github_link %}
|
||||
<p class="gith-container"><a href="{{ github_link(mode='edit') }}" class="gith-link">
|
||||
Edit on GitHub
|
||||
</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="navbar-aside text-center">
|
||||
{{ toc }}
|
||||
{% if github_link %}
|
||||
<p class="gith-container"><a
|
||||
href="{{ github_link(mode='edit') }}"
|
||||
class="gith-link">
|
||||
Edit on GitLab
|
||||
</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</aside>
|
||||
{% endif %}
|
||||
<article class="doc-body {% if 'has-toc' in meta %}doc-toc{% endif %}{% if pagename in toc%}index-category{% endif %}">
|
||||
{% endif %}
|
||||
{% block body %} {% endblock %}
|
||||
{% if pagename != master_doc %}</article>
|
||||
</div>
|
||||
<article
|
||||
class="doc-body {% if 'has-toc' in meta %}doc-toc{% endif %}{% if pagename in toc%}index-category{% endif %}">
|
||||
{% endif %}
|
||||
{% block body %} {% endblock %}
|
||||
{% if pagename != master_doc %}
|
||||
</article>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="mask"></div>
|
||||
</main>
|
||||
@@ -262,77 +262,196 @@
|
||||
</div>
|
||||
<footer>
|
||||
<div id="footer" class="container">
|
||||
<span class="o_logo o_logo_inverse center-block o_footer_logo"></span>
|
||||
<div class="row">
|
||||
<div class="col-sm-7 col-md-7 col-lg-6">
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<span class="menu_title">Community</span>
|
||||
<ul>
|
||||
<li><a href="https://github.com/flectra/flectra">Github</a></li>
|
||||
<li><a href="http://flectrahq.com/page/download">Download</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="https://runbot.flectrahq.com">Runbot</a></li>
|
||||
<li><a href="https://github.com/flectra/flectra/wiki/Translations">Translations</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="http://flectrahq.com/page/flectra-community">Mailing Lists</a></li>
|
||||
<li><a href="http://flectrahq.com/forum/help-1">Forum</a></li>
|
||||
</ul>
|
||||
<div class="row mt48 mb48">
|
||||
<div class="col-md-12 mb32">
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<h3 class="">
|
||||
Features
|
||||
</h3>
|
||||
<div class="">
|
||||
<ul class="pad0">
|
||||
<li>
|
||||
<a href="https://flectrahq.com/crm">
|
||||
CRM
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/sales">
|
||||
Sales
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/accounting">
|
||||
Accounting
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/purchase">
|
||||
Purchase
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/inventory">
|
||||
Inventory
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<span class="menu_title">Services</span>
|
||||
<ul>
|
||||
<li><a href="https://www.flectra.sh">Flectra Cloud Platform</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="http://flectrahq.com/help">Support</a></li>
|
||||
<li><a href="https://upgrade.flectrahq.com">Upgrade</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="http://flectrahq.com/partners">Find a partner</a></li>
|
||||
<li><a href="http://flectrahq.com/page/become-a-partner">Become a partner</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="http://training.flectrahq.com/courses/flectra-functional">Training Center</a></li>
|
||||
<li><a href="http://flectrahq.com/page/education-program">Education</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="http://flectrahq.com/page/security">Security</a></li>
|
||||
</ul>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<h3 class="">
|
||||
|
||||
</h3>
|
||||
<div class="">
|
||||
<ul class="pad0">
|
||||
<li>
|
||||
<a href="https://flectrahq.com/human-resource">
|
||||
Human Resource
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/cms">
|
||||
CMS
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/point-of-sale">
|
||||
Point Of Sale
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/manufacturing">
|
||||
Manufacturing
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/project-management">
|
||||
Project Management
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4 mb64">
|
||||
<span class="menu_title">About us</span>
|
||||
<ul>
|
||||
<li><a href="http://flectrahq.com/page/about-us">Our company</a></li>
|
||||
<li><a href="http://flectrahq.com/page/contactus">Contact</a></li>
|
||||
<li class="divider" />
|
||||
<li><a href="http://flectrahq.com/event">Events</a></li>
|
||||
<li><a href="http://flectrahq.com/blog">Blog</a></li>
|
||||
<li><a href="http://flectrahq.com/blog/6">Customers</a></li>
|
||||
<li class="divider" />
|
||||
<li><a href="http://flectrahq.com/jobs">Jobs</a></li>
|
||||
<li class="divider" />
|
||||
<li><a href="http://flectrahq.com/page/legal">Legal</a> | <a href="http://flectrahq.com/privacy">Privacy</a></li>
|
||||
</ul>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<h3 class="">
|
||||
Services
|
||||
</h3>
|
||||
<div class="">
|
||||
<ul class="pad0">
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-erp-implementation">
|
||||
Implementation
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-erp-development">
|
||||
Development
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-erp-support">
|
||||
Support
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-erp-training">
|
||||
Training
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/online-flectra-pricing">
|
||||
Pricing
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-release-note-1-0">
|
||||
Release Notes
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<h3 class="">
|
||||
|
||||
</h3>
|
||||
<div class="">
|
||||
<ul class="pad0">
|
||||
<li>
|
||||
<a href="https://doc.flectrahq.com/"
|
||||
target="_blank">
|
||||
Documentation
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/become-a-partner">
|
||||
Become a partner
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/partners">
|
||||
Partners
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/brand-assets">
|
||||
Brand Assets
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/flectra-support-plan">
|
||||
Support Plan
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://flectrahq.com/contactus">
|
||||
Contact Us
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5 col-md-4 col-md-offset-1 col-lg-5 col-lg-offset-1">
|
||||
<p>
|
||||
<small>
|
||||
Flectra is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.
|
||||
<br/><br/>
|
||||
Flectra's unique value proposition is to be at the same time very easy to use and fully integrated.
|
||||
</small>
|
||||
</p>
|
||||
<div class="col-md-12">
|
||||
<hr>
|
||||
<div class="social-btns text-center">
|
||||
<div class="">
|
||||
<a class="do-btn-round-outline facebook-footer btn"
|
||||
href="https://www.facebook.com/flectrahq/"
|
||||
target="_blank">
|
||||
<span>Facebook</span>
|
||||
</a>
|
||||
<a class="do-btn-round-outline twitter-footer btn"
|
||||
href="https://twitter.com/flectrahq"
|
||||
target="_blank">
|
||||
<span>Twitter</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mt16 mb16 font-14px ext_page">
|
||||
<a href="https://flectrahq.com/trademarks" class="ml8 mr8">
|
||||
Trademarks
|
||||
</a>
|
||||
<a href="https://flectrahq.com/privacy-policy" class="ml8 mr8">
|
||||
Privacy Policy
|
||||
</a>
|
||||
<a href="https://flectrahq.com/disclaimer" class="ml8 mr8">
|
||||
Disclaimer
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_footer_bottom">
|
||||
<div class="container">
|
||||
<a class="small" href="http://flectrahq.com/page/website-builder">Website made with <span class="o_logo o_logo_inverse o_logo_15"></span></a>
|
||||
<div class="social-links pull-right">
|
||||
<a href="http://flectrahq.com/web/about/facebook"><i class="fa fa-facebook"></i></a>
|
||||
<a href="http://flectrahq.com/web/about/twitter"><i class="fa fa-twitter"></i></a>
|
||||
<a href="http://flectrahq.com/web/about/linkedin"><i class="fa fa-linkedin"></i></a>
|
||||
<a href="mailto:info@flectrahq.com"><i class="fa fa-envelope"></i></a>
|
||||
</div>
|
||||
<div class="social-links pull-right">
|
||||
<a href="https://www.facebook.com/flectrahq"><i
|
||||
class="fa fa-facebook"></i></a>
|
||||
<a href="https://twitter.com/flectrahq"><i
|
||||
class="fa fa-twitter"></i></a>
|
||||
<a href="mailto:info@flectrahq.com"><i
|
||||
class="fa fa-envelope"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -1,31 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="1254px" height="200px" viewBox="0 0 1254 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.3.3 (12081) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>odoo_logo</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="odoo_logo" sketch:type="MSArtboardGroup">
|
||||
<g id="odoo_logo_rgb" sketch:type="MSLayerGroup" transform="translate(0.000000, 1.000000)">
|
||||
<path d="M550.5,198.865327 C592.197499,198.865327 626,165.062825 626,123.365327 C626,81.667828 592.197499,47.8653266 550.5,47.8653266 C508.802501,47.8653266 475,81.667828 475,123.365327 C475,165.062825 508.802501,198.865327 550.5,198.865327 Z M550.5,167.865327 C575.076671,167.865327 595,147.941998 595,123.365327 C595,98.7886553 575.076671,78.8653266 550.5,78.8653266 C525.923329,78.8653266 506,98.7886553 506,123.365327 C506,147.941998 525.923329,167.865327 550.5,167.865327 Z" id="Oval-3" fill="#888888" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M390.5,198.865327 C432.197499,198.865327 466,165.062825 466,123.365327 C466,81.667828 432.197499,47.8653266 390.5,47.8653266 C348.802501,47.8653266 315,81.667828 315,123.365327 C315,165.062825 348.802501,198.865327 390.5,198.865327 Z M390.5,167.865327 C415.076671,167.865327 435,147.941998 435,123.365327 C435,98.7886553 415.076671,78.8653266 390.5,78.8653266 C365.923329,78.8653266 346,98.7886553 346,123.365327 C346,147.941998 365.923329,167.865327 390.5,167.865327 Z" id="Oval-2" fill="#888888" sketch:type="MSShapeGroup"></path>
|
||||
<g id="D" transform="translate(157.000000, 0.000000)" fill="#888888" sketch:type="MSShapeGroup">
|
||||
<g id="d-+-Rectangle-1">
|
||||
<path d="M151.130367,122.770274 C151.131897,122.968444 151.132663,123.166796 151.132663,123.365327 C151.132663,165.062825 117.330162,198.865327 75.6326633,198.865327 C33.9351647,198.865327 0.132663317,165.062825 0.132663317,123.365327 C0.132663317,81.667828 33.9351647,47.8653266 75.6326633,47.8653266 C92.7270283,47.8653266 108.494494,53.5464573 121.149994,63.1236518 L121.149994,15.0040777 C121.149994,6.71755439 127.863901,0 136.149994,0 C144.434265,0 151.149994,6.72381102 151.149994,15.0040777 L151.149994,121.995922 C151.149994,122.255634 151.143399,122.513804 151.130367,122.770274 L151.130367,122.770274 Z M75.6326633,167.865327 C100.209335,167.865327 120.132663,147.941998 120.132663,123.365327 C120.132663,98.7886553 100.209335,78.8653266 75.6326633,78.8653266 C51.055992,78.8653266 31.1326633,98.7886553 31.1326633,123.365327 C31.1326633,147.941998 51.055992,167.865327 75.6326633,167.865327 Z" id="d"></path>
|
||||
</g>
|
||||
</g>
|
||||
<path d="M76.1924623,198.697487 C117.889961,198.697487 151.692462,164.894986 151.692462,123.197487 C151.692462,81.4999888 117.889961,47.6974874 76.1924623,47.6974874 C34.4949637,47.6974874 0.692462312,81.4999888 0.692462312,123.197487 C0.692462312,164.894986 34.4949637,198.697487 76.1924623,198.697487 Z M75.5,168 C100.076671,168 120,148.076671 120,123.5 C120,98.9233286 100.076671,79 75.5,79 C50.9233286,79 31,98.9233286 31,123.5 C31,148.076671 50.9233286,168 75.5,168 Z" id="Oval-1" fill="#9C5789" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
<g id="odoo_logo_white" sketch:type="MSLayerGroup" transform="translate(627.000000, 1.000000)" fill="#FFFFFF">
|
||||
<path d="M550.5,198.865327 C592.197499,198.865327 626,165.062825 626,123.365327 C626,81.667828 592.197499,47.8653266 550.5,47.8653266 C508.802501,47.8653266 475,81.667828 475,123.365327 C475,165.062825 508.802501,198.865327 550.5,198.865327 Z M550.5,167.865327 C575.076671,167.865327 595,147.941998 595,123.365327 C595,98.7886553 575.076671,78.8653266 550.5,78.8653266 C525.923329,78.8653266 506,98.7886553 506,123.365327 C506,147.941998 525.923329,167.865327 550.5,167.865327 Z" id="Oval-3" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M390.5,198.865327 C432.197499,198.865327 466,165.062825 466,123.365327 C466,81.667828 432.197499,47.8653266 390.5,47.8653266 C348.802501,47.8653266 315,81.667828 315,123.365327 C315,165.062825 348.802501,198.865327 390.5,198.865327 Z M390.5,167.865327 C415.076671,167.865327 435,147.941998 435,123.365327 C435,98.7886553 415.076671,78.8653266 390.5,78.8653266 C365.923329,78.8653266 346,98.7886553 346,123.365327 C346,147.941998 365.923329,167.865327 390.5,167.865327 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>
|
||||
<g id="D" transform="translate(157.000000, 0.000000)" sketch:type="MSShapeGroup">
|
||||
<g id="d-+-Rectangle-1">
|
||||
<path d="M151.130367,122.770274 C151.131897,122.968444 151.132663,123.166796 151.132663,123.365327 C151.132663,165.062825 117.330162,198.865327 75.6326633,198.865327 C33.9351647,198.865327 0.132663317,165.062825 0.132663317,123.365327 C0.132663317,81.667828 33.9351647,47.8653266 75.6326633,47.8653266 C92.7270283,47.8653266 108.494494,53.5464573 121.149994,63.1236518 L121.149994,15.0040777 C121.149994,6.71755439 127.863901,0 136.149994,0 C144.434265,0 151.149994,6.72381102 151.149994,15.0040777 L151.149994,121.995922 C151.149994,122.255634 151.143399,122.513804 151.130367,122.770274 L151.130367,122.770274 Z M75.6326633,167.865327 C100.209335,167.865327 120.132663,147.941998 120.132663,123.365327 C120.132663,98.7886553 100.209335,78.8653266 75.6326633,78.8653266 C51.055992,78.8653266 31.1326633,98.7886553 31.1326633,123.365327 C31.1326633,147.941998 51.055992,167.865327 75.6326633,167.865327 Z" id="d"></path>
|
||||
</g>
|
||||
</g>
|
||||
<path d="M76.1924623,198.697487 C117.889961,198.697487 151.692462,164.894986 151.692462,123.197487 C151.692462,81.4999888 117.889961,47.6974874 76.1924623,47.6974874 C34.4949637,47.6974874 0.692462312,81.4999888 0.692462312,123.197487 C0.692462312,164.894986 34.4949637,198.697487 76.1924623,198.697487 Z M75.5,168 C100.076671,168 120,148.076671 120,123.5 C120,98.9233286 100.076671,79 75.5,79 C50.9233286,79 31,98.9233286 31,123.5 C31,148.076671 50.9233286,168 75.5,168 Z" id="Oval-1" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="800px" height="350px" viewBox="0 0 800 350" style="enable-background:new 0 0 800 350;" xml:space="preserve">
|
||||
<rect style="display:none;" width="800" height="350"/>
|
||||
<g>
|
||||
<g>
|
||||
<path style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;" d="M135.55,163.083c0,0,7.69,26.345,33.097,44.28h111.345
|
||||
c0,0-3.195-20.385,0.767-44.287L135.55,163.083z"/>
|
||||
<path style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;" d="M228.436,101.231c5.857-14.035,34.104-44.08,75.541-26.84
|
||||
l63.472-0.164L319.41,84.862c0,0-25.254,25.398-34.652,60.649H81.103c0,0-22.948-14.831-33.319-44.281H228.436L228.436,101.231z
|
||||
M289.486,82.889c-2.597,0-4.702,2.106-4.702,4.705c0,2.598,2.105,4.704,4.702,4.704c2.596,0,4.701-2.106,4.701-4.704
|
||||
C294.188,84.995,292.083,82.889,289.486,82.889z"/>
|
||||
<path style="fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;" d="M223.241,225.077l60.127-0.031
|
||||
c5.785,22.587,15.106,37.899,19.125,44.437C294.204,269.464,251.567,268.697,223.241,225.077z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path style="fill:#FFFFFF;" d="M327.853,143.301h57.971c1.329,0,2.465,0.474,3.412,1.42c0.946,0.947,1.419,2.084,1.419,3.414
|
||||
c0,1.329-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.412,1.42h-53.14v33.836h38.647c1.329,0,2.465,0.474,3.412,1.42
|
||||
c0.946,0.946,1.419,2.084,1.419,3.414c0,1.329-0.474,2.468-1.419,3.413c-0.946,0.947-2.083,1.42-3.412,1.42h-38.647v38.67
|
||||
c0,1.329-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.412,1.42c-1.328,0-2.466-0.473-3.412-1.42
|
||||
c-0.946-0.946-1.419-2.085-1.419-3.414v-87.007c0-1.33,0.473-2.467,1.419-3.414C325.387,143.775,326.525,143.301,327.853,143.301z
|
||||
"/>
|
||||
<path style="fill:#FFFFFF;" d="M400.316,148.135c0-1.33,0.473-2.467,1.419-3.414c0.945-0.946,2.083-1.42,3.412-1.42
|
||||
c1.328,0,2.465,0.474,3.411,1.42c0.945,0.947,1.419,2.084,1.419,3.414v82.174h4.831c1.329,0,2.466,0.474,3.412,1.42
|
||||
c0.945,0.946,1.419,2.084,1.419,3.413s-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.412,1.42h-9.661
|
||||
c-1.329,0-2.467-0.473-3.412-1.42c-0.946-0.946-1.419-2.085-1.419-3.414V148.135z"/>
|
||||
<path style="fill:#FFFFFF;" d="M481.717,223.541c1.328,0,2.465,0.474,3.412,1.42c0.945,0.947,1.419,2.084,1.419,3.414
|
||||
c0,1.329-0.464,2.477-1.39,3.443c-6.24,5.438-13.586,8.157-22.04,8.157c-9.341,0-17.312-3.303-23.913-9.909
|
||||
c-6.603-6.605-9.903-14.581-9.903-23.927c0-9.345,3.301-17.32,9.903-23.927c6.602-6.606,14.572-9.91,23.913-9.91
|
||||
c9.339,0,17.31,3.304,23.912,9.91c6.603,6.606,9.903,14.582,9.903,23.927c0,1.329-0.474,2.468-1.419,3.414
|
||||
c-0.946,0.946-2.083,1.42-3.411,1.42h-52.718c0.886,4.632,3.1,8.721,6.643,12.266c4.71,4.713,10.406,7.069,17.09,7.069
|
||||
c6.038,0,11.231-1.913,15.579-5.74C479.582,223.884,480.589,223.541,481.717,223.541z M486.85,201.306
|
||||
c-0.886-4.632-3.101-8.721-6.643-12.266c-4.71-4.713-10.407-7.069-17.089-7.069c-6.684,0-12.38,2.356-17.09,7.069
|
||||
c-3.543,3.545-5.757,7.634-6.643,12.266H486.85z"/>
|
||||
<path style="fill:#FFFFFF;" d="M559.132,223.42c1.328,0,2.465,0.474,3.411,1.42c0.945,0.947,1.419,2.085,1.419,3.414
|
||||
s-0.504,2.518-1.51,3.564c-6.24,5.438-13.586,8.157-22.04,8.157c-9.341,0-17.312-3.303-23.913-9.909
|
||||
c-6.603-6.605-9.903-14.581-9.903-23.927c0-9.345,3.301-17.32,9.903-23.927c6.602-6.606,14.572-9.91,23.913-9.91
|
||||
c8.454,0,15.8,2.719,22.04,8.157c1.127,1.008,1.691,2.257,1.691,3.746c0,1.33-0.474,2.468-1.419,3.414
|
||||
c-0.946,0.947-2.084,1.42-3.412,1.42c-1.168,0-2.194-0.362-3.08-1.088c-4.509-3.987-9.782-5.981-15.82-5.981
|
||||
c-6.684,0-12.38,2.356-17.09,7.069s-7.065,10.413-7.065,17.1s2.355,12.387,7.065,17.1s10.406,7.069,17.09,7.069
|
||||
c6.038,0,11.292-1.974,15.761-5.922C557.018,223.743,558.004,223.42,559.132,223.42z"/>
|
||||
<path style="fill:#FFFFFF;" d="M608.045,230.309c1.328,0,2.465,0.474,3.411,1.42c0.945,0.946,1.419,2.084,1.419,3.413
|
||||
s-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.411,1.42c-16.104,0-24.155-8.056-24.155-24.169v-33.836h-4.83
|
||||
c-1.329,0-2.467-0.473-3.412-1.42c-0.946-0.946-1.419-2.084-1.419-3.414c0-1.329,0.473-2.467,1.419-3.414
|
||||
c0.945-0.946,2.083-1.42,3.412-1.42h4.83v-24.168c0-1.33,0.474-2.467,1.42-3.414c0.945-0.946,2.083-1.42,3.411-1.42
|
||||
c1.329,0,2.466,0.474,3.412,1.42c0.945,0.947,1.419,2.084,1.419,3.414v24.168h9.723c1.328,0,2.465,0.474,3.411,1.42
|
||||
c0.945,0.947,1.419,2.084,1.419,3.414c0,1.33-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.411,1.42h-9.723v33.836
|
||||
C593.552,225.475,598.383,230.309,608.045,230.309z"/>
|
||||
<path style="fill:#FFFFFF;" d="M622.537,177.137c0-1.329,0.473-2.467,1.419-3.414c0.945-0.946,2.083-1.42,3.412-1.42
|
||||
c1.328,0,2.465,0.474,3.411,1.42c0.945,0.947,1.419,2.084,1.419,3.414v5.317c6.764-6.767,14.814-10.151,24.155-10.151
|
||||
c4.71,0,9.037,0.806,12.982,2.417c0.725,0.282,1.389,0.705,1.993,1.269c0.926,0.966,1.389,2.114,1.389,3.443
|
||||
c0,1.33-0.474,2.469-1.419,3.414c-0.946,0.947-2.084,1.42-3.412,1.42c-0.765,0-1.47-0.16-2.113-0.483
|
||||
c-2.859-1.208-5.999-1.813-9.42-1.813c-6.684,0-12.38,2.356-17.09,7.069s-7.065,10.413-7.065,17.1v29.002
|
||||
c0,1.329-0.474,2.468-1.419,3.414c-0.946,0.947-2.083,1.42-3.411,1.42c-1.329,0-2.467-0.473-3.412-1.42
|
||||
c-0.946-0.946-1.419-2.085-1.419-3.414V177.137z"/>
|
||||
<path style="fill:#FFFFFF;" d="M738.479,229.825c-6.764,6.767-14.815,10.15-24.154,10.15c-9.341,0-17.312-3.303-23.913-9.909
|
||||
c-6.603-6.605-9.903-14.581-9.903-23.927c0-9.345,3.301-17.32,9.903-23.927c6.602-6.606,14.572-9.91,23.913-9.91
|
||||
c9.339,0,17.31,3.304,23.912,9.91c6.603,6.606,9.903,14.582,9.903,23.927v29.002c0,1.329-0.474,2.468-1.419,3.414
|
||||
c-0.946,0.947-2.083,1.42-3.411,1.42c-1.329,0-2.467-0.473-3.412-1.42c-0.946-0.946-1.419-2.085-1.419-3.414V229.825z
|
||||
M714.324,181.971c-6.684,0-12.38,2.356-17.09,7.069s-7.065,10.413-7.065,17.1s2.355,12.387,7.065,17.1s10.406,7.069,17.09,7.069
|
||||
c6.682,0,12.379-2.356,17.089-7.069s7.065-10.413,7.065-17.1s-2.355-12.387-7.065-17.1S721.006,181.971,714.324,181.971z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.1 KiB |
@@ -1,11 +1,5 @@
|
||||
{# note: if flectrahq.com/page/docs sub-menu's structure change, these links have to change as well #}
|
||||
|
||||
<li><a href="https://doc.flectrahq.com/2.0/index.html">User</a></li>
|
||||
<li><a href="https://flectrahq.com/documentation/2.0/index.html">Developer</a></li>
|
||||
<li><a href="https://flectrahq.com/documentation/2.0/setup/install.html">Installation</a></li>
|
||||
<li><a href="https://flectrahq.com/slides">eLearning</a></li>
|
||||
<li><a href="https://flectrahq.com/page/flectra-white-paper">White Papers</a></li>
|
||||
<li><a href="https://flectrahq.com/page/legal">Legal</a></li>
|
||||
|
||||
{%- if pagename != "search" and builder != "singlehtml" %}
|
||||
<li id="searchbox" style="display: none; margin: 0 0 0 10px;" role="search">
|
||||
|
||||
@@ -3,6 +3,7 @@ import importlib
|
||||
import os.path
|
||||
|
||||
from werkzeug import urls
|
||||
from flectra.tools import pycompat
|
||||
|
||||
"""
|
||||
* adds github_link(mode) context variable: provides URL (in relevant mode) of
|
||||
@@ -26,8 +27,8 @@ Notes
|
||||
"""
|
||||
|
||||
def setup(app):
|
||||
app.add_config_value('github_user', None, 'env')
|
||||
app.add_config_value('github_project', None, 'env')
|
||||
app.add_config_value('gitlab_user', None, 'env')
|
||||
app.add_config_value('gitlab_project', None, 'env')
|
||||
app.connect('html-page-context', add_doc_link)
|
||||
|
||||
def linkcode_resolve(domain, info):
|
||||
@@ -36,7 +37,7 @@ def setup(app):
|
||||
# TODO: js?
|
||||
if domain != 'py':
|
||||
return None
|
||||
if not (app.config.github_user and app.config.github_project):
|
||||
if not (app.config.gitlab_user and app.config.gitlab_project):
|
||||
return None
|
||||
|
||||
module, fullname = info['module'], info['fullname']
|
||||
@@ -66,40 +67,73 @@ def setup(app):
|
||||
import flectra
|
||||
# FIXME: make finding project root project-independent
|
||||
project_root = os.path.join(os.path.dirname(flectra.__file__), '..')
|
||||
return make_github_link(
|
||||
return make_gitlab_link(
|
||||
app,
|
||||
os.path.relpath(obj_source_path, project_root),
|
||||
line)
|
||||
app.config.linkcode_resolve = linkcode_resolve
|
||||
|
||||
def make_github_link(app, path, line=None, mode="blob"):
|
||||
# def make_github_link(app, path, line=None, mode="blob"):
|
||||
# config = app.config
|
||||
# print("configggggg\n\n\n\n\n\n",ap)
|
||||
|
||||
# urlpath = "/{user}/{project}/{mode}/{branch}/{path}".format(
|
||||
# user=config.github_user,
|
||||
# project=config.github_project,
|
||||
# branch=config.version or 'master',
|
||||
# path=path,
|
||||
# mode=mode,
|
||||
# )
|
||||
# return urls.url_unparse((
|
||||
# 'https',
|
||||
# 'gitlab.com',
|
||||
# urlpath,
|
||||
# '',
|
||||
# '' if line is None else 'L%d' % line
|
||||
# ))
|
||||
|
||||
def make_gitlab_link(app, path, line=None, mode="blob"):
|
||||
config = app.config
|
||||
|
||||
urlpath = "/{user}/{project}/{mode}/{branch}/{path}".format(
|
||||
user=config.github_user,
|
||||
project=config.github_project,
|
||||
user=config.gitlab_user,
|
||||
project=config.gitlab_project,
|
||||
branch=config.version or 'master',
|
||||
path=path,
|
||||
mode=mode,
|
||||
)
|
||||
return urls.url_unparse((
|
||||
'https',
|
||||
'github.com',
|
||||
'gitlab.com',
|
||||
urlpath,
|
||||
'',
|
||||
'' if line is None else 'L%d' % line
|
||||
))
|
||||
# def add_doc_link(app, pagename, templatename, context, doctree):
|
||||
# """ Add github_link function linking to the current page on github """
|
||||
# if not app.config.github_user and app.config.github_project:
|
||||
# return
|
||||
|
||||
# source_suffix = app.config.source_suffix
|
||||
# # in 1.3 source_suffix can be a list
|
||||
# # in 1.8 source_suffix can be a mapping
|
||||
# # FIXME: will break if we ever add support for !rst markdown documents maybe
|
||||
# if not isinstance(source_suffix, str):
|
||||
# source_suffix = next(iter(source_suffix))
|
||||
# # can't use functools.partial because 3rd positional is line not mode
|
||||
# context['github_link'] = lambda mode='edit': make_gitlab_link(
|
||||
# app, 'doc/%s%s' % (pagename, source_suffix), mode=mode)
|
||||
|
||||
def add_doc_link(app, pagename, templatename, context, doctree):
|
||||
""" Add github_link function linking to the current page on github """
|
||||
if not app.config.github_user and app.config.github_project:
|
||||
""" Add gitlab_link function linking to the current page on gitlab """
|
||||
if not app.config.gitlab_user and app.config.gitlab_project:
|
||||
return
|
||||
|
||||
# FIXME: find other way to recover current document's source suffix
|
||||
# in Sphinx 1.3 it's possible to have mutliple source suffixes and that
|
||||
# may be useful in the future
|
||||
source_suffix = app.config.source_suffix
|
||||
# in 1.3 source_suffix can be a list
|
||||
# in 1.8 source_suffix can be a mapping
|
||||
# FIXME: will break if we ever add support for !rst markdown documents maybe
|
||||
if not isinstance(source_suffix, str):
|
||||
source_suffix = next(iter(source_suffix))
|
||||
# source_suffix = source_suffix if isinstance(source_suffix, pycompat.string_types) else source_suffix[0]
|
||||
# can't use functools.partial because 3rd positional is line not mode
|
||||
context['github_link'] = lambda mode='edit': make_github_link(
|
||||
context['github_link'] = lambda mode='edit': make_gitlab_link(
|
||||
app, 'doc/%s%s' % (pagename, source_suffix), mode=mode)
|
||||
|
||||
@@ -180,10 +180,11 @@ todo_include_todos = False
|
||||
intersphinx_mapping = {
|
||||
'python': ('https://docs.python.org/3/', None),
|
||||
'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),
|
||||
'sqlalchemy': ('http://docs.sqlalchemy.org/en/rel_0_9/', None),
|
||||
'django': ('https://django.readthedocs.org/en/latest/', None),
|
||||
}
|
||||
|
||||
github_user = 'flectra'
|
||||
github_project = 'flectra'
|
||||
gitlab_user = 'flectra-hq'
|
||||
gitlab_project = 'flectra'
|
||||
|
||||
# monkeypatch PHP lexer to not require <?php
|
||||
from sphinx.highlighting import lexers
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
===================
|
||||
======================
|
||||
Profiling Flectra code
|
||||
===================
|
||||
======================
|
||||
|
||||
.. warning::
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 328 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 217 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 102 KiB |
@@ -1,8 +1,8 @@
|
||||
:banner: banners/build_a_theme.jpg
|
||||
|
||||
=====================
|
||||
==============
|
||||
Theme Tutorial
|
||||
=====================
|
||||
==============
|
||||
|
||||
.. rst-class:: lead
|
||||
|
||||
@@ -11,7 +11,7 @@ freedom for the user to customize everything according to their needs.
|
||||
|
||||
Ready to create your own theme? Great. Here are some things you should know before you begin. This tutorial is a guide to creating an Flectra theme.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/Intro.jpg
|
||||
.. image:: theme_tutorial_assets/img/flectra_intro.jpg
|
||||
|
||||
|
||||
An introduction for web designers
|
||||
@@ -25,7 +25,7 @@ This introduction will outline the basics of Flectra theme creation.
|
||||
Flectra’s team has created a framework that’s powerful and easy to use. There’s no need to know special syntaxes to use this set of tools.
|
||||
|
||||
From common CMS to Flectra
|
||||
-----------------------
|
||||
--------------------------
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -41,7 +41,7 @@ This is usually the first question from a web designer used to working with Word
|
||||
|
||||
.. container:: col-sm-4
|
||||
|
||||
.. image:: theme_tutorial_assets/img/cms.jpg
|
||||
.. image:: theme_tutorial_assets/img/flectra_cms.jpg
|
||||
|
||||
.. container:: col-sm-7
|
||||
|
||||
@@ -54,7 +54,7 @@ This is usually the first question from a web designer used to working with Word
|
||||
We think that theme design should be simple (and powerful). When we created our Website Builder, we decided to start from scratch instead of relying on what already existed. This approach gave us the freedom to focus on the things that are really important for designers: styles, content and the logic behind them. No more struggling with technical stuff.
|
||||
|
||||
Flectra default theme structure
|
||||
----------------------------
|
||||
-------------------------------
|
||||
|
||||
.. container:: row
|
||||
|
||||
@@ -69,7 +69,7 @@ Flectra default theme structure
|
||||
|
||||
.. container:: col-sm-4
|
||||
|
||||
.. image:: theme_tutorial_assets/img/def_structure.jpg
|
||||
.. image:: theme_tutorial_assets/img/flectra_structure.jpg
|
||||
|
||||
.. container:: row
|
||||
|
||||
@@ -109,14 +109,14 @@ Let’s take a tour of our “list” elements:
|
||||
|
||||
.. container:: row
|
||||
|
||||
.. figure:: theme_tutorial_assets/img/snippet.jpg
|
||||
.. figure:: theme_tutorial_assets/img/flectra_snippet.jpg
|
||||
:figclass: col-sm-6
|
||||
|
||||
Snippets (or building-blocks)
|
||||
|
||||
A piece of HTML code. The user will drag&drop, modify and combine them using our built-in Website Builder interface. You can define sets of options and styles for each snippet. The user will choose from them according to their needs.
|
||||
|
||||
.. figure:: theme_tutorial_assets/img/page.jpg
|
||||
.. figure:: theme_tutorial_assets/img/flectra_page.jpg
|
||||
:figclass: col-sm-6
|
||||
|
||||
Pages
|
||||
@@ -129,14 +129,14 @@ Let’s take a tour of our “list” elements:
|
||||
|
||||
.. container:: row
|
||||
|
||||
.. figure:: theme_tutorial_assets/img/styles.jpg
|
||||
.. figure:: theme_tutorial_assets/img/flectra_styles.jpg
|
||||
:figclass: col-sm-6
|
||||
|
||||
Styles
|
||||
|
||||
Styles are defined using standard CSS files (or Less/Sass). You can define a style as **default** or **optional**. The default styles are always active in your theme, the optional styles can be enabled or disabled by the user.
|
||||
|
||||
.. figure:: theme_tutorial_assets/img/functionalities.jpg
|
||||
.. figure:: theme_tutorial_assets/img/flectra_functionalities.jpg
|
||||
:figclass: col-sm-6
|
||||
|
||||
Functionalities
|
||||
@@ -145,7 +145,7 @@ Let’s take a tour of our “list” elements:
|
||||
|
||||
|
||||
Flectra's XML files, an overview
|
||||
-----------------------------
|
||||
--------------------------------
|
||||
|
||||
Any Flectra XML file starts with encoding specifications.
|
||||
After that, you have to write your code inside a ``<flectra>`` tag.
|
||||
@@ -284,7 +284,7 @@ Under **Website** section click the **Pick a Theme** button, then hover over
|
||||
your theme and click **Use this theme**.
|
||||
|
||||
Structure of an Flectra page
|
||||
=========================
|
||||
============================
|
||||
|
||||
An Flectra page is the visual result of a combination of 2 kind of elements, **cross-pages** and **unique**.
|
||||
By default, Flectra provides you with a **Header** and a **Footer** (cross-pages) and a unique main element that contains the content that makes your page unique.
|
||||
@@ -293,7 +293,7 @@ By default, Flectra provides you with a **Header** and a **Footer** (cross-pages
|
||||
|
||||
Cross-pages elements will be the same on every page. Unique elements are related to a specific page only.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/page_structure.jpg
|
||||
.. image:: theme_tutorial_assets/img/flectra_page_structure.jpg
|
||||
|
||||
To inspect the default layout, simply create a new page using the
|
||||
Website Builder. Click on :menuselection:`Content --> New Page` and
|
||||
@@ -371,7 +371,7 @@ Great! We successfully added an id to the
|
||||
header and an element after the navigation menu. These changes will be
|
||||
applied to each page of the website.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/after-menu.png
|
||||
.. image:: theme_tutorial_assets/img/flectra_after_menu.png
|
||||
:class: shadow-0
|
||||
|
||||
Create a specific page layout
|
||||
@@ -547,7 +547,7 @@ Great, our Services page is ready and you’ll be able to access it by navigatin
|
||||
You will notice that it's possible to drag/drop snippets underneath the
|
||||
*Our Services* list.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/services_page_nostyle.png
|
||||
.. image:: theme_tutorial_assets/img/flectra_services_page_nostyle.png
|
||||
:class: shadow-0
|
||||
|
||||
Now let's go back to our *pages.xml* and, after our page template,
|
||||
@@ -564,7 +564,7 @@ copy/paste the following code.
|
||||
|
||||
This code will add a link to the main menu, referring to the page we created.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/services_page_menu.png
|
||||
.. image:: theme_tutorial_assets/img/flectra_services_page_menu.png
|
||||
:class: shadow-0
|
||||
|
||||
The **sequence** attribute defines the link’s position in the top menu.
|
||||
@@ -645,7 +645,7 @@ Update your theme
|
||||
|
||||
Our scss file is now included in our theme, it will be automatically compiled, minified and combined with all Flectra’s assets.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/services_page_styled.png
|
||||
.. image:: theme_tutorial_assets/img/flectra_services_page_styled.png
|
||||
:class: shadow-0
|
||||
|
||||
Create Snippets
|
||||
@@ -913,7 +913,7 @@ Let’s test our new javascript function. Enter in Edit mode and drop into the p
|
||||
You should now see the javascript alert that we bound on the ``onFocus`` event.
|
||||
If you close it, then click outside of your snippet and then click in it again, the event will trigger again.
|
||||
|
||||
.. image:: theme_tutorial_assets/img/snippet_custom_method.png
|
||||
.. image:: theme_tutorial_assets/img/flectra_snippet_custom_method.png
|
||||
:class: shadow-0
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
:banner: banners/build_interface_ext.jpg
|
||||
|
||||
=============================
|
||||
==========================
|
||||
Customizing the web client
|
||||
=============================
|
||||
==========================
|
||||
|
||||
Note: this section is really really out of date. It will be updated someday,
|
||||
but meanwhile, this tutorial will probably be frustrating to follow, since it
|
||||
@@ -119,8 +119,7 @@ The files in the ``static`` folder, need to be defined within the module in orde
|
||||
individual files disappear and the code is made significantly less
|
||||
readable. It is possible to disable this process by enabling the
|
||||
"developer mode": log into your Flectra instance (user *admin* password
|
||||
*admin* by default) open the user menu (in the top-right corner of the
|
||||
Flectra screen) and select :guilabel:`About Flectra` then :guilabel:`Activate
|
||||
*admin* by default) open the setting menu and select :guilabel:`Activate
|
||||
the developer mode`:
|
||||
|
||||
.. image:: web/about_flectra.png
|
||||
@@ -135,7 +134,7 @@ The files in the ``static`` folder, need to be defined within the module in orde
|
||||
.. todo:: qweb files hooked via __manifest__.py, but js and CSS use bundles
|
||||
|
||||
Flectra JavaScript Module
|
||||
======================
|
||||
=========================
|
||||
|
||||
Javascript doesn't have built-in modules. As a result variables defined in
|
||||
different files are all mashed together and may conflict. This has given rise
|
||||
@@ -1269,7 +1268,7 @@ initialized, for class attributes for instance (as modules are loaded before
|
||||
the user's language is configured and translations are downloaded).
|
||||
|
||||
Communication with the Flectra Server
|
||||
==================================
|
||||
=====================================
|
||||
|
||||
Contacting Models
|
||||
-----------------
|
||||
|
||||
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 114 KiB |
@@ -110,7 +110,7 @@ Academy` and clicking :guilabel:`Upgrade`.
|
||||
|
||||
Going to http://localhost:8069/academy/academy/ should now result in:
|
||||
|
||||
.. image:: website/basic-list.png
|
||||
.. image:: website/flectra_basic-list.png
|
||||
|
||||
Storing data in Flectra
|
||||
=======================
|
||||
@@ -208,7 +208,7 @@ manifest and template) access http://localhost:8069/academy/academy/ should
|
||||
yield a nicer looking page with branding and a number of built-in page
|
||||
elements (top-level menu, footer, …)
|
||||
|
||||
.. image:: website/layout.png
|
||||
.. image:: website/flectra_layout.png
|
||||
|
||||
The website layout also provides support for editing tools: click
|
||||
:guilabel:`Sign In` (in the top-right), fill the credentials in (``admin`` /
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -24,5 +24,4 @@ Reference
|
||||
reference/reports
|
||||
reference/mixins
|
||||
reference/guidelines
|
||||
reference/mobile
|
||||
reference/iot
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
.. _reference/cmdline:
|
||||
|
||||
================================
|
||||
===================================
|
||||
Command-line interface: flectra-bin
|
||||
================================
|
||||
===================================
|
||||
|
||||
.. _reference/cmdline/server:
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
.. _reference/guidelines:
|
||||
|
||||
===============
|
||||
==================
|
||||
Flectra Guidelines
|
||||
===============
|
||||
==================
|
||||
|
||||
This page introduces the Flectra Coding Guidelines. Those aim to improve the
|
||||
quality of Flectra Apps code. Indeed proper code improves readability, eases
|
||||
@@ -585,7 +585,7 @@ So, you can write ``if some_collection:`` instead of ``if len(some_collection):`
|
||||
(a little bit outdated, but quite relevant)
|
||||
|
||||
Programming in Flectra
|
||||
-------------------
|
||||
----------------------
|
||||
|
||||
- Avoid to create generators and decorators: only use the ones provided by
|
||||
the Flectra API.
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
:banner: banners/mobile.jpg
|
||||
:types: api
|
||||
|
||||
.. _reference/mobile:
|
||||
|
||||
==================
|
||||
Mobile JavaScript
|
||||
==================
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
In Flectra 10.0 we released a mobile app which allows you to access all **Flectra apps**
|
||||
(even your customized modules).
|
||||
|
||||
The application is a combination of **Flectra Web** and **Native Mobile
|
||||
components**. In other words it is a Flectra Web instance loaded inside a native, mobile, WebView container.
|
||||
|
||||
This page documents how you can access mobile native components like Camera,
|
||||
Vibration, Notification and Toast through Flectra Web (via JavaScript). For this, you
|
||||
do not need to be a mobile developer, if you know Flectra JavaScript API you can
|
||||
access all available mobile features.
|
||||
|
||||
.. warning:: These features work with **Flectra Enterprise 10.0+** only
|
||||
|
||||
How does it work?
|
||||
=================
|
||||
|
||||
Internal workings of the mobile application:
|
||||
|
||||
.. image:: images/mobile_working.jpg
|
||||
|
||||
Of course, it is a web page that loads on a Mobile Native Web container. But it
|
||||
is integrated in such a way that you can access native resources from your web
|
||||
JavaScript.
|
||||
|
||||
WebPages (Flectra Web) is on the top of each layer, where the second layer is a Bridge
|
||||
between Flectra Web (JS) and the native mobile components.
|
||||
|
||||
When any call from JavaScript is triggered it passes through Bridge and Bridge
|
||||
passes it to the native invoker to perform that action.
|
||||
|
||||
When the native component has done its work, it is passed to the Bridge again and
|
||||
you get the output in JavaScript.
|
||||
|
||||
Process time taken by the Native component depends on what you are requesting
|
||||
from the Native resources. For example the Camera or GPS Location.
|
||||
|
||||
How to use it?
|
||||
==============
|
||||
|
||||
Just like the Flectra Web Framework, the Mobile API can be used anywhere by getting the object from
|
||||
**web_mobile.rpc**
|
||||
|
||||
.. image:: images/flectra_mobile_api.png
|
||||
|
||||
The mobile RPC object provides a list of methods that are available (this only works with the mobile
|
||||
app).
|
||||
|
||||
Check if the method is available and then execute it.
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. note:: Each of the methods returns a JQuery Deffered object which returns
|
||||
a data JSON dictionary
|
||||
|
||||
Show Toast in device
|
||||
.....................
|
||||
|
||||
.. js:function:: showToast
|
||||
|
||||
:param object args: **message** text to display
|
||||
|
||||
A toast provides simple feedback about an operation in a small popup. It only
|
||||
fills the amount of space required for the message and the current activity
|
||||
remains visible and interactive.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.methods.showToast({'message': 'Message sent'});
|
||||
|
||||
.. image:: images/toast.png
|
||||
|
||||
|
||||
Vibrating device
|
||||
................
|
||||
|
||||
|
||||
.. js:function:: vibrate
|
||||
|
||||
:param object args: Vibrates constantly for the specified period of time
|
||||
(in milliseconds).
|
||||
|
||||
Vibrate mobile device with given duration.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.methods.vibrate({'duration': 100});
|
||||
|
||||
Show snackbar with action
|
||||
.........................
|
||||
|
||||
.. js:function:: showSnackBar
|
||||
|
||||
:param object args: (*required*) **Message** to show in snackbar and action **button label** in Snackbar (optional)
|
||||
:returns: ``True`` if the user clicks on the Action button, ``False`` if SnackBar auto dismissed after some time.
|
||||
|
||||
Snackbars provide lightweight feedback about an operation. They show a brief
|
||||
message at the bottom of the screen on mobile or in the lower left corner on larger devices.
|
||||
Snackbars appear above all the other elements on the screen and only one can be
|
||||
displayed at a time.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.methods.showSnackBar({'message': 'Message is deleted', 'btn_text': 'Undo'}).then(function(result){
|
||||
if(result){
|
||||
// Do undo operation
|
||||
}else{
|
||||
// Snack Bar dismissed
|
||||
}
|
||||
});
|
||||
|
||||
.. image:: images/snackbar.png
|
||||
|
||||
Showing notification
|
||||
.....................
|
||||
|
||||
.. js:function:: showNotification
|
||||
|
||||
:param object args: **title** (first row) of the notification, **message** (second row) of the notification, in a standard notification.
|
||||
|
||||
A notification is a message you can display to the user outside of your
|
||||
application's normal UI. When you tell the system to issue a notification, it
|
||||
first appears as an icon in the notification area. To see the details of the
|
||||
notification, the user opens the notification drawer. Both the notification
|
||||
area and the notification drawer are system-controlled areas that the user can
|
||||
view at any time.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.showNotification({'title': 'Simple Notification', 'message': 'This is a test for a simple notification'})
|
||||
|
||||
.. image:: images/mobile_notification.png
|
||||
|
||||
|
||||
Create contact in device
|
||||
.........................
|
||||
|
||||
.. js:function:: addContact
|
||||
|
||||
:param object args: Dictionary with contact details. Possible keys (name, mobile, phone, fax, email, website, street, street2, country_id, state_id, city, zip, parent_id, function and image)
|
||||
|
||||
Create a new device contact with the given contact details.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var contact = {
|
||||
'name': 'Michel Fletcher',
|
||||
'mobile': '9999999999',
|
||||
'phone': '7954856587',
|
||||
'fax': '765898745',
|
||||
'email': 'michel.fletcher@agrolait.example.com',
|
||||
'website': 'http://www.agrolait.com',
|
||||
'street': '69 rue de Namur',
|
||||
'street2': false,
|
||||
'country_id': [21, 'Belgium'],
|
||||
'state_id': false,
|
||||
'city': 'Wavre',
|
||||
'zip': '1300',
|
||||
'parent_id': [8, 'Agrolait'],
|
||||
'function': 'Analyst',
|
||||
'image': '<<BASE 64 Image Data>>'
|
||||
}
|
||||
|
||||
mobile.methods.addContact(contact);
|
||||
|
||||
.. image:: images/mobile_contact_create.png
|
||||
|
||||
Scanning barcodes
|
||||
..................
|
||||
|
||||
.. js:function:: scanBarcode
|
||||
|
||||
:returns: Scanned ``code`` from any barcode
|
||||
|
||||
The barcode API detects barcodes in real-time, on the device, in any orientation.
|
||||
|
||||
The barcode API can read the following barcode formats:
|
||||
|
||||
* 1D barcodes: EAN-13, EAN-8, UPC-A, UPC-E, Code-39, Code-93, Code-128, ITF, Codabar
|
||||
* 2D barcodes: QR Code, Data Matrix, PDF-417, AZTEC
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.methods.scanBarcode().then(function(code){
|
||||
if(code){
|
||||
// Perform operation with the scanned code
|
||||
}
|
||||
});
|
||||
|
||||
Switching account in device
|
||||
...........................
|
||||
|
||||
.. js:function:: switchAccount
|
||||
|
||||
Use switchAccount to switch from one account to another on the device.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
mobile.methods.switchAccount();
|
||||
|
||||
.. image:: images/mobile_switch_account.png
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
.. _reference/security:
|
||||
|
||||
================
|
||||
===================
|
||||
Security in Flectra
|
||||
================
|
||||
===================
|
||||
|
||||
Aside from manually managing access using custom code, Flectra provides two main
|
||||
data-driven mechanisms to manage or restrict access to data.
|
||||
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 67 KiB |
@@ -11,5 +11,4 @@ Setting Up
|
||||
setup/deploy
|
||||
setup/update
|
||||
setup/cdn
|
||||
setup/enterprise
|
||||
setup/email_gateway
|
||||
|
||||
@@ -35,7 +35,7 @@ Once done, you'll have to wait a bit while KeyCDN_ is crawling your website.
|
||||
``http://pulltest-b49.kxcdn.com``
|
||||
|
||||
Step 2: Configure the flectra instance with your zone
|
||||
--------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
|
||||
In the Flectra back end, go to the :guilabel:`Website Settings`: menu, then
|
||||
activate the CDN support and copy/paste your zone URL in the
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
:banner: banners/deploying_flectra.jpg
|
||||
|
||||
==============
|
||||
Deploying Flectra, Flectra
|
||||
==============
|
||||
=================
|
||||
Deploying Flectra
|
||||
=================
|
||||
|
||||
This document describes basic steps to set up Flectra, Flectra in production or on an
|
||||
internet-facing server. It follows :ref:`installation <setup/install>`, and is
|
||||
@@ -119,7 +119,7 @@ in ``/etc/postgresql/9.5/main/postgresql.conf`` set:
|
||||
.. _setup/deploy/flectra:
|
||||
|
||||
Configuring Flectra, Flectra
|
||||
----------------
|
||||
----------------------------
|
||||
|
||||
Out of the box, Flectra, Flectra connects to a local postgres over UNIX socket via port
|
||||
5432. This can be overridden using :ref:`the database options
|
||||
@@ -168,7 +168,7 @@ in ``/etc/flectra.conf`` set:
|
||||
.. _postgresql_ssl_connect:
|
||||
|
||||
SSL Between Flectra, Flectra and PostgreSQL
|
||||
-------------------------------
|
||||
-------------------------------------------
|
||||
|
||||
Since Flectra, Flectra 11.0, you can enforce ssl connection between Flectra, Flectra and PostgreSQL.
|
||||
in Flectra, Flectra the db_sslmode control the ssl security of the connection
|
||||
@@ -347,7 +347,7 @@ in ``/etc/nginx/sites-enabled/flectra.conf`` set:
|
||||
}
|
||||
|
||||
Flectra, Flectra as a WSGI Application
|
||||
==========================
|
||||
======================================
|
||||
|
||||
It is also possible to mount Flectra, Flectra as a standard WSGI_ application. Flectra, Flectra
|
||||
provides the base for a WSGI launcher script as ``flectra-wsgi.example.py``. That
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
:banner: banners/email_gateway.jpg
|
||||
|
||||
==================
|
||||
=====================
|
||||
Flectra email gateway
|
||||
==================
|
||||
=====================
|
||||
|
||||
The Flectra mail gateway allows you to inject directly all the received emails in Flectra.
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
:banner: banners/enterprise.jpg
|
||||
|
||||
.. _setup/enterprise:
|
||||
|
||||
============================
|
||||
From Community to Enterprise
|
||||
============================
|
||||
|
||||
Depending on your current installation, there are multiple ways to upgrade
|
||||
your community version.
|
||||
In any case the basic guidelines are:
|
||||
|
||||
* Backup your community database
|
||||
|
||||
.. image:: enterprise/db_manager.png
|
||||
:class: img-responsive
|
||||
|
||||
* Shutdown your server
|
||||
|
||||
* Install the web_enterprise module
|
||||
|
||||
* Restart your server
|
||||
|
||||
* Enter your Flectra Enterprise Subscription code
|
||||
|
||||
.. image:: enterprise/enterprise_code.png
|
||||
:class: img-responsive
|
||||
|
||||
On Linux, using an installer
|
||||
============================
|
||||
|
||||
* Backup your community database
|
||||
|
||||
* Stop the flectra service
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo service flectra stop
|
||||
|
||||
* Install the enterprise .deb (it should install over the community package)
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo dpkg -i <path_to_enterprise_deb>
|
||||
|
||||
* Update your database to the enterprise packages using
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ python3 /usr/bin/flectra-bin -d <database_name> -i web_enterprise --stop-after-init
|
||||
|
||||
* You should be able to connect to your Flectra Enterprise instance using your usual mean of identification.
|
||||
You can then link your database with your Flectra Enterprise Subscription by entering the code you received
|
||||
by e-mail in the form input
|
||||
|
||||
|
||||
On Linux, using the source code
|
||||
===============================
|
||||
|
||||
There are many ways to launch your server when using sources, and you probably
|
||||
have your own favourite. You may need to adapt sections to your usual workflow.
|
||||
|
||||
* Shutdown your server
|
||||
* Backup your community database
|
||||
* Update the ``--addons-path`` parameter of your launch command (see :ref:`setup/install/source`)
|
||||
* Install the web_enterprise module by using
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ -d <database_name> -i web_enterprise --stop-after-init
|
||||
|
||||
Depending on the size of your database, this may take some time.
|
||||
|
||||
* Restart your server with the updated addons path of point 3.
|
||||
You should be able to connect to your instance. You can then link your database with your
|
||||
Flectra Enterprise Subscription by entering the code you received by e-mail in the form input
|
||||
|
||||
On Windows
|
||||
==========
|
||||
|
||||
* Backup your community database
|
||||
|
||||
* Uninstall Flectra Community (using the Uninstall executable in the installation folder) -
|
||||
PostgreSQL will remain installed
|
||||
|
||||
.. image:: enterprise/windows_uninstall.png
|
||||
:class: img-responsive
|
||||
|
||||
* Launch the Flectra Enterprise Installer and follow the steps normally. When choosing
|
||||
the installation path, you can set the folder of the Community installation
|
||||
(this folder still contains the PostgreSQL installation).
|
||||
Uncheck ``Start Flectra`` at the end of the installation
|
||||
|
||||
.. image:: enterprise/windows_setup.png
|
||||
:class: img-responsive
|
||||
|
||||
* Using a command window, update your Flectra Database using this command (from the Flectra
|
||||
installation path, in the server subfolder)
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ flectra.exe -d <database_name> -i web_enterprise --stop-after-init
|
||||
|
||||
* No need to manually launch the server, the service is running.
|
||||
You should be able to connect to your Flectra Enterprise instance using your usual
|
||||
mean of identification. You can then link your database with your Flectra Enterprise
|
||||
Subscription by entering the code you received by e-mail in the form input
|
||||
|
Before Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 27 KiB |
@@ -3,9 +3,9 @@
|
||||
|
||||
.. _setup/install:
|
||||
|
||||
===============
|
||||
==================
|
||||
Installing Flectra
|
||||
===============
|
||||
==================
|
||||
|
||||
There are multiple ways to install Flectra, or not install it at all, depending
|
||||
on the intended use case.
|
||||
@@ -31,17 +31,6 @@ This documents attempts to describe most of the installation options.
|
||||
|
||||
.. _setup/install/editions:
|
||||
|
||||
Editions
|
||||
========
|
||||
|
||||
There are two different Editions_ of Flectra: the Community and Enterprise versions.
|
||||
Using the Enterprise version is possible on our SaaS_ and accessing the code is
|
||||
restricted to Enterprise customers and partners. The Community version is freely
|
||||
available to anyone.
|
||||
|
||||
If you already use the Community version and wish to upgrade to Enterprise, please
|
||||
refer to :ref:`setup/enterprise` (except for :ref:`setup/install/source`).
|
||||
|
||||
|
||||
.. _setup/install/online:
|
||||
|
||||
@@ -78,7 +67,7 @@ Packaged installers
|
||||
|
||||
Flectra provides packaged installers for Windows, deb-based distributions
|
||||
(Debian, Ubuntu, …) and RPM-based distributions (Fedora, CentOS, RHEL, …) for
|
||||
both the Community and Enterprise versions.
|
||||
the Community versions.
|
||||
|
||||
These packages automatically set up all dependencies (for the Community version),
|
||||
but may be difficult to keep up-to-date.
|
||||
@@ -385,7 +374,7 @@ needed:
|
||||
(typically: `C:\\Users\\<user>\\AppData\\Roaming\\npm\\`).
|
||||
|
||||
Running Flectra
|
||||
''''''''''''
|
||||
'''''''''''''''
|
||||
|
||||
Once all dependencies are set up, Flectra can be launched by running `flectra-bin`, the
|
||||
command-line interface of the server. It is located at the root of the Flectra Community directory.
|
||||
@@ -553,7 +542,7 @@ needed:
|
||||
$ sudo npm install -g rtlcss
|
||||
|
||||
Running Flectra
|
||||
''''''''''''
|
||||
'''''''''''''''
|
||||
|
||||
Once all dependencies are set up, Flectra can be launched by running `flectra-bin`, the
|
||||
command-line interface of the server. It is located at the root of the Flectra Community directory.
|
||||
@@ -715,7 +704,7 @@ needed:
|
||||
$ sudo npm install -g rtlcss
|
||||
|
||||
Running Flectra
|
||||
''''''''''''
|
||||
'''''''''''''''
|
||||
|
||||
Once all dependencies are set up, Flectra can be launched by running `flectra-bin`, the
|
||||
command-line interface of the server. It is located at the root of the Flectra Community directory.
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
.. _setup/update:
|
||||
|
||||
=============================
|
||||
================================
|
||||
Updating an Flectra installation
|
||||
=============================
|
||||
================================
|
||||
|
||||
Introduction
|
||||
============
|
||||
@@ -62,7 +62,7 @@ because the procedure is very similar.
|
||||
|
||||
|
||||
Step 1: Download an updated Flectra version
|
||||
========================================
|
||||
===========================================
|
||||
|
||||
The central download page is https://flectrahq.com/download. If you see a "Buy" link for the
|
||||
Flectra Enterprise download, make sure you are logged into flectrahq.com with the same login that is
|
||||
|
||||
@@ -9,7 +9,6 @@ Web Services
|
||||
:titlesonly:
|
||||
|
||||
webservices/flectra
|
||||
webservices/iap
|
||||
webservices/upgrade
|
||||
webservices/localization
|
||||
webservices/extract_api
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
:code-column:
|
||||
|
||||
===============
|
||||
===========
|
||||
Extract API
|
||||
===============
|
||||
===========
|
||||
|
||||
Flectra provides a service allowing you to automate the processing of your invoices. The service scans your document using an Optical
|
||||
Character Recognition (OCR) engine and then uses AI-based algorithms to extract the fields of interest such as the total, the due date, or
|
||||
the invoice lines. More functional information can be found on the `demo page <https://flectrahq.com/invoice-automation>`_.
|
||||
|
||||
This service is a paid service. Each invoice processing will cost you one credit. Three different sized packs can be bought on `iap.flectrahq.com <https://iap.flectrahq.com/iap/in-app-services/259?sortby=date>`_.
|
||||
This service is a paid service. Each invoice processing will cost you one credit. Three different sized packs can be bought on `iap.flectrahq.com <https://flectrahq.com/iap/in-app-services/259?sortby=date>`_.
|
||||
|
||||
You can either use this service directly in the Flectra Accounting App or through the API. The Extract API which is detailed in the next section
|
||||
allows you to integrate our service directly into your own projects.
|
||||
|
||||
@@ -193,7 +193,7 @@ a new key and update all the places where you used the old one.
|
||||
demo
|
||||
''''
|
||||
|
||||
To make exploration simpler, you can also ask https://demo.flectrahq.com for a test
|
||||
To make exploration simpler, you can also ask https://demo.f2.flectrahq.org for a test
|
||||
database:
|
||||
|
||||
.. rst-class:: setup doc-aside
|
||||
@@ -203,14 +203,14 @@ database:
|
||||
.. code-block:: python3
|
||||
|
||||
import xmlrpc.client
|
||||
info = xmlrpc.client.ServerProxy('https://demo.flectrahq.com/start').start()
|
||||
info = xmlrpc.client.ServerProxy('https://demo.f2.flectrahq.org/start').start()
|
||||
url, db, username, password = \
|
||||
info['host'], info['database'], info['user'], info['password']
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
require "xmlrpc/client"
|
||||
info = XMLRPC::Client.new2('https://demo.flectrahq.com/start').call('start')
|
||||
info = XMLRPC::Client.new2('https://demo.f2.flectrahq.org/start').call('start')
|
||||
url, db, username, password = \
|
||||
info['host'], info['database'], info['user'], info['password']
|
||||
|
||||
@@ -219,7 +219,7 @@ database:
|
||||
.. code-block:: php
|
||||
|
||||
require_once('ripcord.php');
|
||||
$info = ripcord::client('https://demo.flectrahq.com/start')->start();
|
||||
$info = ripcord::client('https://demo.f2.flectrahq.org/start')->start();
|
||||
list($url, $db, $username, $password) =
|
||||
array($info['host'], $info['database'], $info['user'], $info['password']);
|
||||
|
||||
@@ -243,7 +243,7 @@ database:
|
||||
final XmlRpcClient client = new XmlRpcClient();
|
||||
|
||||
final XmlRpcClientConfigImpl start_config = new XmlRpcClientConfigImpl();
|
||||
start_config.setServerURL(new URL("https://demo.flectrahq.com/start"));
|
||||
start_config.setServerURL(new URL("https://demo.f2.flectrahq.org/start"));
|
||||
final Map<String, String> info = (Map<String, String>)client.execute(
|
||||
start_config, "start", emptyList());
|
||||
|
||||
|
||||
@@ -1,770 +0,0 @@
|
||||
:banner: banners/iap.jpg
|
||||
:types: api
|
||||
|
||||
.. _webservices/iap:
|
||||
|
||||
.. using sphinx-patchqueue:
|
||||
* the "queue" directive selects a *series* file which lists the patches in
|
||||
the patch queue, in order of application (from top to bottom). The
|
||||
corresponding patch files should be in the same directory.
|
||||
* the "patch" directive steps to the next patch in the queue, applies it
|
||||
and reifies its content (depending on the extension's configuration, by
|
||||
default it shows the changed files post-diff application, slicing to
|
||||
only display sections affecte by the file)
|
||||
|
||||
.. while it's technically possible to apply and update patches by hand, it's
|
||||
finnicky work and easy to break.
|
||||
|
||||
.. the easiest way is to install quilt (http://savannah.nongnu.org/projects/quilt),
|
||||
go to the directory where you want to reify the addon, then create a
|
||||
"patches" symlink to the patches directory (the iap/ folder next to this
|
||||
file) or set QUILT_PATCHES to that folder.
|
||||
|
||||
.. at that point you have a "primed" queue with no patch applied, and you can
|
||||
move within the queue with "quilt push" and "quilt pop".
|
||||
* "quilt new" creates a new empty patch at the top of the stack
|
||||
* "quilt add" tells quilt to start tracking the file, quilt add *works per
|
||||
patch*, it must be called *every time you want to alter a file within a
|
||||
patch*: quilt is not a full VCS (since it's intended to sit on top of
|
||||
an existing source) and does not do permanent tracking of files
|
||||
* "quilt edit" is a shorthand to "quilt add" then open the file in your
|
||||
editor, I suggest you use that rather than open the edited module
|
||||
normally, it avoids forgetting to "quilt add" before doing your
|
||||
modifications (at which point your modifications are untracked,
|
||||
invisible and depending on your editor may be a PITA to revert & redo)
|
||||
* "quilt refresh" updates the current patch to include pending changes
|
||||
|
||||
.. see "man quilt" for the rest of the subcommands. FWIW I could not get
|
||||
"quilt setup" to do anything useful.
|
||||
|
||||
===============
|
||||
In-App Purchase
|
||||
===============
|
||||
|
||||
In-App Purchase (IAP) allows providers of ongoing services through Flectra apps to
|
||||
be compensated for ongoing service use rather than — and possibly instead of
|
||||
— a sole initial purchase.
|
||||
|
||||
In that context, Flectra acts mostly as a *broker* between a client and an Flectra
|
||||
App Developer:
|
||||
|
||||
* Users purchase service tokens from Flectra.
|
||||
* Service providers draw tokens from the user's Flectra account when service
|
||||
is requested.
|
||||
|
||||
.. attention::
|
||||
|
||||
This document is intended for *service providers* and presents the latter,
|
||||
which can be done either via direct JSON-RPC2_ or if you are using Flectra
|
||||
using the convenience helpers it provides.
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
.. figure:: images/players.png
|
||||
:align: center
|
||||
|
||||
The Players
|
||||
|
||||
* The Service Provider is (probably) you the reader, you will be providing
|
||||
value to the client in the form of a service paid per-use.
|
||||
* The Client installed your Flectra App, and from there will request services.
|
||||
* Flectra brokers crediting, the Client adds credit to their account, and you
|
||||
can draw credits from there to provide services.
|
||||
* The External Service is an optional player: *you* can either provide a
|
||||
service directly, or you can delegate the actual service acting as a
|
||||
bridge/translator between an Flectra system and the actual service.
|
||||
|
||||
|
||||
.. figure:: images/credits.jpg
|
||||
:align: center
|
||||
|
||||
The Credits
|
||||
|
||||
.. note:: The credits went from integer to float value starting **October 2018**.
|
||||
Integer values are still supported.
|
||||
|
||||
Every service provided through the IAP platform can be used by the
|
||||
clients with tokens or *credits*. The credits are an float unit and
|
||||
their monetary value depends on the service and is decided by the
|
||||
provider. This could be:
|
||||
|
||||
* for an sms service: 1 credit = 1 sms;
|
||||
* for an ad service: 1 credit = 1 ad; or
|
||||
* for a postage service: 1 credit = 1 post stamp.
|
||||
|
||||
A credit can also simply be associated with a fixed amount of money
|
||||
to palliate the variations of price (e.g. the prices of sms and stamps
|
||||
may vary following the countries).
|
||||
|
||||
The value of the credits is fixed with the help of prepaid credit packs
|
||||
that the clients can buy on https://iap.flectrahq.com (see :ref:`Packs <iap-packages>`).
|
||||
|
||||
.. note:: In the following explanations we will ignore the External Service,
|
||||
they are just a detail of the service you provide.
|
||||
|
||||
.. figure:: images/normal.png
|
||||
:align: center
|
||||
|
||||
'Normal' service flow
|
||||
|
||||
If everything goes well, the normal flow is the following:
|
||||
|
||||
1. The Client requests a service of some sort.
|
||||
2. The Service Provider asks Flectra if there are enough credits for the
|
||||
service in the Client's account, and creates a transaction over that
|
||||
amount.
|
||||
3. The Service Provider provides the service (either on their own or
|
||||
calling to External Services).
|
||||
4. The Service Provider goes back to Flectra to capture (if the service could
|
||||
be provided) or cancel (if the service could not be provided) the
|
||||
transaction created at step 2.
|
||||
5. Finally, the Service Provider notifies the Client that the service has
|
||||
been rendered, possibly (depending on the service) displaying or
|
||||
storing its results in the client's system.
|
||||
|
||||
.. figure:: images/no-credit.png
|
||||
:align: center
|
||||
|
||||
Insufficient credits
|
||||
|
||||
However, if the Client's account lacks credits for the service, the flow will be as follows:
|
||||
|
||||
1. The Client requests a service as previously.
|
||||
2. The Service Provider asks Flectra if there are enough credits on the
|
||||
Client's account and gets a negative reply.
|
||||
3. This is signaled back to the Client.
|
||||
4. Who is redirected to their Flectra account to credit it and re-try.
|
||||
|
||||
|
||||
Building your service
|
||||
=====================
|
||||
|
||||
For this example, the service we will provide is ~~mining dogecoins~~ burning
|
||||
10 seconds of CPU for a credit. For your own services, you could, for example:
|
||||
|
||||
* provide an online service yourself (e.g. convert quotations to faxes for
|
||||
business in Japan);
|
||||
* provide an *offline* service yourself (e.g. provide accountancy service); or
|
||||
* act as intermediary to an other service provider (e.g. bridge to an MMS
|
||||
gateway).
|
||||
|
||||
.. _register-service:
|
||||
|
||||
Register the service on Flectra
|
||||
-------------------------------
|
||||
|
||||
.. queue:: iap_service/series
|
||||
|
||||
.. todo:: complete this part with screenshots
|
||||
|
||||
The first step is to register your service on the IAP endpoint (production
|
||||
and/or test) before you can actually query user accounts. To create a service,
|
||||
go to your *Portal Account* on the IAP endpoint (https://iap.flectrahq.com for
|
||||
production, https://iap-sandbox.flectrahq.com for testing, the endpoints are
|
||||
*independent* and *not synchronized*). Alternatively, you can go to your portal
|
||||
on Flectra (https://iap.flectrahq.com/my/home) and select *In-App Services*.
|
||||
|
||||
.. note::
|
||||
|
||||
On production, there is a manual validation step before the service
|
||||
can be used to manage real transactions. This step is automatically passed when
|
||||
on sandbox to ease the tests.
|
||||
|
||||
Log in then go to :menuselection:`My Account --> Your In-App Services`, click
|
||||
Create and provide the informations of your service.
|
||||
|
||||
|
||||
The service has *seven* important fields:
|
||||
|
||||
* :samp:`name` - :class:`ServiceName`: This is the string you will need to provide inside
|
||||
the client's :ref:`app <iap-flectra-app>` when requesting a transaction from Flectra. (e.g.
|
||||
:class:`self.env['iap.account].get(name)`). As good practice, this should match the
|
||||
technical name of your app.
|
||||
|
||||
* :samp:`label` - :class:`Label`: The name displayed on the shopping portal for the
|
||||
client.
|
||||
|
||||
|
||||
.. warning::
|
||||
Both the :class:`ServiceName` and :class:`Label` are unique. As good practice, the
|
||||
:class:`ServiceName` should usually match the name of your Flectra Client App.
|
||||
|
||||
* :samp:`icon` - :class:`Icon`: A generic icon that will serve as default for your
|
||||
:ref:`packs <iap-packages>`.
|
||||
|
||||
* :samp:`key` - :class:`ServiceKey`: The developer key that identifies you in
|
||||
IAP (see :ref:`your service <iap-service>`) and allows to draw credits from
|
||||
the client's account. It will be shown only once upon creation of the service
|
||||
and can be regenerated at will.
|
||||
|
||||
.. danger::
|
||||
Your :class:`ServiceKey` *is a secret*, leaking your service key
|
||||
allows other application developers to draw credits bought for
|
||||
your service(s).
|
||||
|
||||
* :samp:`trial credits` - :class:`Float`: This corresponds to the credits you are ready to offer
|
||||
upon first use to your app users. Note that such service will only be available to clients that
|
||||
have an active enterprise contract.
|
||||
|
||||
* :samp:`privacy policy` - :class:`PrivacyPolicy`: This is an url to the privacy
|
||||
policy of your service. This should explicitly mention the **information you collect**,
|
||||
how you **use it, its relevance** to make your service work and inform the
|
||||
client on how they can **access, update or delete their personal information**.
|
||||
|
||||
.. image:: images/menu.png
|
||||
:align: center
|
||||
|
||||
.. image:: images/service_list.png
|
||||
:align: center
|
||||
|
||||
.. image:: images/creating_service.png
|
||||
:align: center
|
||||
|
||||
.. image:: images/service_created.png
|
||||
:align: center
|
||||
|
||||
You can then create *credit packs* which clients can purchase in order to
|
||||
use your service.
|
||||
|
||||
.. _iap-packages:
|
||||
|
||||
Packs
|
||||
-----
|
||||
|
||||
A credit pack is essentially a product with five characteristics:
|
||||
|
||||
* Name: name of the pack,
|
||||
* Icon: specific icon for the pack (if not provided, it will fallback on the service icon),
|
||||
* Description: details on the pack that will appear on the shop page as
|
||||
well as the invoice,
|
||||
* Amount: amount of credits the client is entitled to when buying the pack,
|
||||
* Price: price in EUR (for the time being, USD support is planned).
|
||||
|
||||
.. note::
|
||||
|
||||
Flectra takes a 25% commission on all pack sales. Adjust your selling price accordingly.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Depending on the strategy, the price per credit may vary from one
|
||||
pack to another.
|
||||
|
||||
|
||||
.. image:: images/package.png
|
||||
:align: center
|
||||
|
||||
.. _iap-flectra-app:
|
||||
|
||||
Flectra App
|
||||
-----------
|
||||
|
||||
.. queue:: iap/series
|
||||
|
||||
.. todo:: does this actually require apps?
|
||||
|
||||
The second step is to develop an `Flectra App`_ which clients can install in their
|
||||
Flectra instance and through which they can *request* the services you provide.
|
||||
Our app will just add a button to the Partners form which lets a user request
|
||||
burning some CPU time on the server.
|
||||
|
||||
First, we will create an *flectra module* depending on ``iap``. IAP is a standard
|
||||
V11 module and the dependency ensures a local account is properly set up and
|
||||
we will have access to some necessary views and useful helpers.
|
||||
|
||||
.. patch::
|
||||
|
||||
Second, the "local" side of the integration. Here we will only be adding an
|
||||
action button to the partners view, but you can of course provide significant
|
||||
local value via your application and additional parts via a remote service.
|
||||
|
||||
.. patch::
|
||||
|
||||
.. image:: images/button.png
|
||||
:align: center
|
||||
|
||||
We can now implement the action method/callback. This will *call our own
|
||||
server*.
|
||||
|
||||
There are no requirements when it comes to the server or the communication
|
||||
protocol between the app and our server, but ``iap`` provides a
|
||||
:func:`~flectra.addons.iap.tools.iap_tools.iap_jsonrpc` helper to call a JSON-RPC2_ endpoint on an
|
||||
other Flectra instance and transparently re-raise relevant Flectra exceptions
|
||||
(:class:`~flectra.addons.iap.tools.iap_tools.InsufficientCreditError`,
|
||||
:class:`flectra.exceptions.AccessError` and :class:`flectra.exceptions.UserError`).
|
||||
|
||||
In that call, we will need to provide:
|
||||
|
||||
* any relevant client parameter (none here),
|
||||
* the :class:`token <UserToken>` of the current client that is provided by
|
||||
the ``iap.account`` model's ``account_token`` field. You can retrieve the
|
||||
account for your service by calling :samp:`env['iap.account'].get({service_name})`
|
||||
where :class:`service_name <ServiceName>` is the name of the service registered
|
||||
on IAP endpoint.
|
||||
|
||||
.. patch::
|
||||
|
||||
.. note::
|
||||
|
||||
``iap`` automatically handles
|
||||
:class:`~flectra.addons.iap.tools.iap_tools.InsufficientCreditError` coming from the action
|
||||
and prompts the user to add credits to their account.
|
||||
|
||||
:func:`~flectra.addons.iap.tools.iap_tools.iap_jsonrpc` takes care of re-raising
|
||||
:class:`~flectra.addons.iap.models.iap.InsufficientCreditError` for you.
|
||||
|
||||
.. danger::
|
||||
|
||||
If you are not using :func:`~flectra.addons.iap.tools.iap_tools.iap_jsonrpc` you *must* be
|
||||
careful to re-raise
|
||||
:class:`~flectra.addons.iap.tools.iap_tools.InsufficientCreditError` in your handler
|
||||
otherwise the user will not be prompted to credit their account, and the
|
||||
next call will fail the same way.
|
||||
|
||||
.. _iap-service:
|
||||
|
||||
Service
|
||||
-------
|
||||
|
||||
.. queue:: iap_service/series
|
||||
|
||||
Though that is not *required*, since ``iap`` provides both a client helper
|
||||
for JSON-RPC2_ calls (:func:`~flectra.addons.iap.tools.iap_tools.iap_jsonrpc`) and a service helper
|
||||
for transactions (:class:`~flectra.addons.iap.tools.iap_tools.iap_charge`) we will also be
|
||||
implementing the service side as an Flectra module:
|
||||
|
||||
.. patch::
|
||||
|
||||
Since the query from the client comes as JSON-RPC2_ we will need the
|
||||
corresponding controller which can call :class:`~flectra.addons.iap.tools.iap_tools.iap_charge` and
|
||||
perform the service within:
|
||||
|
||||
.. patch::
|
||||
|
||||
.. todo:: for the actual IAP will the "portal" page be on flectrahq.com or iap.flectrahq.com?
|
||||
|
||||
.. todo:: "My Account" > "Your InApp Services"?
|
||||
|
||||
|
||||
The :class:`~flectra.addons.iap.tools.iap_tools.iap_charge` helper will:
|
||||
|
||||
1. authorize (create) a transaction with the specified number of credits,
|
||||
if the account does not have enough credits it will raise the relevant
|
||||
error
|
||||
2. execute the body of the ``with`` statement
|
||||
3. if the body of the ``with`` executes successfully, update the price
|
||||
of the transaction if needed
|
||||
4. capture (confirm) the transaction
|
||||
5. otherwise, if an error is raised from the body of the ``with``, cancel the
|
||||
transaction (and release the hold on the credits)
|
||||
|
||||
.. danger::
|
||||
|
||||
By default, :class:`~flectra.addons.iap.tools.iap_tools.iap_charge` contacts the *production*
|
||||
IAP endpoint, https://iap.flectrahq.com. While developing and testing your
|
||||
service you may want to point it towards the *development* IAP endpoint
|
||||
https://iap-sandbox.flectrahq.com.
|
||||
|
||||
To do so, set the ``iap.endpoint`` config parameter in your service
|
||||
Flectra: in debug/developer mode, :menuselection:`Setting --> Technical -->
|
||||
Parameters --> System Parameters`, just define an entry for the key
|
||||
``iap.endpoint`` if none already exists).
|
||||
|
||||
The :class:`~flectra.addons.iap.tools.iap_tools.iap_charge` helper has two additional optional
|
||||
parameters we can use to make things clearer to the end-user.
|
||||
|
||||
``description``
|
||||
is a message which will be associated with the transaction and will be
|
||||
displayed in the user's dashboard, it is useful to remind the user why
|
||||
the charge exists.
|
||||
``credit_template``
|
||||
is the name of a :ref:`reference/qweb` template which will be rendered
|
||||
and shown to the user if their account has less credit available than the
|
||||
service provider is requesting, its purpose is to tell your users why
|
||||
they should be interested in your IAP offers.
|
||||
|
||||
.. patch::
|
||||
|
||||
|
||||
.. TODO:: how do you test your service?
|
||||
|
||||
JSON-RPC2_ Transaction API
|
||||
==========================
|
||||
|
||||
.. image:: images/flow.png
|
||||
:align: center
|
||||
|
||||
* The IAP transaction API does not require using Flectra when implementing your
|
||||
server gateway, calls are standard JSON-RPC2_.
|
||||
* Calls use different *endpoints* but the same *method* on all endpoints
|
||||
(``call``).
|
||||
* Exceptions are returned as JSON-RPC2_ errors, the formal exception name is
|
||||
available on ``data.name`` for programmatic manipulation.
|
||||
|
||||
.. seealso:: `iap.flectrahq.com documentation`_ for additional information.
|
||||
|
||||
Authorize
|
||||
---------
|
||||
|
||||
.. function:: /iap/1/authorize
|
||||
|
||||
Verifies that the user's account has at least as ``credit`` available
|
||||
*and creates a hold (pending transaction) on that amount*.
|
||||
|
||||
Any amount currently on hold by a pending transaction is considered
|
||||
unavailable to further authorize calls.
|
||||
|
||||
Returns a :class:`TransactionToken` identifying the pending transaction
|
||||
which can be used to capture (confirm) or cancel said transaction (`iap.flectrahq.com documentation`_).
|
||||
|
||||
:param ServiceKey key:
|
||||
:param UserToken account_token:
|
||||
:param float credit:
|
||||
:param str description: optional, helps users identify the reason for
|
||||
charges on their account
|
||||
:param str dbuuid: optional, allows the user to benefit from trial
|
||||
credits if his database is eligible (see :ref:`Service registration <register-service>`)
|
||||
:returns: :class:`TransactionToken` if the authorization succeeded
|
||||
:raises: :class:`~flectra.exceptions.AccessError` if the service token is invalid
|
||||
:raises: :class:`~flectra.addons.iap.models.iap.InsufficientCreditError` if the account does not have enough credits
|
||||
:raises: ``TypeError`` if the ``credit`` value is not an integer or a float
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
r = requests.post(ODOO + '/iap/1/authorize', json={
|
||||
'jsonrpc': '2.0',
|
||||
'id': None,
|
||||
'method': 'call',
|
||||
'params': {
|
||||
'account_token': user_account,
|
||||
'key': SERVICE_KEY,
|
||||
'credit': 25,
|
||||
'description': "Why this is being charged",
|
||||
}
|
||||
}).json()
|
||||
if 'error' in r:
|
||||
# handle authorize error
|
||||
tx = r['result']
|
||||
|
||||
# provide your service here
|
||||
|
||||
Capture
|
||||
-------
|
||||
|
||||
.. function:: /iap/1/capture
|
||||
|
||||
Confirms the specified transaction, transferring the reserved credits from
|
||||
the user's account to the service provider's.
|
||||
|
||||
Capture calls are idempotent: performing capture calls on an already
|
||||
captured transaction has no further effect.
|
||||
|
||||
:param TransactionToken token:
|
||||
:param ServiceKey key:
|
||||
:param float credit_to_capture: optional parameter to capture a smaller amount of credits than authorized
|
||||
:raises: :class:`~flectra.exceptions.AccessError`
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 8
|
||||
|
||||
r2 = requests.post(ODOO + '/iap/1/capture', json={
|
||||
'jsonrpc': '2.0',
|
||||
'id': None,
|
||||
'method': 'call',
|
||||
'params': {
|
||||
'token': tx,
|
||||
'key': SERVICE_KEY,
|
||||
'credit_to_capture': credit or False,
|
||||
}
|
||||
}).json()
|
||||
if 'error' in r:
|
||||
# handle capture error
|
||||
# otherwise transaction is captured
|
||||
|
||||
Cancel
|
||||
------
|
||||
|
||||
.. function:: /iap/1/cancel
|
||||
|
||||
Cancels the specified transaction, releasing the hold on the user's
|
||||
credits.
|
||||
|
||||
Cancel calls are idempotent: performing capture calls on an already
|
||||
cancelled transaction has no further effect.
|
||||
|
||||
:param TransactionToken token:
|
||||
:param ServiceKey key:
|
||||
:raises: :class:`~flectra.exceptions.AccessError`
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
r2 = requests.post(ODOO + '/iap/1/cancel', json={
|
||||
'jsonrpc': '2.0',
|
||||
'id': None,
|
||||
'method': 'call',
|
||||
'params': {
|
||||
'token': tx,
|
||||
'key': SERVICE_KEY,
|
||||
}
|
||||
}).json()
|
||||
if 'error' in r:
|
||||
# handle cancel error
|
||||
# otherwise transaction is cancelled
|
||||
|
||||
Types
|
||||
-----
|
||||
|
||||
Exceptions aside, these are *abstract types* used for clarity, you should not
|
||||
care how they are implemented.
|
||||
|
||||
.. class:: ServiceName
|
||||
|
||||
String identifying your service on https://iap.flectrahq.com (production) as well
|
||||
as the account related to your service in the client's database.
|
||||
|
||||
.. class:: ServiceKey
|
||||
|
||||
Identifier generated for the provider's service. Each key (and service)
|
||||
matches a token of a fixed value, as generated by the service provide.
|
||||
|
||||
Multiple types of tokens correspond to multiple services. As an exampe, SMS and MMS
|
||||
could either be the same service (with an MMS being 'worth' multiple SMS)
|
||||
or could be separate services at separate price points.
|
||||
|
||||
.. danger:: Your service key *is a secret*, leaking your service key
|
||||
allows other application developers to draw credits bought for
|
||||
your service(s).
|
||||
|
||||
.. class:: UserToken
|
||||
|
||||
Identifier for a user account.
|
||||
|
||||
.. class:: TransactionToken
|
||||
|
||||
Transaction identifier, returned by the authorization process and consumed
|
||||
by either capturing or cancelling the transaction.
|
||||
|
||||
.. exception:: flectra.addons.iap.tools.iap_tools.InsufficientCreditError
|
||||
|
||||
Raised during transaction authorization if the credits requested are not
|
||||
currently available on the account (either not enough credits or too many
|
||||
pending transactions/existing holds).
|
||||
|
||||
.. exception:: flectra.exceptions.AccessError
|
||||
:noindex:
|
||||
|
||||
Raised by:
|
||||
|
||||
* any operation to which a service token is required, if the service token is invalid; or
|
||||
* any failure in an inter-server call. (typically, in :func:`~flectra.addons.iap.tools.iap_tools.iap_jsonrpc`).
|
||||
|
||||
.. exception:: flectra.exceptions.UserError
|
||||
:noindex:
|
||||
|
||||
Raised by any unexpected behaviour at the discretion of the App developer (*you*).
|
||||
|
||||
|
||||
Test the API
|
||||
------------
|
||||
|
||||
In order to test the developped app, we propose a sandbox platform that allows you to:
|
||||
|
||||
1. Test the whole flow from the client's point of view - Actual services and transactions
|
||||
that can be consulted. (again this requires to change the endpoint, see the danger note
|
||||
in :ref:`Service <iap-service>`).
|
||||
2. Test the API.
|
||||
|
||||
The latter consists in specific tokens that will work on **IAP-Sandbox only**.
|
||||
|
||||
* Token ``000000``: Represents a non-existing account. Returns
|
||||
an :class:`~flectra.addons.iap.tools.iap_tools.InsufficientCreditError` on authorize attempt.
|
||||
* Token ``000111``: Represents an account without sufficient credits to perform any service.
|
||||
Returns an :class:`~flectra.addons.iap.tools.iap_tools.InsufficientCreditError` on authorize attempt.
|
||||
* Token ``111111``: Represents an account with enough credits to perform any service.
|
||||
An authorize attempt will return a dummy transacion token that is processed by the capture
|
||||
and cancel routes.
|
||||
|
||||
.. note::
|
||||
|
||||
* Those tokens are only active on the IAP-Sanbox server.
|
||||
* The service key is completely ignored with this flow, If you want to run a robust test
|
||||
of your service, you should ignore these tokens.
|
||||
|
||||
Flectra Helpers
|
||||
===============
|
||||
|
||||
For convenience, if you are implementing your service using Flectra the ``iap``
|
||||
module provides a few helpers to make IAP flow even simpler.
|
||||
|
||||
.. _iap-charging:
|
||||
|
||||
Charging
|
||||
--------
|
||||
|
||||
.. class:: flectra.addons.iap.tools.iap_tools.iap_charge(env, key, account_token, credit[, dbuuid, description, credit_template])
|
||||
|
||||
A *context manager* for authorizing and automatically capturing or
|
||||
cancelling transactions for use in the backend/proxy.
|
||||
|
||||
Works much like e.g. a cursor context manager:
|
||||
|
||||
* immediately authorizes a transaction with the specified parameters;
|
||||
* executes the ``with`` body;
|
||||
* if the body executes in full without error, captures the transaction;
|
||||
* otherwise cancels it.
|
||||
|
||||
:param flectra.api.Environment env: used to retrieve the ``iap.endpoint``
|
||||
configuration key
|
||||
:param ServiceKey key:
|
||||
:param UserToken token:
|
||||
:param float credit:
|
||||
:param str description:
|
||||
:param Qweb template credit_template:
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 11,13,14,15
|
||||
|
||||
@route('/deathstar/superlaser', type='json')
|
||||
def superlaser(self, user_account,
|
||||
coordinates, target,
|
||||
factor=1.0):
|
||||
"""
|
||||
:param factor: superlaser power factor,
|
||||
0.0 is none, 1.0 is full power
|
||||
"""
|
||||
credits = int(MAXIMUM_POWER * factor)
|
||||
description = "We will demonstrate the power of this station on your home planet of Alderaan."
|
||||
with iap_charge(request.env, SERVICE_KEY, user_account, credits, description) as transaction:
|
||||
# TODO: allow other targets
|
||||
transaction.credit = max(credits, 2)
|
||||
# Sales ongoing one the energy price,
|
||||
# a maximum of 2 credits will be charged/captured.
|
||||
self.env['systems.planets'].search([
|
||||
('grid', '=', 'M-10'),
|
||||
('name', '=', 'Alderaan'),
|
||||
]).unlink()
|
||||
|
||||
|
||||
Authorize
|
||||
---------
|
||||
|
||||
.. class:: flectra.addons.iap.tools.iap_tools.iap_authorize(env, key, account_token, credit[, dbuuid, description, credit_template])
|
||||
|
||||
Will authorize everything.
|
||||
|
||||
:param flectra.api.Environment env: used to retrieve the ``iap.endpoint``
|
||||
configuration key
|
||||
:param ServiceKey key:
|
||||
:param UserToken token:
|
||||
:param float credit:
|
||||
:param str description:
|
||||
:param Qweb template credit_template:
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 12
|
||||
|
||||
@route('/deathstar/superlaser', type='json')
|
||||
def superlaser(self, user_account,
|
||||
coordinates, target,
|
||||
factor=1.0):
|
||||
"""
|
||||
:param factor: superlaser power factor,
|
||||
0.0 is none, 1.0 is full power
|
||||
"""
|
||||
credits = int(MAXIMUM_POWER * factor)
|
||||
description = "We will demonstrate the power of this station on your home planet of Alderaan."
|
||||
#actual IAP stuff
|
||||
transaction_token = authorize(request.env, SERVICE_KEY, user_account, credits, description=description)
|
||||
try:
|
||||
# Beware the power of this laser
|
||||
self.put_galactical_princess_in_sorrow()
|
||||
except Exception as e:
|
||||
# Nevermind ...
|
||||
r = cancel(env,transaction_token, key)
|
||||
raise e
|
||||
else:
|
||||
# We shall rule over the galaxy!
|
||||
capture(env,transaction_token, key, min(credits, 2))
|
||||
|
||||
Cancel
|
||||
------
|
||||
|
||||
.. class:: flectra.addons.iap.tools.iap_tools.iap_cancel(env, transaction_token, key)
|
||||
|
||||
Will cancel an authorized transaction.
|
||||
|
||||
:param flectra.api.Environment env: used to retrieve the ``iap.endpoint``
|
||||
configuration key
|
||||
:param str transaction_token:
|
||||
:param ServiceKey key:
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 16,17,18,19
|
||||
|
||||
@route('/deathstar/superlaser', type='json')
|
||||
def superlaser(self, user_account,
|
||||
coordinates, target,
|
||||
factor=1.0):
|
||||
"""
|
||||
:param factor: superlaser power factor,
|
||||
0.0 is none, 1.0 is full power
|
||||
"""
|
||||
credits = int(MAXIMUM_POWER * factor)
|
||||
description = "We will demonstrate the power of this station on your home planet of Alderaan."
|
||||
#actual IAP stuff
|
||||
transaction_token = authorize(request.env, SERVICE_KEY, user_account, credits, description=description)
|
||||
try:
|
||||
# Beware the power of this laser
|
||||
self.put_galactical_princess_in_sorrow()
|
||||
except Exception as e:
|
||||
# Nevermind ...
|
||||
r = cancel(env,transaction_token, key)
|
||||
raise e
|
||||
else:
|
||||
# We shall rule over the galaxy!
|
||||
capture(env,transaction_token, key, min(credits, 2))
|
||||
|
||||
Capture
|
||||
-------
|
||||
|
||||
.. class:: flectra.addons.iap.tools.iap_tools.iap_capture(env, transaction_token, key, credit)
|
||||
|
||||
Will capture the amount ``credit`` on the given transaction.
|
||||
|
||||
:param flectra.api.Environment env: used to retrieve the ``iap.endpoint``
|
||||
configuration key
|
||||
:param str transaction_token:
|
||||
:param ServiceKey key:
|
||||
:param credit:
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 20,21,22
|
||||
|
||||
@route('/deathstar/superlaser', type='json')
|
||||
def superlaser(self, user_account,
|
||||
coordinates, target,
|
||||
factor=1.0):
|
||||
"""
|
||||
:param factor: superlaser power factor,
|
||||
0.0 is none, 1.0 is full power
|
||||
"""
|
||||
credits = int(MAXIMUM_POWER * factor)
|
||||
description = "We will demonstrate the power of this station on your home planet of Alderaan."
|
||||
#actual IAP stuff
|
||||
transaction_token = authorize(request.env, SERVICE_KEY, user_account, credits, description=description)
|
||||
try:
|
||||
# Beware the power of this laser
|
||||
self.put_galactical_princess_in_sorrow()
|
||||
except Exception as e:
|
||||
# Nevermind ...
|
||||
r = cancel(env,transaction_token, key)
|
||||
raise e
|
||||
else:
|
||||
# We shall rule over the galaxy!
|
||||
capture(env,transaction_token, key, min(credits, 2))
|
||||
|
||||
|
||||
.. _JSON-RPC2: https://www.jsonrpc.org/specification
|
||||
.. _Flectra App: https://www.flectrahq.com/apps
|
||||
.. _iap.flectrahq.com documentation: https://iap.flectrahq.com/iap/1/documentation
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 111 KiB |
@@ -509,7 +509,7 @@ database upgrade request.
|
||||
|
||||
import requests
|
||||
|
||||
PROCESS_URL = "https://upgrade.flectrahq.com/database/v1/status"
|
||||
PROCESS_URL = "https:/upgrade.flectrahq.com/database/v1/status"
|
||||
|
||||
fields = dict([
|
||||
('request', '10534'),
|
||||
|
||||