понедељак, 03. јануар 2011.

Adding new table in Adempiere 3.1.0

Customisation of Adempiere 3.1.0 is very easy, I was creating new table
CREATE TABLE "XX_MATERIAL"
( "AD_CLIENT_ID" NUMBER(10,0),
"AD_ORG_ID" NUMBER(10,0),
"ISACTIVE" CHAR(1),
"CREATED" DATE,
"CREATEDBY" NUMBER(10,0),
"UPDATED" DATE,
"UPDATEDBY" NUMBER(10,0),
"XX_MATERIAL_ID" NUMBER(10,0),
"MATNR" NUMBER(10,2),
"COLORNR" NUMBER(10,2),
"NAME" VARCHAR2(100),
"NAMESHORT" VARCHAR2(100),
CONSTRAINT "XX_MATERIAL_PK" PRIMARY KEY ("XX_MATERIAL_ID") ENABLE
)
/


CREATE OR REPLACE TRIGGER "BI_XX_MATERIAL"
before insert on "XX_MATERIAL"
for each row
begin
if :NEW."XX_MATERIAL_ID" is null then
select "XX_MATERIAL_SEQ".nextval into :NEW."XX_MATERIAL_ID" from dual;
end if;
end;

/
ALTER TRIGGER "BI_XX_MATERIAL" ENABLE
/
from examples on:
http://www.adempiere.com/index.php/NewWindow
and try to integrated this new table into Adempiere. This is one way, when Adempiere is install on computer, so can be customised by Administrator, other way is descibe on link above, change from trunk, from source code, include
1)Creating new table(s)
2)Dump new Adempiere.dmp database file with new creating tables
3)Creating Persistence objects with all new tables with GenerateModel.java code
4)building all code with new classes
This is 1 way, manualy customisation
Fig 1: Creating new window



Fig 1.1 Acces level and role, users who can modify data from new created table XX_MATERIAL


Fig 1.2 Fields from table XX_MATERIAL


Fig 2: MENU need call New Window created from XX_MATERIAL, I was placed into assets, could be in other hierarchy, assets can be extend and need change, in Republic of Serbia theres taxes and rates localy created, called STOPA AMORTIZACIJE, purchasing date of assets (DATUM NABAVKE OSNOVNOG SREDSTVA), other attribut rate2 called REVALORIZACIJA, account relation is good have 0230 values from accounts and 0239 as changed values, asset groups is determined by low as sub accounts, and other parameters can be changed or added. Fixed Asset Management can extend assets with this customised functionality, adding new tables and creating references (forein keys). This firs method discibe simlple modification of Adempiere 3.1.0 most complicated way is change into TRUNK of Adempiere 3.1.0 with GeneratedModel.java and practicaly reinstalation of all code.


Fig 3 : Table XX_MATERIAL have automaticaly created Persistence Objects (PO) and work fine

Fig 4: Invoices from Republic of Serbia have field called PIB, theres need add new field PIB varchar2(255) and again complete call NEW c_invoice table created New Window and New Form, on easy way with default lengh of db colum look like above picture