Bloks

Blok erpblok-core

class erpblok.bloks.erpblok_core.ERPBlokCore(registry)

Bases: anyblok.blok.Blok

Base Blok for ERPBlok

autoinstall = True
conditional_by = []
conflicting_by = []
name = 'erpblok-core'
optional_by = []
required = ['erpblok-web-client', 'anyblok-io-xml']
required_by = ['erpblok-debug', 'erpblok-demo']
update(latest_version)
version = '0.0.1'
views = ['views/access.tmpl']

Blok erpblok-web-client

class erpblok.bloks.erpblok_web_client.ERPBlokWebClient(registry)

Bases: anyblok.blok.Blok

Web Client for ERPBlok

autoinstall = True
client_css = ['#BLOK/static/view.css', '#BLOK/static/view_list.css']
client_js = ['#BLOK/static/underscore-min.js']
client_js_babel = ['#BLOK/static/hashtag-manager.js', '#BLOK/static/error-manager.js', '#BLOK/static/menu.js', '#BLOK/static/breadcrumb.js', '#BLOK/static/action.js', '#BLOK/static/dialog.js', '#BLOK/static/view.js', '#BLOK/static/view_multi_entries.js', '#BLOK/static/view_list.js', '#BLOK/static/view_thumbnails.js', '#BLOK/static/view_form.js', '#BLOK/static/notification/notification.js', '#BLOK/static/client.js', '#BLOK/static/space.js']
client_templates = ['templates.tmpl']
conditional_by = []
conflicting_by = []
database_css = []
database_js = ['#BLOK/static/notification/notification.js']
database_js_babel = ['#BLOK/static/database.js']
database_templates = ['database_templates.tmpl']
global_css = ['#BLOK/static/foundation-6.1.2/css/foundation.min.css', '#BLOK/static/foundation-icons/foundation-icons.css', '#BLOK/static/jquery-ui-1.11.4/jquery-ui.min.css', '#BLOK/static/trumbowyg-2.0.0-beta-7/ui/trumbowyg.min.css', '#BLOK/static/react-datetime.css', '#BLOK/static/erpblok.css', '#BLOK/static/fields.css']
global_js = ['#BLOK/static/react.min.js', '#BLOK/static/react-dom.min.js', '#BLOK/static/babel-core/5.8.34/browser.min.js', '#BLOK/static/jquery-2.1.3.min.js', '#BLOK/static/jquery-ui-1.11.4/jquery-ui.min.js', '#BLOK/static/foundation-6.1.2/js/foundation.min.js', '#BLOK/static/jsviews.min.js', '#BLOK/static/trumbowyg-2.0.0-beta-7/trumbowyg.min.js', '#BLOK/static/moment-with-locales.min.js', '#BLOK/static/moment.min.js', '#BLOK/static/react-datetime.min.js', '#BLOK/static/anyblok-js.js', '#BLOK/static/erpblok.js', '#BLOK/static/rpc.js']
global_js_babel = ['#BLOK/static/template.js', '#BLOK/static/fields.js', '#BLOK/static/modals.js']
classmethod import_declaration_module()
load()
login_css = []
login_js = []
login_js_babel = ['#BLOK/static/url-search-manager.js', '#BLOK/static/login.js']
login_templates = ['login_templates.tmpl']
name = 'erpblok-web-client'
optional_by = []
classmethod pyramid_load_config(config)
classmethod reload_declaration_module(reload)
required = ['anyblok-core', 'anyblok-io']
required_by = ['erpblok-core']
version = '0.0.1'

This blok is required by all ERPBlok application. This blok define the main fonctionnality of the interface and the user notion.

Functional space

The functional space is reprented by: * Menu or not * action(s) with their view(s)

<record external_id="setting_space_user">
    <field name="label">User</field>
    <field name="icon">fi-results-demographics</field>
    <field name="description">Configure the users and access rules</field>
    <field name="category" external_id="setting_space_category" />
    <field name="menus">
        <record external_id="setting_menu_groups">
            <!-- define one menu for the ``Groups`` model -->
            <field name="label">Groups</field>
            <field name="action" external_id="action_group"/>
        </record>
        <record external_id="setting_menu_logins">
            <field name="label">Logins</field>
            <field name="action" external_id="action_login"/>
        </record>
        <record external_id="setting_menu_users">
            <field name="label">Users</field>
            <field name="action" external_id="action_user"/>
        </record>
    </field>
</record>

Action

Is attach at the space or a dialog box. The action can have one or more view(s).

<record external_id="action_group">
    <field name="label">Groups</field>
    <field name="model">Model.Access.Group</field>
    <field name="add_delete">0</field>
    <field name="add_new">0</field>
    <field name="add_edit">0</field>
    <field name="views">
        <record external_id="view_access_group_tree">
            <field name="selectable">1</field>
            <field name="mode">Model.UI.View.List</field>
            <field name="template">ERPBlokAccessGroupList</field>
        </record>
    </field>
</record>

View

Actuality the existing are:

List:

  • Can be modifiable directly in the line or open another type of view
  • Can be multi header
  • On field can be display more than one time.
  • they are some beaviour to help to display UI with some condition
<template id="ERPBlokAccessUserList">
    <field name="first_name" />
    <field name="last_name" />
</template>

Possible attribute:

Attribute description
checkbox Boolean, if the checkbox is displayed or not
inline Boolean, if the data is modified in the same view

Form:

  • Can n be modifiable directly
  • On field can be display more than one time.
  • they are some beaviour to help to display UI with some condition
<template id="ERPBlokAccessWebLoginForm">
    <div class="row">
        <div class="columns small-12 medium-9 large-6">
            <label for="login" />
            <field name="login" />
            <label for="password" />
            <field name="password"/>
        </div>
    </div>
</template>

thumbnail:

  • Can open another type of view
  • On field can be display more than one time.
  • they are some beaviour to help to display UI with some condition
<template id="AnyBlokSystemBlokThumbnails">
    <div class="row">
        <div class="columns">
            <h4><field name="name" class="primary"/></h4>
        </div>
    </div>
    <div class="row">
        <div class="columns large-7 medium-6">
            <field name="logo" type="Picture" file_name_field="name"></field>
            <call template="AnyBlokSystemBlokButton"/>
        </div>
        <div class="columns large-5 medium-6">
            <call template="AnyBlokSystemBlokState"/>
        </div>
    </div>
</template>

helper:

You can use some feature for the definition of the view:

  • call: include another template, do not rewrite more than one time the same template.

Field

Each field represent one column in the database. If a column is put two time, modify one, automaticly modify the 2nd one.

Declaration of one field

<field name="my_anyblok_field"/>

The existing field Type are:

  • String
  • Integer
  • Boolean
  • Float
  • Selection
  • Password
  • Text
  • Html
  • LargeBinary
  • Picture
  • Many2One
  • One2One:
  • Many2ManyChoices

General attributes for all fields:

Attribute description
name Name of the anyblok field to display
type Type of field, by default, it is the AnyBlok field
writable-only-if

take a condition:

<field name="..."
       writable-only-if="fields.field1 != 'foo'"/>
visible-only-if

take a condition:

<field name="..."
       visible-only-if="fields.field1 != 'foo'"/>
not-nullable-only-if

take a condition:

<field name="..."
       not-nullable-only-if="fields.field1" />
placeholder |
selections |
precision |

Attributes for field: LargeBinary

Attribute description
file_name_field Name of the field to use to save the file name
file_size_field Name of the field to use to save the file size
mimetype_field Name of the field to use to save the file mimetype
accept filtering the extension of the file in the upload box

Attributes for field: Many2One

Attribute description
search-box-limit Number max entry in the search select box
search-box-add Boolean to determine if the user can create a new entry
label field of the relationship to use to display

Attributes for field: Many2ManyChoices

Attribute description
largegrid Number entry by line for large screen
mediumgrid Number entry by line for tablette
smallgrid Number entry by line for smartphone
label field of the relationship to use to display

Attributes for field: Text

Attribute description
rows Default rows number to display

Blok erpblok-demo

class erpblok.bloks.erpblok_demo.ERPBlokDemo(registry)

Bases: anyblok.blok.Blok

Demo blok for ERPBlok

conditional_by = []
conflicting_by = []
name = 'erpblok-demo'
optional_by = []
required = ['anyblok-io-xml', 'erpblok-core']
required_by = []
setting_blok_description = {'label': 'Demo datas', 'value': None, 'description': 'Install the demo datas to start with some data in the goal to test ERPBlok'}
update(latest_version)

Update the database

version = '0.0.1'

Blok erpblok-debug

class erpblok.bloks.erpblok_debug.ERPBlokDebug(registry)

Bases: anyblok.blok.Blok

Demo blok for ERPBlok

conditional_by = []
conflicting_by = []
name = 'erpblok-debug'
optional_by = []
required = ['anyblok-io-xml', 'erpblok-core']
required_by = []
uninstall()
update(latest_version)

Update the database

version = '0.0.1'

Blok erpblok-blok-manager

class erpblok.bloks.blok_manager.ERPBlokBlokManager(registry)

Bases: anyblok.blok.Blok

Blok manager for ERPBlok

conditional_by = []
conflicting_by = []
classmethod import_declaration_module()
name = 'erpblok-blok-manager'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['anyblok-core', 'anyblok-io-xml']
required_by = []
setting_blok_description = {'label': 'Blok Manager', 'value': None, 'description': 'Allow to install, update or unstall bloks from the application'}
uninstall()
update(latest_version)

Update the database

version = '0.0.1'
views = ['blok.tmpl']

Add space to manage bloks:

  • Install
  • Upgrade
  • Uninstall

Install this blok

The only way to install this blok are:

  • In the database manager, when the creation of the database
_images/db_manager.png
  • By console script:

    anyblok_updatedb --install-bloks erpblok-blok-manager
    

Views

  • Thumbnails
_images/thumbnails-view.png
  • Form
_images/form-view.png

API doc

Blok

class erpblok.bloks.blok_manager.blok.Blok

Bases: object

convert_path(res)

Change the path of static image

convert_rst2html(rst)

Convert a rst to html

Parameters:rst – rst source
Return type:html souce
get_logo()

Return the logo define in blok description

class MyBlok(Blok):
    logo = 'path/to/the/logo/in/blok'
get_long_description()

Overwrite the description to return a html

get_short_description()

Overwrite the description to return a html

install_blok()

Hight level method to install one blok

logo = <anyblok.field.Function object>
classmethod reload_blokmanager(*args, **kwargs)

Reload all the bloks with their code sources

uninstall_blok()

Hight level method to uninstall one blok

upgrade_blok()

Hight level method to upgrade one blok