006 Guidelines on Module creation The copying, distribution and utilization of this documents as well as the communication of its contents to others without expressed authorization is prohibited. Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of patent, utility model or ornamental design registration. Document Signature Table Name Function Company Signature Date Written by: Mame Coumba Sall Sébatien Robin Thierry Brettnacher Jérôme Perrin Approved by: Released by: Accepted by: Distribution List Document Change Record Issue Date Page Description of the Change Table of Contents 1 Introduction 7 1.1 Purpose and Scope 7 1.2 References 7 1.2.1 Applicable Documents 7 1.2.2 Referenced Documents 7 1.3 Abbreviations and Definitions 8 2 Rules 9 2.1 General Rules 9 2.2 Portal Types 9 2.2.1 Module Portal Types 9 2.2.2 Document Portal Types 12 2.3 Forms 14 2.3.1 General Rules 14 2.3.2 Listbox Rules 18 2.3.3 Module forms (List Mode) 18 2.3.4 Document Forms (Document view mode) 20 2.4 Activities 22 2.5 Workflows 22 2.6 Security 26 2.6.1 Modules 26 2.6.2 Documents 27 3 What are different action categories and how are they used on the front page 28 3.1 Quick Search 28 3.2 Contribute 28 3.3 Browse 29 3.4 New 29 3.5 Dig 29 3.6 Reports 29 3.7 Printouts 30 3.8 Exchange 31 3.9 Express Support 31 4 How to use proxify tool and migrate existing business templates to proxyfields 32 1. Think how to group fields in field libraries 32 2. Create conceptual field libraries 32 3. Use field libraries 33 4. Check the result 33 1 Introduction 1.1 Purpose and Scope The purpose of this document is to define a set of rules to follow when creating a new module. This document covers organisational approach to software development. It does not contain any information to improve technical skills of developers. This document is meant to be read by Nexedi developers and by selected Nexedi partners. This document must not be distributed outside Nexedi without prior explicit permission of Nexedi CEO. 1.2 References The section provides the lists of the applicable and reference. 1.2.1 Applicable Documents ID Title / Reference Doc. No. Issue/Rev. AD-1 DP N/A 1.2.2 Referenced Documents ID Title / Reference Doc. No. Issue/Rev. RD-1 ERP5 Implementation Process ERP5-IMPL Issue 1.0 Rev. 0 RD-2 Guidelines for Naming Convention 1.3 Abbreviations and Definitions The section provides the lists of the applicable abbreviations. ID Abbreviation Title Description AB-1 AB-2 AB-3 AB-4 AB-5 AB-6 AB-7 AB-8 2 Rules This chapter describes the different rules to follow in order to create a module. 2.1 General Rules Rule: Always follow the erp5 naming convention defined here : http://www.erp5.org/GuidelinesForNamingConvention Rationale: All ERP5 developers must follow the ERP5 naming convention which is a list of naming convention guidelines for portal types names, module titles, script titles, form titles, field titles, etc. All script names, portal_types names, form names, field names, workflow state names, etc. should be in “British English” and are translated in other languages with the Localizer tool. 2.2 Portal Types 2.2.1 Module Portal Types Rule: Define portal type ids according to the erp5 naming convention Rationale: The portal types names should follow the erp5 naming convention All portal_types IDs should be defined in “British English” and are translated in other languages with the Localizer tool. Rule: Don't define portal type title Rationale: The portal type titles are not used. Portal Types titles are not used, it's useless to put the same thing as in ID, and it's a mistake to have something different. So it's better to leave them empty. If a portal type define a title, the title have to be removed. Rule: Give a brief description of your module in the Properties Tab of the portal type Rationale: The description is important to explain what the module consists of. You should for example describe what are the documents contained in the module. Rule: Configure title translation to use erp5_ui domain Rationale: Modules titles are part of the UI and shall be translated with erp5_ui getTranslatedTitle method will use Localizer's erp5_ui catalog to translate the title of the module document when displayed in the page templates. Rule: In the Actions Tab, define the actions available on the module Rationale: Only the actions that are really needed on the module should be present. The minimal list of actions is provided below. The minimal list of actions on a module is : View. Those actions should be defined as follows : • View : permission View, category object_list and id view and action string:${object_url}/ModulePortalType_viewDocumentPortalTypeList Other default actions ( Sort, Search, Print, Modify UI, Import, Export and Change State ) are defined as global actions on portal_actions tool, you don't have to include them as portal type actions ( like it was done before). Those actions are now replaced global actions, if they are already present on the portal type, you have to remove them : • Sort : permission View, category object_sort, id sort_on and action string:${object_url}/Folder_viewSortOnDialog • Search : permission View, category object_search, id search and action string:${object_url}/Folder_viewSearchDialog • Modify UI : permission View, category object_ui, id list_ui and action string:${object_url}/Base_viewUIDialog • Print : permission View, category object_print, id print and action string:${object_url}/Base_printPdf • Import Csv File : permission Modify portal content, category object_exchange, id csv_import and action string:${object_url}/Base_importCsvFileForm • Export Csv File : permission View, category object_exchange, id csv_export and action string:${object_url}/Base_exportCsvFileForm • Change Workflow State : permission Add portal content, category object_workflow, id change_workflow_state and action string:${object_url}/Base_changeWorkflowState Rule: If you add actions to the minimal set of actions on a document, their names should be in “British English”. These names should be explicit compared to the action Rationale: The names are displayed to the user in the action menu on the document and is used for translation in other languages Actions names should always be defined from an use case and end user point of view and not from a technical point of view. Rule: If you define “report” actions, they have to be associated to “View” permission and have to be categorised as object_report action. Rationale: A specific fast report button is provided inside the action bar of ERP5 when needed A well configured ERP5 site provides reports for almost all modules. 2.2.2 Document Portal Types Rule: Define portal type ids according to the erp5 naming convention Rationale: The portal types names should follow the erp5 naming convention All portal_types IDs should be defined in “British English” and are translated in other languages with the Localizer tool. Rule: Don't define portal type title Rationale: The portal type titles are not used. Portal Types titles are not used, it's useless to put the same thing as in ID, and it's a mistake to have something different. So it's better to leave them empty. If a portal type define a title, the title have to be removed. Rule: Give a brief description of your document type in the Properties Tab of the portal type Rationale: The description is important to explain what is the purpose of this type of document. You should for example describe what are those documents used for. Rule: Configure title translation to use no translation domain Rationale: For most cases, document's title does not have to be translated. Sometimes in a multilingual environment you may want to translate document's title, in that case you should use erp5_content. Keep in mind that this may add lots of messages in you Message catalog, and cause database size problems. Rule: If you plan to use “fast inputs” to create content types inside the portal type, you have to define these content types as “hidden content types” in the Properties Tab of the portal type. Rationale: If the Use Case Analysis leads to the need of automatic generation methods for content documents using fast inputs, then manual creation of these content documents should not be proposed to the user You should refer to Use cases to know if fast inputs are needed or not. Rule: In the Actions Tab, define the actions available on the document Rationale: Only the actions that are really needed on the document should be present. The minimal list of actions and their order is provided below. The minimal list of actions on a document is : View. Those actions should be defined as follows : • View : permission View, category object_view and id view and action string:${object_url}/PortalType_view Other actions are defined as global actions, they will automatically be present. If actions already exists on the portal type, you should remove them. Actions added for a document are: • Print : permission View, category object_print, id print and action string:${object_url}/Base_printPdf • History : permission View, category object_view, id history and action string:${object_url}/Base_viewHistory • Metadata : permission Manage properties, category object_view, id metadata and action string:${object_url}/Base_viewMetadata The order of the actions of category object_view (which are defining tabs in the user interface) has to be the following : view, other views (example : details), history, metadata. For the ZMI view, the order goes from top to bottom. You should define the priority of actions according to that order (this is also valid for the modules portal types). Rule: If you add actions to the minimal set of actions on a document, their names should be named in “British English”. These names should be explicit compared to the action Rationale: The actions names are displayed to the user in the action menu on the document and is used for translation in other languages Actions names should always be defined from an use case and end user point of view and not from a technical point of view. Rule: If you define “fast input” actions, they usually have to be associated to “Add portal content” permission and have to be categorised as object_fast_input. Rationale: A specific fast input button is provided inside the action bar of ERP5 when needed Never configure a fast input action as object_exchange action category, use object_fast_input action category. In some cases, if fast inputs are used to modify existing document, the fast input action should rather be associated to Modify portal content permission, if they create new sub-documents, the action should use Add portal content permission. 2.3 Forms 2.3.1 General Rules Rule: Use appropriate titles in "British English" for the form and the fields titles so that localisation becomes easy. Titles of forms and fields have to be chosen carefully and must make sense from a business point of view. Rationale: The user interface has to be “business oriented” and localisation work of the user interface has to be easy ERP5 technical vocabulary should be banished from the user interface. Example 1 : "Shipping Date" is preferred to "Start Date" on a packing list. Example 2 : "Customer" is preferred to "Destination Section" on a sale order. Rule: All fields must have a correct description. Rationale: Description is used to generate a tool tip. This description can be on the property sheet, or on the field. If the description of the property sheet definition is not good on the context (property sheet descriptions often are too technical), the description must be set on fields (on the first level of proxyfield). Rule: The Id of an ERP5 document should never be handled by users or shown to them in View or List Forms Rationale: Id is a technical property in ERP5 and should not be significant for users. Ids should never (and no longer) be used in ERP5 Forms. For an ERP5 user, an ERP5 document has to be identified by either its title, reference or int_index but not by its id which is a technical property. Rule: Use proxyfields of proxyfields to create forms. Each Business Template provides libraries of fields that have to be used to define the forms associated to modules and documents. Rationale: All the forms of an ERP5 site have to be consistent. The maintenance of the forms has to be easy. The fields used to define forms are proxyfields of proxyfields. Actually ERP5 Base provides a field library in which the default rendering of each kind of field is defined. The field libraries contained in other business templates are defining the logic associated to the field. Example : Shipping Date In the Base field library, a “Date” field is defining that dates are displayed using the date format chosen by the user in its preference document. In the Trade BT, an order field library defines that “Shipping Date” is a proxyfield of the “Date “ field and that it will handle the start_date property. In the order or packing_list view form, a proxyfield of “Shipping Date” is used to display the shipping date. Rule: Avoid check required for a field in a view form Rationale: This kind of constraint should be defined in Constraints documents and have to be checked in workflow transitions. Checking a field as “required” can cause problems like not saving the data when the user clicks on the save button. The same apply for the use of External Validators scripts in fields. You should not use it unless it cannot be checked using constraints or can put the system in an unstable state. For instance, web page titles, documents references are required fields because otherwise we couldn't find those documents. Password fields on the Person view have a confirmation with an external validator, because we don't want to lock out an user that mistakes his password. Notice that it is accepted to define a field as required in dialogs. Thinking that a property will always be entered by the user is a mistake, you may think that a person will always have a name, but in real life for example you will find some cases like: “Mr Smith” without first name, “Betty” from Supplier company etc.. Rule: If a form contains a listbox with editable fields by listbox_property, those fields should be made hidden in the form by moving them in the “hidden” group Rationale: Fields in hidden groups are not renderred at all (this is different from checking “hidden” property on field, in this case it's rendered as a ' skin_folder = context.getPortalObject().portal_skins.erp5_base # <- XXX configure this for field_id, field in skin_folder.ZopeFind(skin_folder, search_sub=1, obj_metatypes=('ProxyField',)): form = field.aq_parent if form.getId().endswith('FieldLibrary'): continue field_path = '%s/%s' % (form.getId(), field.getId()) print '%s
' % ( skin_folder.absolute_url(), field_path, field_path) tf = field.getRecursiveTemplateField() for v in tf.values: if not field.is_delegated(v): print "  %s
" % v print return printed