|
|
|
|
|
|
Login
|
erp5.org has permanently moved to wiki.erp5.org ! Current status of ERP5 community websites:
Note: if you created content in this ancient portal, please migrate it to the wiki. The old website will stay online as long as all contents are not mograted to the wiki.
RelationStringFields and Listboxes in ERP5
This document describes howto create a relation RelationStingField with ERP5, so that you will be able to create relations between your ERP5 objects.
IntroductionERP5 allows to create very easyly web forms and offers a large panel of widgets among which the relationstringfield and the listbox. This document describes how to use them. First of all, you must have created an ERP5 form thanks to the "select type to add" menu. When you click on an ERP5 form, you see a page which allows you to manage your form graphically. By clicking on the "select type to add menu", you will see some widgets you can add such as StringField, PasswordField, RadioField. You can then configure properties of each widget (length of the field for example). What is a relationstringfield ?This is an input in wich you can type only a part of a word, and a list of matching possibilities will be displayed. Properties of a relationstringfieldTitleTitle of the relationstringfield. Example : Person last name. Display widthWidth of the relationstringfield. Example : 20. Update methodThis is the method called when you click on the "wheel" icon. Example : base_update_relation. Jump methodThis is the method called when you click on the "plane" icon. Example : base_jump_relation. Base categoryThis is the category defined in the propertysheet corresponding to the relationstringfield. Exemple : persons. Portal TypeHere you must configure the type of object you want to display. Exemple : person | Person. Catalog IndexThis is the column with wich the relation is made. Example : person_last_name. Default moduleModule the relationstringfield is belonging to. Example : Person. Multi Relation String FieldMulti Relation String Fields work exactly the same except they allow to make a relation with several words. What is a listbox ?It is a table generated dynamically which lists objects. This kind of tool is extremely useful in ERP5 because it allows to display lots of informations in a rather clear way. Properties of a listboxTitleThis is the name which will appear on the web interface, above the listbox. LinesThis is the number of lines displayed by the listbox. If the number of objects matching is greater than this number, then you will be able to see "next" and "previous" results. ColumnsThis is where you can set the columns you want to be displayed in the listbox. Each column is defined by the following schema : column_id | column_title. column_id refers to a propertysheet or a get method. column_title is the name that ERP5 users will see. So, for example, if you want to display a list of people, you may configure Columns like this : person_last_name | Last name person_first_name | First Name person_address | Address person_commentary | Commentary Default sortThanks to this, you can configure the way the list will be displayed by default. For example, if I put "person_last_name | Last name", then the list will be sorted by person_last_name. Editable columnsSome informations may have to be editable directly from the listbox in order to be quicker or because the information is supposed to often change. For example, person_last_name is not the kind of information that changes frequently. But person_commentary is. So I may put "person_commentary | Phone commentary" in "Editable columns". Plus, you must configure how the information will be editable, that is to say, you must choose a widget for the editable column. For example, I want my "person_commentary" editable with a StringField widget. So I must add in my ERP5 form a StringField named "listbox_person_commentary" that I can configure (length etc) as I want. So, to each editable column must correspond a widget with the prefix "listbox_". Moreover, in order tab, you must create a group called "hidden" and put all the "listbox_" widgets in it. Besides, you should not use "required" option on "listbox_" widgets because this causes troubles to update the form. MethodMethod is the way that the listbox will fetch objects. For example, "searchFolder" will search matching objects through the folder. Selection NameGenerally speaking, we use the widget id + the suffixe "_selection" for this. In fact, it allows to record your list criteria so as to be able to browse and other pages and come back on the same page with the same criteria. That is why selection_name must be unique. List ActionThis is the action realized when you click on the link of the listbox title. For example, "folder_contents" will allow to display the listbox on a full page. Search RowIf you check this box, the user will not only see the results of a list box but he will also be able to search results thanks to an input above each column. Select ColumnIf this option is turned on, boxes will be displayed on each line in order to manage these lines. Thus, you can, for example, delete several rows in once. Portal TypesHere you must configure the type of object you want to display. Domain Tree and Report TreeThere are mainly three ways to display a listbox. The first one is "Flat List" : lines of the listbox are simply displayed in a very traditional table. The drawback of this method is that the listbox becomes unclear when informations are too numerous. The two others are "Domain Tree" and "Report Tree" that allow to display a listbox according to defined categories. "Domain Tree" and "Report Tree" can be combined. If "Domain Tree" and "Report Tree" boxes are not checked, it is traditional way (Flat List) that will be used to display the listbox. So, thanks to these properties, you will be able to set default way to display the listbox but the users will be able to choose among "Flat List", "Domain Tree" and "Report Tree" directly from ERP5. Global AttributesSometimes, an information may be common to all the listbox lines. For exemple, a listbox can be used to display each purchase of an invoice. Although, according to the propertysheet, each line of the listbox could have its own currency, we may want to set a currency which is common to each line (it would be really too long to change currency of each line !). So we can put "currency | currency" in "Global Attributes" so as to have a property just defined once but common to each line. |
|
|