Launchpad automatic translations update.
[odoo/odoo.git] / openerp / addons / base / base.sql
index 802e71c..b1ddb2e 100644 (file)
@@ -45,9 +45,12 @@ CREATE TABLE ir_model_fields (
   view_load boolean,
   relate boolean default False,
   relation_field varchar(128),
+  translate boolean default False,
   primary key(id)
 );
 
+ALTER TABLE ir_model_fields ADD column serialization_field_id int references ir_model_fields on delete cascade;
+
 
 -------------------------------------------------------------------------
 -- Actions
@@ -56,7 +59,7 @@ CREATE TABLE ir_model_fields (
 CREATE TABLE ir_actions (
     id serial NOT NULL,
     name varchar(64) DEFAULT ''::varchar NOT NULL,
-    "type" varchar(32) DEFAULT 'window'::varchar NOT NULL,
+    "type" varchar(32) NOT NULL,
     usage varchar(32) DEFAULT null,
     primary key(id)
 );
@@ -105,6 +108,11 @@ CREATE TABLE ir_act_server (
 )
 INHERITS (ir_actions);
 
+CREATE TABLE ir_act_client (
+    primary key(id)
+)
+INHERITS (ir_actions);
+
 
 CREATE TABLE ir_ui_view (
     id serial NOT NULL,
@@ -138,17 +146,13 @@ select setval('ir_ui_menu_id_seq', 2);
 
 CREATE TABLE res_users (
     id serial NOT NULL,
-    name varchar(64) not null,
     active boolean default True,
     login varchar(64) NOT NULL UNIQUE,
     password varchar(64) default null,
-    email varchar(64) default null,
-    context_tz varchar(64) default null,
-    signature text,
-    context_lang varchar(64) default '',
     -- No FK references below, will be added later by ORM
     -- (when the destination rows exist)
     company_id int,
+    partner_id int,
     primary key(id)
 );
 alter table res_users add constraint res_users_login_uniq unique (login);
@@ -278,18 +282,23 @@ CREATE TABLE ir_module_module (
     write_date timestamp without time zone,
     write_uid integer references res_users on delete set null,
     website character varying(256),
+    summary character varying(256),
     name character varying(128) NOT NULL,
     author character varying(128),
     url character varying(128),
+    icon character varying(64),
     state character varying(16),
     latest_version character varying(64),
     shortdesc character varying(256),
+    complexity character varying(32),
     category_id integer REFERENCES ir_module_category ON DELETE SET NULL,
-    certificate character varying(64),
     description text,
+    application boolean default False,
     demo boolean default False,
     web boolean DEFAULT FALSE,
     license character varying(32),
+    sequence integer DEFAULT 100,
+    auto_install boolean default False,
     primary key(id)
 );
 ALTER TABLE ir_module_module add constraint name_uniq unique (name);
@@ -306,13 +315,35 @@ CREATE TABLE ir_module_module_dependency (
     primary key(id)
 );
 
-CREATE TABLE res_company (
+CREATE TABLE res_partner (
     id serial NOT NULL,
-    name character varying(64) not null,
-    parent_id integer references res_company on delete set null,
+    name character varying(128),
+    lang varchar(64),
+    company_id int,
     primary key(id)
 );
 
+
+CREATE TABLE res_currency (
+    id serial PRIMARY KEY,
+    name VARCHAR(32) NOT NULL
+);
+
+CREATE TABLE res_company (
+    id serial PRIMARY KEY,
+    name character varying(128) not null,
+    parent_id integer references res_company on delete set null,
+    partner_id integer not null references res_partner,
+    currency_id integer not null references res_currency
+    
+);
+
+CREATE TABLE res_lang (
+    id serial PRIMARY KEY,
+    name VARCHAR(64) NOT NULL UNIQUE,
+    code VARCHAR(16) NOT NULL UNIQUE
+);
+
 CREATE TABLE ir_model_data (
     id serial NOT NULL,
     create_uid integer,
@@ -328,14 +359,55 @@ CREATE TABLE ir_model_data (
     res_id integer, primary key(id)
 );
 
+-- Records foreign keys and constraints installed by a module (so they can be
+-- removed when the module is uninstalled):
+--   - for a foreign key: type is 'f',
+--   - for a constraint: type is 'u' (this is the convention PostgreSQL uses).
+CREATE TABLE ir_model_constraint (
+    id serial NOT NULL,
+    create_uid integer,
+    create_date timestamp without time zone,
+    write_date timestamp without time zone,
+    write_uid integer,
+    date_init timestamp without time zone,
+    date_update timestamp without time zone,
+    module integer NOT NULL references ir_module_module on delete restrict,
+    model integer NOT NULL references ir_model on delete restrict,
+    type character varying(1) NOT NULL,
+    name character varying(128) NOT NULL
+);
+
+-- Records relation tables (i.e. implementing many2many) installed by a module
+-- (so they can be removed when the module is uninstalled).
+CREATE TABLE ir_model_relation (
+    id serial NOT NULL,
+    create_uid integer,
+    create_date timestamp without time zone,
+    write_date timestamp without time zone,
+    write_uid integer,
+    date_init timestamp without time zone,
+    date_update timestamp without time zone,
+    module integer NOT NULL references ir_module_module on delete restrict,
+    model integer NOT NULL references ir_model on delete restrict,
+    name character varying(128) NOT NULL
+);  
+
 ---------------------------------
 -- Users
 ---------------------------------
+insert into res_users (id,login,password,active,company_id,partner_id) VALUES (1,'admin','admin',true,1,1);
+insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('user_root','base','res.users',true,1);
+
+insert into res_partner (id, name, lang, company_id) VALUES (1, 'Your Company', 'en_US', 1);
+insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('main_partner','base','res.partner',true,1);
 
-insert into res_users (id,login,password,name,active,company_id,context_lang) values (1,'admin','admin','Administrator',True,1,'en_US');
-insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_root','base','res.users',True,1);
+insert into res_currency (id, name) VALUES (1, 'EUR');
+insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('EUR','base','res.currency',true,1);
 
--- Compatibility purpose, to remove V6.0
-insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_admin','base','res.users',True,1);
+insert into res_company (id, name, partner_id, currency_id) VALUES (1, 'Your Company', 1, 1);
+insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('main_company','base','res.company',true,1);
 
+select setval('res_company_id_seq', 2);
 select setval('res_users_id_seq', 2);
+select setval('res_partner_id_seq', 2);
+select setval('res_currency_id_seq', 2);
\ No newline at end of file