Material Recept (Recebimento de Material)

2012-07-31
2013-03-07
  • Paulo Dantas
    Paulo Dantas
    2012-07-31

    Boa tarde,

    estou configurando o relatório de recebimento de material da janela, processo de impressão Rpt M_InOut_Imprimir Nota de Entrega / Remessa, porém o campo nome/descrição do produto não aparece de forma alguma.

    Descobri que, na linha do recebimento de material estava sendo preenchido o campo Instância do Conjunto de Atributos, mas eu não uso Instância de Atributos.

    Ao realizar um update na tabela m_inoutline, no campo  m_attributesetinstance_id, como a seguir:

    update m_inoutline

    set m_attributesetinstance_id = 0

    where ad_client_id = 2000000,

    ao gerar o relatório novamente, ele passa a aparecer o nome/descrição do produto na linha do recebimento de material.

    Eu uso o procedimento de Criar linhas a partir de, para poder puxar os produtos do pedido de compra associado a este recebimento de material.

    Algúem sabe o porque disso? Como faço para alterar esse preenchimento no campo Instância do Conjunto de Atributos na linha do recebimento de material?

    Alguém já passou por isso?

    Grato pela atenção de todos.

    Abraço.

     
  • Paulo Dantas
    Paulo Dantas
    2012-07-31

    Debugando, identifiquei que ao completar o recebimento de material, é que o campo Instância do Conjunto de Atributos é preenchido.

     
  • Paulo Dantas
    Paulo Dantas
    2012-08-01

    Resolvi o problema alterando a view m_inoutline_v e m_inoutline_vt, aonde o original são os seguintes:

    • View: adempiere.m_inout_line_v

    • DROP VIEW adempiere.m_inout_line_v;

    CREATE OR REPLACE VIEW adempiere.m_inout_line_v AS
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, p.m_product_id,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.movementqty
                        ELSE NULL::numeric
                    END AS movementqty,
                    CASE
                        WHEN iol.qtyentered <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
                        ELSE NULL::numeric
                    END AS qtyentered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN uom.uomsymbol
                        ELSE NULL::character varying
                    END AS uomsymbol, ol.qtyordered, ol.qtydelivered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
                        ELSE NULL::numeric
                    END AS qtybackordered, COALESCE(p.name::text || adempiere.productattribute(iol.m_attributesetinstance_id)::text, c.name::text, iol.description::text) AS name,
                    CASE
                        WHEN COALESCE(c.name, p.name) IS NOT NULL THEN iol.description
                        ELSE NULL::character varying
                    END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, p.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.m_inoutline iol
          JOIN adempiere.c_uom uom ON iol.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_product p ON iol.m_product_id = p.m_product_id
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id
       LEFT JOIN adempiere.c_orderline ol ON iol.c_orderline_id = ol.c_orderline_id
       LEFT JOIN adempiere.c_charge c ON iol.c_charge_id = c.c_charge_id
    UNION
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + bl.line / 100::numeric AS line, p.m_product_id,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.movementqty * bl.qtybom
                        ELSE iol.movementqty * (bl.qtybatch / 100::numeric)
                    END AS movementqty,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.qtyentered * bl.qtybom
                        ELSE iol.qtyentered * (bl.qtybatch / 100::numeric)
                    END AS qtyentered, uom.uomsymbol, NULL::unknown AS qtyordered, NULL::unknown AS qtydelivered, NULL::unknown AS qtybackordered, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, p.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.pp_product_bom b
          JOIN adempiere.m_inoutline iol ON b.m_product_id = iol.m_product_id
       JOIN adempiere.m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y'::bpchar AND bp.isverified = 'Y'::bpchar AND bp.ispicklistprintdetails = 'Y'::bpchar
       JOIN adempiere.pp_product_bomline bl ON bl.pp_product_bom_id = b.pp_product_bom_id
       JOIN adempiere.m_product p ON bl.m_product_id = p.m_product_id
       JOIN adempiere.c_uom uom ON p.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id;

    ALTER TABLE adempiere.m_inout_line_v OWNER TO adempiere;

    e

    • View: adempiere.m_inout_line_vt

    • DROP VIEW adempiere.m_inout_line_vt;

    CREATE OR REPLACE VIEW adempiere.m_inout_line_vt AS
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, p.m_product_id,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.movementqty
                        ELSE NULL::numeric
                    END AS movementqty,
                    CASE
                        WHEN iol.qtyentered <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
                        ELSE NULL::numeric
                    END AS qtyentered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN uom.uomsymbol
                        ELSE NULL::character varying
                    END AS uomsymbol, ol.qtyordered, ol.qtydelivered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
                        ELSE NULL::numeric
                    END AS qtybackordered, COALESCE(COALESCE(pt.name, p.name)::text || adempiere.productattribute(iol.m_attributesetinstance_id)::text, c.name::text, iol.description::text) AS name,
                    CASE
                        WHEN COALESCE(pt.name, p.name, c.name) IS NOT NULL THEN iol.description
                        ELSE NULL::character varying
                    END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, pt.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.m_inoutline iol
          JOIN adempiere.c_uom_trl uom ON iol.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_product p ON iol.m_product_id = p.m_product_id
       LEFT JOIN adempiere.m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language::text = pt.ad_language::text
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id
       LEFT JOIN adempiere.c_orderline ol ON iol.c_orderline_id = ol.c_orderline_id
       LEFT JOIN adempiere.c_charge_trl c ON iol.c_charge_id = c.c_charge_id
    UNION
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + bl.line / 100::numeric AS line, p.m_product_id,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.movementqty * bl.qtybom
                        ELSE iol.movementqty * (bl.qtybatch / 100::numeric)
                    END AS movementqty,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.qtyentered * bl.qtybom
                        ELSE iol.qtyentered * (bl.qtybatch / 100::numeric)
                    END AS qtyentered, uom.uomsymbol, NULL::unknown AS qtyordered, NULL::unknown AS qtydelivered, NULL::unknown AS qtybackordered, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, pt.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.pp_product_bom b
          JOIN adempiere.m_inoutline iol ON b.m_product_id = iol.m_product_id
       JOIN adempiere.m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y'::bpchar AND bp.isverified = 'Y'::bpchar AND bp.ispicklistprintdetails = 'Y'::bpchar
       JOIN adempiere.pp_product_bomline bl ON bl.pp_product_bom_id = b.pp_product_bom_id
       JOIN adempiere.m_product p ON bl.m_product_id = p.m_product_id
       JOIN adempiere.c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
       JOIN adempiere.m_product_trl pt ON bl.m_product_id = pt.m_product_id AND uom.ad_language::text = pt.ad_language::text
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id;

    ALTER TABLE adempiere.m_inout_line_vt OWNER TO adempiere;

    Alterei para os seguintes:

    • View: adempiere.m_inout_line_v

    • DROP VIEW adempiere.m_inout_line_v;

    CREATE OR REPLACE VIEW adempiere.m_inout_line_v AS
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, p.m_product_id,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.movementqty
                        ELSE NULL::numeric
                    END AS movementqty,
                    CASE
                        WHEN iol.qtyentered <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
                        ELSE NULL::numeric
                    END AS qtyentered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN uom.uomsymbol
                        ELSE NULL::character varying
                    END AS uomsymbol, ol.qtyordered, ol.qtydelivered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
                        ELSE NULL::numeric
                    END AS qtybackordered, p.name (Alterei as informações desta linha),
                    CASE
                        WHEN COALESCE(c.name, p.name) IS NOT NULL THEN iol.description
                        ELSE NULL::character varying
                    END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, p.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.m_inoutline iol
          JOIN adempiere.c_uom uom ON iol.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_product p ON iol.m_product_id = p.m_product_id
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id
       LEFT JOIN adempiere.c_orderline ol ON iol.c_orderline_id = ol.c_orderline_id
       LEFT JOIN adempiere.c_charge c ON iol.c_charge_id = c.c_charge_id
    UNION
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + bl.line / 100::numeric AS line, p.m_product_id,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.movementqty * bl.qtybom
                        ELSE iol.movementqty * (bl.qtybatch / 100::numeric)
                    END AS movementqty,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.qtyentered * bl.qtybom
                        ELSE iol.qtyentered * (bl.qtybatch / 100::numeric)
                    END AS qtyentered, uom.uomsymbol, NULL::unknown AS qtyordered, NULL::unknown AS qtydelivered, NULL::unknown AS qtybackordered, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, p.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.pp_product_bom b
          JOIN adempiere.m_inoutline iol ON b.m_product_id = iol.m_product_id
       JOIN adempiere.m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y'::bpchar AND bp.isverified = 'Y'::bpchar AND bp.ispicklistprintdetails = 'Y'::bpchar
       JOIN adempiere.pp_product_bomline bl ON bl.pp_product_bom_id = b.pp_product_bom_id
       JOIN adempiere.m_product p ON bl.m_product_id = p.m_product_id
       JOIN adempiere.c_uom uom ON p.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id;

    ALTER TABLE adempiere.m_inout_line_v OWNER TO adempiere;

    e

    • View: adempiere.m_inout_line_vt

    • DROP VIEW adempiere.m_inout_line_vt;

    CREATE OR REPLACE VIEW adempiere.m_inout_line_vt AS
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, p.m_product_id,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.movementqty
                        ELSE NULL::numeric
                    END AS movementqty,
                    CASE
                        WHEN iol.qtyentered <> 0::numeric OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
                        ELSE NULL::numeric
                    END AS qtyentered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN uom.uomsymbol
                        ELSE NULL::character varying
                    END AS uomsymbol, ol.qtyordered, ol.qtydelivered,
                    CASE
                        WHEN iol.movementqty <> 0::numeric OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
                        ELSE NULL::numeric
                    END AS qtybackordered, p.name (Alterei as informações desta linha),
                    CASE
                        WHEN COALESCE(pt.name, p.name, c.name) IS NOT NULL THEN iol.description
                        ELSE NULL::character varying
                    END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, pt.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.m_inoutline iol
          JOIN adempiere.c_uom_trl uom ON iol.c_uom_id = uom.c_uom_id
       LEFT JOIN adempiere.m_product p ON iol.m_product_id = p.m_product_id
       LEFT JOIN adempiere.m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language::text = pt.ad_language::text
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id
       LEFT JOIN adempiere.c_orderline ol ON iol.c_orderline_id = ol.c_orderline_id
       LEFT JOIN adempiere.c_charge_trl c ON iol.c_charge_id = c.c_charge_id
    UNION
             SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + bl.line / 100::numeric AS line, p.m_product_id,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.movementqty * bl.qtybom
                        ELSE iol.movementqty * (bl.qtybatch / 100::numeric)
                    END AS movementqty,
                    CASE
                        WHEN bl.isqtypercentage = 'N'::bpchar THEN iol.qtyentered * bl.qtybom
                        ELSE iol.qtyentered * (bl.qtybatch / 100::numeric)
                    END AS qtyentered, uom.uomsymbol, NULL::unknown AS qtyordered, NULL::unknown AS qtydelivered, NULL::unknown AS qtybackordered, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id, l.m_warehouse_id, l.x, l.y, l.z, iol.m_attributesetinstance_id, asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate, pt.description AS productdescription, p.imageurl, iol.c_campaign_id, iol.c_project_id, iol.c_activity_id, iol.c_projectphase_id, iol.c_projecttask_id
               FROM adempiere.pp_product_bom b
          JOIN adempiere.m_inoutline iol ON b.m_product_id = iol.m_product_id
       JOIN adempiere.m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y'::bpchar AND bp.isverified = 'Y'::bpchar AND bp.ispicklistprintdetails = 'Y'::bpchar
       JOIN adempiere.pp_product_bomline bl ON bl.pp_product_bom_id = b.pp_product_bom_id
       JOIN adempiere.m_product p ON bl.m_product_id = p.m_product_id
       JOIN adempiere.c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
       JOIN adempiere.m_product_trl pt ON bl.m_product_id = pt.m_product_id AND uom.ad_language::text = pt.ad_language::text
       LEFT JOIN adempiere.m_attributesetinstance asi ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
       LEFT JOIN adempiere.m_locator l ON iol.m_locator_id = l.m_locator_id;

    ALTER TABLE adempiere.m_inout_line_vt OWNER TO adempiere;

    Haverá algum problema nessas alterações?

    Grato pela atenção.

    Abraço.