Code gestion is now of type card, create a fake stock card category and fill it with existing used code gestion
This commit is contained in:
parent
b4851fae8b
commit
55672defeb
3 changed files with 54 additions and 9 deletions
|
|
@ -286,4 +286,33 @@ insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values
|
|||
delete from stock_goods where sg_code is null or sg_code='' or sg_code not in (select ad_value from fiche_detail as fd where ad_id=19 and ad_value is not null);
|
||||
|
||||
CREATE INDEX fki_jrnx_j_grpt ON jrnx (j_grpt );
|
||||
CREATE INDEX fki_jrn_jr_grpt_id ON jrn (jr_grpt_id );
|
||||
CREATE INDEX fki_jrn_jr_grpt_id ON jrn (jr_grpt_id );
|
||||
|
||||
--
|
||||
insert into fiche_def (fd_id,frd_id,fd_label) values (500000,15,'Stock');
|
||||
insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,1,10);
|
||||
insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,9,20);
|
||||
insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,23,30);
|
||||
|
||||
create or replace function migrate_stock() returns void
|
||||
as
|
||||
$body$
|
||||
declare
|
||||
rt_row text;
|
||||
n_fid bigint;
|
||||
begin
|
||||
for rt_row in select distinct ad_value from fiche_Detail where ad_id=19 and ad_value is not null and ad_Value <> ''
|
||||
loop
|
||||
insert into fiche (fd_id) values(500000) returning f_id into n_fid;
|
||||
insert into fiche_detail (f_id,ad_id,ad_value) values (n_fid,1,rt_row);
|
||||
insert into fiche_detail (f_id,ad_id,ad_value) values (n_fid,9,'Code stock '||rt_row);
|
||||
insert into fiche_detail (f_id,ad_id,ad_value) values (n_fid,23,'STOCK'||n_fid::text);
|
||||
update fiche_detail set ad_value='STOCK'||n_fid::text where ad_id=19 and ad_value=rt_row;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$body$ language plpgsql;
|
||||
|
||||
select migrate_stock();
|
||||
|
||||
drop function migrate_stock();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue