Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0040321Openbravo ERPA. Platformpublic2019-03-05 16:002019-03-08 11:11
vmromanos 
jarmendariz 
normalmajoralways
closedno change required 
5
 
 
jarmendariz
Core
No
0040321: Create Columns from DB not working fine with views
It seems the process is not working fine for views and only when called from the UI. However it seems to work when called directly from the database (ad_table_import or ad_table_import0).
Create the following view directly in PostgreSQL:
CREATE OR REPLACE VIEW c_mytest AS
 SELECT l.c_orderline_id c_mytest_id, l.ad_client_id as AD_CLIENT_ID, l.ad_org_id as AD_ORG_ID, l.isactive as ISACTIVE,
        l.created as CREATED, l.createdby as CREATEDBY, o.updated as UPDATED, l.updatedby as UPDATEDBY,
        o.c_bpartner_id, o.datePromised, o.m_warehouse_id, o.documentno,
        l.m_product_id, l.qtyOrdered - l.qtyDelivered as pendingToDeliverQty, l.c_uom_id
 FROM C_Order o
 JOIN C_OrderLine l on (o.c_order_id = l.c_order_id)
 WHERE o.issotrx = 'Y'
 AND o.docstatus = 'CO'


Login as System Admin in Openbravo.
Go to Module window and set Core as indevelopment.
In Tables And Columns window enter a new record for the view c_mytest and fill the necessary fields.
Set View flag, unset Deletable Records [NICE TO HAVE: this flag should be automatically unset for views].
Press the Create Columns from DB. An error is raised informing about missing columns.

Now in PG run and write down the output:
select ad_pinstance_id from ad_pinstance order by created desc limit 1;

Now run:
select ad_table_import0(<previous ad_pinstance_id>) from dual;

Verify the process is completed successfully.

Go back to the Tables and Columns window, search the previously created record.
Verify the Columns are properly inserted.
No tags attached.
related to feature request 0040341 new Triage Platform Base When selecting "View" checkbox in Table Window, "Deletable Records" should be automatically unselected 
Issue History
2019-03-05 16:00vmromanosNew Issue
2019-03-05 16:00vmromanosAssigned To => platform
2019-03-05 16:00vmromanosModules => Core
2019-03-05 16:00vmromanosTriggers an Emergency Pack => No
2019-03-07 13:51jarmendarizAssigned Toplatform => jarmendariz
2019-03-07 13:51jarmendarizStatusnew => acknowledged
2019-03-08 11:01jarmendarizRelationship addedrelated to 0040341
2019-03-08 11:02jarmendarizStatusacknowledged => scheduled
2019-03-08 11:11jarmendarizReview Assigned To => jarmendariz
2019-03-08 11:11jarmendarizNote Added: 0110311
2019-03-08 11:11jarmendarizStatusscheduled => closed
2019-03-08 11:11jarmendarizResolutionopen => no change required

Notes
(0110311)
jarmendariz   
2019-03-08 11:11   
I reproduced this issue by creating the View using the "postgres" user instead of "tad". For this reason, the c_mytest view cannot be accesed via backoffice but the column generation procedure works as expected in the console.

To make this work, just execute the following after creating the view:

alter table c_mytest
  owner to tad;