Posts

Showing posts from June 4, 2010

Naming conventions for Tables in Openbravo

1. The Name of the Document shoould be in camel case and also should begin with the module's prefix and should not include blank spaces (REST web services cannot be created) .
Eg. The table c_orderline can be written as "C_OrderLine"

2. Description is a must and the name can be used if the description is unknown.

3. Better to inculde help/comments that will help for further reference.

4. The java table name should always be in lowercase. (since postgres is not case sensitive its better to use lower case)

5. The view option should be selected only for read only tables. These tables cannot be accessed through a web-service as POST methods will be invalid on those tables.

6. The java class name should also be camel cased.

7. Data access level should be set accordingly.
* System only: Only system records can be inserted into this table (AD_CLIENT_ID=0, AD_ORG_ID=0), for example AD_TABLE.
* System/Client: System or client specific records can be inserted here (AD_CLIENT_I…

Getting window and menu details from table name

hi all, 
            its quite a task in openbravo to find a table associated with a window and to find the window , tab and menu for a given table. I ve written a small function to provide the window name and menu names given a table name.




CREATE OR REPLACE FUNCTION get_details(tab_name character varying)   RETURNS void AS $BODY$ DECLARE window_id varchar(32); window_name varchar(100); menu_id varchar(32); tmp_men varchar(100); menu_name varchar(100)[]; par_id varchar(32); i numeric; j numeric; Menu varchar(250); BEGIN i:=0; j:=0; Menu:='Menu : Openbravo'; ---- get window corresponding to table Raise Notice '----------------------Table Details----------------------'; Raise Notice 'Table Name : %',tab_name; select a.ad_window_id,b.name into window_id,window_name  from ad_table a,ad_window b where a.tablename=tab_name and a.ad_window_id=b.ad_window_id; Raise Notice '----------------------Window Details----------------------'; Raise Notice 'Window Id Mapped : %',window_i…