agrihold / sagi

Sistema de Mantenimiento y Seguimiento de Documentos.
1 stars 0 forks source link

Migrar dbo.TB_CATE_ESTU a sgr_document_category #161

Open csrocha opened 11 years ago

csrocha commented 11 years ago
          Tabla «public.tb_cate_estu»

id_cate | integer | nm_cate_py | character varying(100) | cd_cate | character varying(20) | nm_cate_br | character varying(100) | cd_tipo_estu | smallint |

                                           Tabla «public.sgr_document_category»

id | integer | not null valor por omisión nextval('sgr_document_category_id_seq'::regclass) create_uid | integer | create_date | timestamp without time zone | write_date | timestamp without time zone | write_uid | integer | company_id | integer | parent_category_id | integer | type | character varying | not null name | character varying(64) | not null parent_id | integer | complete_name | character varying | hierachical_type | character varying | not null experimiental_results | character varying | show_validation_method | boolean | reference | character varying(32) | experimental_results | character varying | Índices: "sgr_document_category_pkey" PRIMARY KEY, btree (id) Restricciones de llave foránea: "sgr_document_category_company_id_fkey" FOREIGN KEY (company_id) REFERENCES res_company(id) ON DELETE SET NULL "sgr_document_category_parent_category_id_fkey" FOREIGN KEY (parent_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL "sgr_document_category_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL Referenciada por: TABLE "sgr_document_category" CONSTRAINT "sgr_document_category_parent_category_id_fkey" FOREIGN KEY (parent_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL TABLE "sgr_document_category" CONSTRAINT "sgr_document_category_parent_id_fkey" FOREIGN KEY (parent_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL TABLE "sgr_document" CONSTRAINT "sgr_document_document_category_id_fkey" FOREIGN KEY (document_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL TABLE "sgr_partner_document_presentation" CONSTRAINT "sgr_partner_document_presentation_document_category_id_fkey" FOREIGN KEY (document_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL TABLE "sgr_product_study" CONSTRAINT "sgr_product_study_study_category_id_fkey" FOREIGN KEY (study_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL TABLE "sgr_registry_category_ids_document_category_ids_rel" CONSTRAINT "sgr_registry_category_ids_document_ca_document_category_id_fkey" FOREIGN KEY (document_category_id) REFERENCES sgr_document_category(id) ON DELETE CASCADE TABLE "sgr_study_presentation" CONSTRAINT "sgr_study_presentation_document_category_id_fkey" FOREIGN KEY (document_category_id) REFERENCES sgr_document_category(id) ON DELETE SET NULL

csrocha commented 11 years ago

sgr_document_category

cd_cate -> reference nm_cate_br -> name choose(cd_tipo_estu, (1,'partner_document'),(2,'study'),(3,'dossier_document'),(4,'tax')) -> type

ir_translation

'sgr.document_category,name' -> name 'es_ES' -> lang nm_cate_py -> value nm_cate_br -> src 'field' -> type None -> module

'sgr.document_category,name' -> name 'pt_BR' -> lang nm_cate_br -> value nm_cate_br -> src 'model' -> type None -> module

csrocha commented 11 years ago

Esta asignación no me parece correcta.

choose(cd_tipo_estu, (1,'partner_document'),(2,'study'),(3,'dossier_document'),(4,'tax')) -> type

En la base de datos en seleya encontré solo estas dos opciones, el resto es 1.

nm_cate_br | cd_tipo_estu ------------+-------------- Residue | 2 Efficacy | 3

jjscarafia commented 11 years ago

Bien, buena pregunta.

  1. En el seleya solo existen categorías de etudios, por lo cual todo lo que se lleva desde dbo.TB_CATE_ESTU se carga con type --> 2,study
  2. Por otro lado, los tipos que tiene el seleya se traducen en categorías padres en openerp. Para eso se deben crear 3 categorías con: type: study hierichal_type: view name: Residue | Efficacy | Physical, eco and toxicological (son los nombres de cada uno de los 3 registros) id: residue | efficacy | phy_eco_tox

Luego, toda la tabla tb_cate_estu se lleva con nm_cate_py --> name en español nm_cate_br --> name en portugues cd_cate --> reference cd_tipo_es. depende el valor: si = 1 --> parent_id = phy_eco_tox = 2 --> parent_id = Residue (además hace experimental_results = 'residue' y 'show_validation_method' = 'True') = 3 --> parent_id = Efficacy (además hace experimental_results = 'efficacy')