diff --git a/db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql b/db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql
index eeb6be3647..2fb13cfa3e 100644
--- a/db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql
+++ b/db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql
@@ -306,6 +306,7 @@ AS
ON il.c_charge_id = c.c_charge_id
LEFT JOIN c_charge_trl ct
ON il.c_charge_id = ct.c_charge_id
+ AND uomt.ad_language = ct.ad_language
LEFT JOIN c_bpartner_product pp
ON il.m_product_id = pp.m_product_id
AND i.c_bpartner_id = pp.c_bpartner_id
diff --git a/db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql b/db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql
index c6ad80a011..bdd37903b4 100644
--- a/db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql
+++ b/db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql
@@ -233,6 +233,7 @@ AS
ON iol.c_charge_id = c.c_charge_id
LEFT JOIN c_charge_trl ct
ON iol.c_charge_id = ct.c_charge_id
+ AND uomt.ad_language = ct.ad_language
UNION
SELECT iol.ad_client_id,
iol.ad_org_id,
diff --git a/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql
index 396cb5f8a6..5cc733ff4e 100644
--- a/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql
+++ b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql
@@ -264,7 +264,7 @@ CREATE OR REPLACE VIEW c_invoice_linetax_vt AS
LEFT JOIN c_charge c
ON il.c_charge_id = c.c_charge_id
LEFT JOIN c_charge_trl ct
- ON il.c_charge_id = ct.c_charge_id
+ ON il.c_charge_id = ct.c_charge_id AND uomt.ad_language = ct.ad_language
LEFT JOIN c_bpartner_product pp
ON il.m_product_id = pp.m_product_id AND i.c_bpartner_id = pp.c_bpartner_id
LEFT JOIN m_product_trl pt
@@ -534,7 +534,7 @@ CREATE OR REPLACE VIEW c_invoice_linetax_vt AS
ON bl.m_product_id = pt.m_product_id AND uomt.ad_language = pt.ad_language
LEFT JOIN c_tax t
ON il.c_tax_id = t.c_tax_id
- LEFT JOIN c_tax_trl tt
+ LEFT JOIN c_tax_trl tt
ON il.c_tax_id = tt.c_tax_id AND uomt.ad_language = tt.ad_language
LEFT JOIN m_attributesetinstance asi
ON il.m_attributesetinstance_id = asi.m_attributesetinstance_id)
diff --git a/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql b/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql
index 33d69d60f4..d45d367d36 100644
--- a/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql
+++ b/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql
@@ -1,4 +1,4 @@
-DROP VIEW m_inout_line_vt;
+DROP VIEW m_inout_line_vt;
CREATE OR REPLACE VIEW m_inout_line_vt AS
SELECT iol.ad_client_id,
@@ -214,7 +214,7 @@ FROM m_inoutline iol
LEFT JOIN c_charge c
ON iol.c_charge_id = c.c_charge_id
LEFT JOIN c_charge_trl ct
- ON iol.c_charge_id = ct.c_charge_id
+ ON iol.c_charge_id = ct.c_charge_id AND uomt.ad_language = ct.ad_language
UNION SELECT iol.ad_client_id,
iol.ad_org_id,
iol.isactive,
diff --git a/migration/i3.1/oracle/201607281208_IDEMPIERE-2428.sql b/migration/i3.1/oracle/201607281208_IDEMPIERE-2428.sql
new file mode 100644
index 0000000000..be43181c02
--- /dev/null
+++ b/migration/i3.1/oracle/201607281208_IDEMPIERE-2428.sql
@@ -0,0 +1,9 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2428
+-- Jul 28, 2016 12:08:00 PM CEST
+drop index m_inoutlinema_key;
+
+SELECT register_migration_script('201607281208_IDEMPIERE-2428.sql') FROM dual
+;
diff --git a/migration/i3.1/oracle/201608031225_IDEMPIERE-3146.sql b/migration/i3.1/oracle/201608031225_IDEMPIERE-3146.sql
new file mode 100644
index 0000000000..d73703e149
--- /dev/null
+++ b/migration/i3.1/oracle/201608031225_IDEMPIERE-3146.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
+-- Aug 3, 2016 12:25:05 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','{0} resolved multiple times = ({1})',0,0,'Y',TO_DATE('2016-08-03 12:25:05','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2016-08-03 12:25:05','YYYY-MM-DD HH24:MI:SS'),100,200405,'ForeignMultipleResolved','D','3c350f49-c813-4ebc-ae1a-5d4b2fc76faa')
+;
+
+SELECT register_migration_script('201608031225_IDEMPIERE-3146.sql') FROM dual
+;
+
diff --git a/migration/i3.1/oracle/201608061118_IDEMPIERE-3150.sql b/migration/i3.1/oracle/201608061118_IDEMPIERE-3150.sql
new file mode 100644
index 0000000000..7e9628538e
--- /dev/null
+++ b/migration/i3.1/oracle/201608061118_IDEMPIERE-3150.sql
@@ -0,0 +1,1816 @@
+DROP VIEW c_invoice_linetax_vt;
+
+CREATE OR REPLACE VIEW c_invoice_linetax_vt
+AS
+ (((SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ uomt.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ il.c_tax_id,
+ il.taxamt,
+ il.linetotalamt,
+ tt.taxindicator,
+ il.line,
+ pt.m_product_id,
+ CASE
+ WHEN il.qtyinvoiced <> 0
+ OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced
+ ELSE NULL
+ END AS qtyinvoiced,
+ CASE
+ WHEN il.qtyentered <> 0
+ OR il.m_product_id IS NOT NULL THEN il.qtyentered
+ ELSE NULL
+ END AS qtyentered,
+ CASE
+ WHEN il.qtyentered <> 0
+ OR il.m_product_id IS NOT NULL THEN uomt.uomsymbol
+ ELSE NULL
+ END AS uomsymbol,
+ COALESCE(ct.name, ( pt.name
+ || COALESCE(productattribute(il.m_attributesetinstance_id), '') ), il.description) AS name,
+ CASE
+ WHEN COALESCE(ct.name, pt.name) IS NOT NULL THEN il.description
+ ELSE NULL
+ END AS description,
+ pt.documentnote,
+ p.upc,
+ p.sku,
+ COALESCE(pp.vendorproductno, p.value) AS productvalue,
+ ra.description AS resourcedescription,
+ CASE
+ WHEN i.isdiscountprinted = 'Y'
+ AND il.pricelist <> 0 THEN il.pricelist
+ ELSE NULL
+ END AS pricelist,
+ CASE
+ WHEN i.isdiscountprinted = 'Y'
+ AND il.pricelist <> 0
+ AND il.qtyentered <> 0 THEN il.pricelist * il.qtyinvoiced / il.qtyentered
+ ELSE NULL
+ END AS priceenteredlist,
+ CASE
+ WHEN i.isdiscountprinted = 'Y'
+ AND il.pricelist > il.priceactual
+ AND il.pricelist <> 0 THEN ( il.pricelist - il.priceactual ) / il.pricelist * 100
+ ELSE NULL
+ END AS discount,
+ CASE
+ WHEN il.priceactual <> 0
+ OR il.m_product_id IS NOT NULL THEN il.priceactual
+ ELSE NULL
+ END AS priceactual,
+ CASE
+ WHEN il.priceentered <> 0
+ OR il.m_product_id IS NOT NULL THEN il.priceentered
+ ELSE NULL
+ END AS priceentered,
+ CASE
+ WHEN il.linenetamt <> 0
+ OR il.m_product_id IS NOT NULL THEN il.linenetamt
+ ELSE NULL
+ END AS linenetamt,
+ il.m_attributesetinstance_id,
+ asi.m_attributeset_id,
+ asi.serno,
+ asi.lot,
+ asi.m_lot_id,
+ asi.guaranteedate,
+ pt.description AS productdescription,
+ p.imageurl,
+ il.c_campaign_id,
+ il.c_project_id,
+ il.c_activity_id,
+ il.c_projectphase_id,
+ il.c_projecttask_id,
+ il.ad_orgtrx_id AS c_invoiceline_ad_orgtrx_id,
+ il.a_processed,
+ il.c_charge_id,
+ il.c_orderline_id,
+ il.c_uom_id,
+ il.isdescription,
+ il.isprinted AS c_invoiceline_isprinted,
+ il.m_inoutline_id,
+ il.m_rmaline_id,
+ il.pricelimit,
+ il.processed AS c_invoiceline_processed,
+ il.ref_invoiceline_id,
+ il.rramt,
+ il.rrstartdate,
+ il.s_resourceassignment_id,
+ il.user1_id AS c_invoiceline_user1_id,
+ il.user2_id AS c_invoiceline_user2_id,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ i.ad_org_id AS c_invoice_ad_org_id,
+ i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
+ i.ad_user_id AS c_invoice_ad_user_id,
+ i.c_activity_id AS c_invoice_c_activity_id,
+ i.c_bpartner_id AS c_invoice_c_bpartner_id,
+ i.c_bpartner_location_id,
+ i.c_campaign_id AS c_invoice_c_campaign_id,
+ i.c_charge_id AS c_invoice_c_charge_id,
+ i.c_conversiontype_id,
+ i.c_currency_id,
+ i.c_doctype_id,
+ i.c_doctypetarget_id,
+ i.c_dunninglevel_id,
+ i.chargeamt AS c_invoice_chargeamt,
+ i.c_order_id,
+ i.c_payment_id,
+ i.c_paymentterm_id,
+ i.c_project_id AS c_invoice_c_project_id,
+ i.created AS c_invoice_created,
+ i.createdby AS c_invoice_createdby,
+ i.dateacct,
+ i.dateinvoiced,
+ i.dateordered,
+ i.dateprinted,
+ i.description AS c_invoice_description,
+ i.docaction,
+ i.docstatus,
+ i.documentno,
+ i.dunninggrace,
+ i.generateto,
+ i.grandtotal,
+ i.invoicecollectiontype,
+ i.isactive AS c_invoice_isactive,
+ i.isapproved,
+ i.isdiscountprinted,
+ i.isindispute,
+ i.ispaid,
+ i.ispayschedulevalid,
+ i.isprinted AS c_invoice_isprinted,
+ i.isselfservice AS c_invoice_isselfservice,
+ i.issotrx,
+ i.istaxincluded AS c_invoice_istaxincluded,
+ i.istransferred,
+ i.m_pricelist_id,
+ i.m_rma_id,
+ i.paymentrule,
+ i.poreference,
+ i.posted,
+ i.processedon,
+ i.processing,
+ i.ref_invoice_id,
+ i.reversal_id,
+ i.salesrep_id,
+ i.sendemail,
+ i.totallines,
+ i.updated AS c_invoice_updated,
+ i.updatedby AS c_invoice_updatedby,
+ i.user1_id AS c_invoice_user1_id,
+ i.user2_id AS c_invoice_user2_id,
+ tt.ad_org_id AS c_tax_ad_org_id,
+ t.ad_rule_id,
+ t.c_country_id,
+ t.c_region_id,
+ t.c_taxcategory_id AS c_tax_c_taxcategory_id,
+ tt.description AS c_tax_description,
+ tt.isactive AS c_tax_isactive,
+ t.isdefault AS c_tax_isdefault,
+ t.isdocumentlevel,
+ t.issalestax,
+ t.issummary AS c_tax_issummary,
+ t.istaxexempt,
+ tt.name AS c_tax_name,
+ t.parent_tax_id,
+ t.rate,
+ t.requirestaxcertificate,
+ t.sopotype,
+ t.to_country_id,
+ t.to_region_id,
+ t.validfrom,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ pt.updated AS m_product_updated,
+ pt.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ ct.ad_org_id AS c_charge_ad_org_id,
+ c.c_bpartner_id AS c_charge_c_bpartner_id,
+ c.c_chargetype_id,
+ c.chargeamt AS c_charge_chargeamt,
+ c.c_taxcategory_id AS c_charge_c_taxcategory_id,
+ ct.description AS c_charge_description,
+ ct.isactive AS c_charge_isactive,
+ c.issamecurrency,
+ c.issametax,
+ c.istaxincluded AS c_charge_istaxincluded,
+ pp.ad_org_id AS c_bp_product_ad_org_id,
+ pp.c_bpartner_id AS c_bp_product_c_bpartner_id,
+ pp.created AS c_bp_product_created,
+ pp.createdby AS c_bp_product_createdby,
+ pp.description AS c_bp_product_description,
+ pp.isactive AS c_bp_product_isactive,
+ pp.ismanufacturer,
+ pp.manufacturer,
+ pp.qualityrating,
+ pp.shelflifemindays,
+ pp.shelflifeminpct,
+ pp.updated AS c_bp_product_updated,
+ pp.updatedby AS c_bp_product_updatedby,
+ pp.vendorcategory,
+ ra.ad_org_id AS s_rassignment_ad_org_id,
+ ra.assigndatefrom,
+ ra.assigndateto,
+ ra.created AS s_rassignment_created,
+ ra.createdby AS s_rassignment_createby,
+ ra.isactive AS s_rassignment_isactive,
+ ra.isconfirmed,
+ ra.name AS s_rassignment_name,
+ ra.qty AS s_rassignment_qty,
+ ra.s_resource_id AS s_rassignment_s_resource_id,
+ ra.updated AS s_rassignment_updated,
+ ra.updatedby AS s_rassignment_updatedby,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby
+ FROM c_invoiceline il
+ JOIN c_uom uom
+ ON il.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON il.c_uom_id = uomt.c_uom_id
+ JOIN c_invoice i
+ ON il.c_invoice_id = i.c_invoice_id
+ LEFT JOIN c_tax t
+ ON il.c_tax_id = t.c_tax_id
+ LEFT JOIN c_tax_trl tt
+ ON il.c_tax_id = tt.c_tax_id
+ AND uomt.ad_language = tt.ad_language
+ LEFT JOIN m_product p
+ ON il.m_product_id = p.m_product_id
+ LEFT JOIN c_charge c
+ ON il.c_charge_id = c.c_charge_id
+ LEFT JOIN c_charge_trl ct
+ ON il.c_charge_id = ct.c_charge_id
+ AND uomt.ad_language = ct.ad_language
+ LEFT JOIN c_bpartner_product pp
+ ON il.m_product_id = pp.m_product_id
+ AND i.c_bpartner_id = pp.c_bpartner_id
+ LEFT JOIN m_product_trl pt
+ ON il.m_product_id = pt.m_product_id
+ AND uomt.ad_language = pt.ad_language
+ LEFT JOIN s_resourceassignment ra
+ ON il.s_resourceassignment_id = ra.s_resourceassignment_id
+ LEFT JOIN m_attributesetinstance asi
+ ON il.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ UNION /* BOM lines */
+ SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ uomt.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ il.c_tax_id,
+ il.taxamt,
+ il.linetotalamt,
+ tt.taxindicator,
+ il.line + bl.line / 100 AS line,
+ pt.m_product_id,
+ CASE
+ WHEN bl.isqtypercentage = 'N' THEN il.qtyinvoiced * bl.qtybom
+ ELSE il.qtyinvoiced * ( bl.qtybatch / 100 )
+ END AS qtyinvoiced,
+ CASE
+ WHEN bl.isqtypercentage = 'N' THEN il.qtyentered * bl.qtybom
+ ELSE il.qtyentered * ( bl.qtybatch / 100 )
+ END AS qtyentered,
+ uomt.uomsymbol,
+ COALESCE(pt.name, p.name) AS name,
+ b.description,
+ COALESCE(pt.documentnote, p.documentnote) AS documentnote,
+ p.upc,
+ p.sku,
+ p.value AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ il.m_attributesetinstance_id,
+ asi.m_attributeset_id,
+ asi.serno,
+ asi.lot,
+ asi.m_lot_id,
+ asi.guaranteedate,
+ pt.description AS productdescription,
+ p.imageurl,
+ il.c_campaign_id,
+ il.c_project_id,
+ il.c_activity_id,
+ il.c_projectphase_id,
+ il.c_projecttask_id,
+ il.ad_orgtrx_id AS c_invoiceline_ad_orgtrx_id,
+ il.a_processed,
+ il.c_charge_id,
+ il.c_orderline_id,
+ il.c_uom_id,
+ il.isdescription,
+ il.isprinted AS c_invoiceline_isprinted,
+ il.m_inoutline_id,
+ il.m_rmaline_id,
+ il.pricelimit,
+ il.processed AS c_invoiceline_processed,
+ il.ref_invoiceline_id,
+ il.rramt,
+ il.rrstartdate,
+ il.s_resourceassignment_id,
+ il.user1_id AS c_invoiceline_user1_id,
+ il.user2_id AS c_invoiceline_user2_id,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ tt.ad_org_id AS c_tax_ad_org_id,
+ t.ad_rule_id,
+ t.c_country_id,
+ t.c_region_id,
+ t.c_taxcategory_id AS c_tax_c_taxcategory_id,
+ tt.description AS c_tax_description,
+ tt.isactive AS c_tax_isactive,
+ t.isdefault AS c_tax_isdefault,
+ t.isdocumentlevel,
+ t.issalestax,
+ t.issummary AS c_tax_issummary,
+ t.istaxexempt,
+ tt.name AS c_tax_name,
+ t.parent_tax_id,
+ t.rate,
+ t.requirestaxcertificate,
+ t.sopotype,
+ t.to_country_id,
+ t.to_region_id,
+ t.validfrom,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ p.updated AS m_product_updated,
+ p.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby
+ FROM pp_product_bom b
+ JOIN c_invoiceline il
+ ON b.m_product_id = il.m_product_id
+ JOIN m_product bp
+ ON bp.m_product_id = il.m_product_id
+ AND bp.isbom = 'Y'
+ AND bp.isverified = 'Y'
+ AND bp.isinvoiceprintdetails = 'Y'
+ JOIN pp_product_bomline bl
+ ON bl.pp_product_bom_id = b.pp_product_bom_id
+ JOIN m_product p
+ ON bl.m_product_id = p.m_product_id
+ JOIN c_uom uom
+ ON p.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON p.c_uom_id = uomt.c_uom_id
+ JOIN m_product_trl pt
+ ON bl.m_product_id = pt.m_product_id
+ AND uomt.ad_language = pt.ad_language
+ LEFT JOIN c_tax t
+ ON il.c_tax_id = t.c_tax_id
+ LEFT JOIN c_tax_trl tt
+ ON il.c_tax_id = tt.c_tax_id
+ AND uomt.ad_language = tt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON il.m_attributesetinstance_id = asi.m_attributesetinstance_id)
+ UNION /* comment lines */
+ SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ l.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ NULL AS c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ NULL AS taxindicator,
+ il.line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ il.description AS name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+ FROM c_invoiceline il,
+ ad_language l
+ WHERE il.c_uom_id IS NULL
+ AND l.isbaselanguage = 'N'
+ AND l.issystemlanguage = 'Y')
+ UNION /* empty line */
+ SELECT i.ad_client_id,
+ i.ad_org_id,
+ i.isactive,
+ i.created,
+ i.createdby,
+ i.updated,
+ i.updatedby,
+ l.ad_language,
+ i.c_invoice_id,
+ NULL AS c_invoiceline_id,
+ NULL AS c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ NULL AS taxindicator,
+ 999998 AS line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ NULL AS name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+ FROM c_invoice i,
+ ad_language l
+ WHERE l.isbaselanguage = 'N'
+ AND l.issystemlanguage = 'Y')
+ UNION /* tax lines */
+ SELECT it.ad_client_id,
+ it.ad_org_id,
+ it.isactive,
+ it.created,
+ it.createdby,
+ it.updated,
+ it.updatedby,
+ tt.ad_language,
+ it.c_invoice_id,
+ NULL AS c_invoiceline_id,
+ it.c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ tt.taxindicator,
+ 999999 AS line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ tt.name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ CASE
+ WHEN it.istaxincluded = 'Y' THEN it.taxamt
+ ELSE it.taxbaseamt
+ END AS priceactual,
+ CASE
+ WHEN it.istaxincluded = 'Y' THEN it.taxamt
+ ELSE it.taxbaseamt
+ END AS priceentered,
+ CASE
+ WHEN it.istaxincluded = 'Y' THEN NULL
+ ELSE it.taxamt
+ END AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+ FROM c_invoicetax it
+ JOIN c_tax_trl tt
+ ON it.c_tax_id = tt.c_tax_id
+;
+
+DROP VIEW m_inout_line_vt;
+
+CREATE OR REPLACE VIEW m_inout_line_vt
+AS
+ SELECT iol.ad_client_id,
+ iol.ad_org_id,
+ iol.isactive,
+ iol.created,
+ iol.createdby,
+ iol.updated,
+ iol.updatedby,
+ uomt.ad_language,
+ iol.m_inout_id,
+ iol.m_inoutline_id,
+ iol.line,
+ pt.m_product_id,
+ CASE
+ WHEN iol.movementqty <> 0
+ OR iol.m_product_id IS NOT NULL THEN iol.movementqty
+ ELSE NULL
+ END AS movementqty,
+ CASE
+ WHEN iol.qtyentered <> 0
+ OR iol.m_product_id IS NOT NULL THEN iol.qtyentered
+ ELSE NULL
+ END AS qtyentered,
+ CASE
+ WHEN iol.movementqty <> 0
+ OR iol.m_product_id IS NOT NULL THEN uomt.uomsymbol
+ ELSE NULL
+ END AS uomsymbol,
+ ol.qtyordered,
+ ol.qtydelivered,
+ CASE
+ WHEN iol.movementqty <> 0
+ OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered
+ ELSE NULL
+ END AS qtybackordered,
+ COALESCE(pt.name
+ || productattribute(iol.m_attributesetinstance_id), ct.name, iol.description) AS name,
+ CASE
+ WHEN COALESCE(ct.name, pt.name) IS NOT NULL THEN iol.description
+ ELSE NULL
+ END AS description,
+ pt.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,
+ iol.ad_orgtrx_id,
+ iol.c_charge_id,
+ iol.confirmedqty,
+ iol.c_orderline_id,
+ iol.c_uom_id AS m_inoutline_c_uom_id,
+ iol.isdescription AS m_inoutline_isdescription,
+ iol.isinvoiced,
+ iol.m_rmaline_id,
+ iol.pickedqty,
+ iol.processed AS m_inoutline_processed,
+ iol.ref_inoutline_id,
+ iol.reversalline_id,
+ iol.scrappedqty,
+ iol.targetqty,
+ iol.user1_id AS m_inoutline_user1_id,
+ iol.user2_id AS m_inoutline_user2_id,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.c_uom_id AS m_product_c_uom_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id AS m_product_m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ p.updated AS m_product_updated,
+ p.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby,
+ l.ad_org_id AS m_locator_ad_org_id,
+ l.isactive AS m_locator_isactive,
+ l.isdefault,
+ l.priorityno,
+ l.value AS m_locator_value,
+ ol.ad_org_id AS c_orderline_ad_org_id,
+ ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
+ ol.c_activity_id AS c_orderline_c_activity_id,
+ ol.c_bpartner_id AS c_orderline_c_bpartner_id,
+ ol.c_bpartner_location_id AS c_orderline_c_bp_location_id,
+ ol.c_charge_id AS c_orderline_c_charge_id,
+ ol.c_currency_id AS c_orderline_c_currency_id,
+ ol.c_order_id,
+ ol.c_project_id AS c_orderline_c_project_id,
+ ol.c_projectphase_id AS c_orderline_c_projectphase_id,
+ ol.c_projecttask_id AS c_orderline_c_projecttask_id,
+ ol.created AS c_orderline_created,
+ ol.createdby AS c_orderline_createdby,
+ ol.c_tax_id AS c_orderline_c_tax_id,
+ ol.c_uom_id AS c_orderline_c_uom_id,
+ ol.datedelivered,
+ ol.dateinvoiced,
+ ol.dateordered,
+ ol.datepromised AS c_orderline_datepromised,
+ ol.description AS c_orderline_description,
+ ol.discount,
+ ol.freightamt AS c_orderline_freightamt,
+ ol.isactive AS c_orderline_isactive,
+ ol.isdescription AS c_orderline_isdescription,
+ ol.line AS c_orderline_line,
+ ol.linenetamt,
+ ol.link_orderline_id,
+ ol.m_attributesetinstance_id AS c_orderline_m_asi_id,
+ ol.m_product_id AS c_orderline_m_product_id,
+ ol.m_promotion_id,
+ ol.m_shipper_id AS c_orderline_m_shipper_id,
+ ol.m_warehouse_id AS c_orderline_warehouse_id,
+ ol.priceactual,
+ ol.pricecost,
+ ol.priceentered,
+ ol.pricelimit,
+ ol.pricelist,
+ ol.processed AS c_orderline_processed,
+ ol.qtyentered AS c_orderline_qtyentered,
+ ol.qtyinvoiced,
+ ol.qtylostsales,
+ ol.qtyreserved,
+ ol.ref_orderline_id,
+ ol.rramt,
+ ol.rrstartdate,
+ ol.s_resourceassignment_id,
+ ol.updated AS c_orderline_updated,
+ ol.updatedby AS c_orderline_updatedby,
+ ol.user1_id AS c_orderline_user1_id,
+ ol.user2_id AS c_orderline_user2_id,
+ ct.ad_org_id AS c_charge_c_org_id,
+ c.c_bpartner_id AS c_charge_c_bpartner_id,
+ c.c_chargetype_id,
+ c.chargeamt AS c_charge_chargeamt,
+ c.c_taxcategory_id AS c_charge_c_taxcategory_id,
+ ct.description AS c_charge_description,
+ ct.isactive AS c_charge_isactive,
+ c.issamecurrency,
+ c.issametax,
+ c.istaxincluded AS c_charge_istaxincluded
+ FROM m_inoutline iol
+ JOIN c_uom uom
+ ON iol.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON iol.c_uom_id = uomt.c_uom_id
+ LEFT JOIN m_product p
+ ON iol.m_product_id = p.m_product_id
+ LEFT JOIN m_product_trl pt
+ ON iol.m_product_id = pt.m_product_id
+ AND uomt.ad_language = pt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ LEFT JOIN m_locator l
+ ON iol.m_locator_id = l.m_locator_id
+ LEFT JOIN c_orderline ol
+ ON iol.c_orderline_id = ol.c_orderline_id
+ LEFT JOIN c_charge c
+ ON iol.c_charge_id = c.c_charge_id
+ LEFT JOIN c_charge_trl ct
+ ON iol.c_charge_id = ct.c_charge_id
+ AND uomt.ad_language = ct.ad_language
+ UNION
+ SELECT iol.ad_client_id,
+ iol.ad_org_id,
+ iol.isactive,
+ iol.created,
+ iol.createdby,
+ iol.updated,
+ iol.updatedby,
+ uomt.ad_language,
+ iol.m_inout_id,
+ iol.m_inoutline_id,
+ iol.line + bl.line / 100 AS line,
+ pt.m_product_id,
+ CASE
+ WHEN bl.isqtypercentage = 'N' THEN iol.movementqty * bl.qtybom
+ ELSE iol.movementqty * ( bl.qtybatch / 100 )
+ END AS movementqty,
+ CASE
+ WHEN bl.isqtypercentage = 'N' THEN iol.qtyentered * bl.qtybom
+ ELSE iol.qtyentered * ( bl.qtybatch / 100 )
+ END AS qtyentered,
+ uomt.uomsymbol,
+ NULL AS qtyordered,
+ NULL AS qtydelivered,
+ NULL AS qtybackordered,
+ pt.name,
+ b.description,
+ pt.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,
+ iol.ad_orgtrx_id,
+ iol.c_charge_id,
+ iol.confirmedqty,
+ iol.c_orderline_id,
+ iol.c_uom_id AS m_inoutline_c_uom_id,
+ iol.isdescription AS m_inoutline_isdescription,
+ iol.isinvoiced,
+ iol.m_rmaline_id,
+ iol.pickedqty,
+ iol.processed AS m_inoutline_processed,
+ iol.ref_inoutline_id,
+ iol.reversalline_id,
+ iol.scrappedqty,
+ iol.targetqty,
+ iol.user1_id AS m_inoutline_user1_id,
+ iol.user2_id AS m_inoutline_user2_id,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.c_uom_id AS m_product_c_uom_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id AS m_product_m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ pt.updated AS m_product_updated,
+ pt.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby,
+ l.ad_org_id AS m_locator_ad_org_id,
+ l.isactive AS m_locator_isactive,
+ l.isdefault,
+ l.priorityno,
+ l.value AS m_locator_value,
+ NULL AS c_orderline_ad_org_id,
+ NULL AS c_orderline_ad_orgtrx_id,
+ NULL AS c_orderline_c_activity_id,
+ NULL AS c_orderline_c_bpartner_id,
+ NULL AS c_orderline_c_bp_location_id,
+ NULL AS c_orderline_c_charge_id,
+ NULL AS c_orderline_c_currency_id,
+ NULL AS c_order_id,
+ NULL AS c_orderline_c_project_id,
+ NULL AS c_orderline_c_projectphase_id,
+ NULL AS c_orderline_c_projecttask_id,
+ NULL AS c_orderline_created,
+ NULL AS c_orderline_createdby,
+ NULL AS c_orderline_c_tax_id,
+ NULL AS c_orderline_c_uom_id,
+ NULL AS datedelivered,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS c_orderline_datepromised,
+ NULL AS c_orderline_description,
+ NULL AS discount,
+ NULL AS c_orderline_freightamt,
+ NULL AS c_orderline_isactive,
+ NULL AS c_orderline_isdescription,
+ NULL AS c_orderline_line,
+ NULL AS linenetamt,
+ NULL AS link_orderline_id,
+ NULL AS c_orderline_m_asi_id,
+ NULL AS c_orderline_m_product_id,
+ NULL AS m_promotion_id,
+ NULL AS c_orderline_m_shipper_id,
+ NULL AS c_orderline_warehouse_id,
+ NULL AS priceactual,
+ NULL AS pricecost,
+ NULL AS priceentered,
+ NULL AS pricelimit,
+ NULL AS pricelist,
+ NULL AS c_orderline_processed,
+ NULL AS c_orderline_qtyentered,
+ NULL AS qtyinvoiced,
+ NULL AS qtylostsales,
+ NULL AS qtyreserved,
+ NULL AS ref_orderline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_orderline_updated,
+ NULL AS c_orderline_updatedby,
+ NULL AS c_orderline_user1_id,
+ NULL AS c_orderline_user2_id,
+ NULL AS c_charge_c_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded
+ FROM pp_product_bom b
+ JOIN m_inoutline iol
+ ON b.m_product_id = iol.m_product_id
+ JOIN m_product bp
+ ON bp.m_product_id = iol.m_product_id
+ AND bp.isbom = 'Y'
+ AND bp.isverified = 'Y'
+ AND bp.ispicklistprintdetails = 'Y'
+ JOIN pp_product_bomline bl
+ ON bl.pp_product_bom_id = b.pp_product_bom_id
+ JOIN m_product p
+ ON bl.m_product_id = p.m_product_id
+ JOIN c_uom uom
+ ON iol.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON p.c_uom_id = uomt.c_uom_id
+ JOIN m_product_trl pt
+ ON bl.m_product_id = pt.m_product_id
+ AND uomt.ad_language = pt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ LEFT JOIN m_locator l
+ ON iol.m_locator_id = l.m_locator_id
+;
+
+SELECT register_migration_script('201608061118_IDEMPIERE-3150.sql') FROM dual
+;
+
diff --git a/migration/i3.1/oracle/201608071251_IDEMPIERE-3153.sql b/migration/i3.1/oracle/201608071251_IDEMPIERE-3153.sql
new file mode 100644
index 0000000000..5016d46364
--- /dev/null
+++ b/migration/i3.1/oracle/201608071251_IDEMPIERE-3153.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3153 Allow negative BOM Product lines for co/by-products
+-- Aug 7, 2016 12:51:02 PM CEST
+UPDATE AD_Column SET ValueMin=NULL,Updated=TO_DATE('2016-08-07 12:51:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723
+;
+
+SELECT register_migration_script('201608071251_IDEMPIERE-3153.sql') FROM dual
+;
+
diff --git a/migration/i3.1/oracle/201608071350_IDEMPIERE-2065.sql b/migration/i3.1/oracle/201608071350_IDEMPIERE-2065.sql
new file mode 100644
index 0000000000..1c8dc0559a
--- /dev/null
+++ b/migration/i3.1/oracle/201608071350_IDEMPIERE-2065.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2065 flag Pay Schedule valid of invoice customer is not update in some case, make invoice not list in search when payment
+-- Aug 7, 2016 1:50:22 PM CEST
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2016-08-07 13:50:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10326
+;
+
+-- Aug 7, 2016 1:50:27 PM CEST
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2016-08-07 13:50:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60152
+;
+
+SELECT register_migration_script('201608071350_IDEMPIERE-2065.sql') FROM dual
+;
+
diff --git a/migration/i3.1/postgresql/201607281208_IDEMPIERE-2428.sql b/migration/i3.1/postgresql/201607281208_IDEMPIERE-2428.sql
new file mode 100644
index 0000000000..1c65485c86
--- /dev/null
+++ b/migration/i3.1/postgresql/201607281208_IDEMPIERE-2428.sql
@@ -0,0 +1,4 @@
+-- just for oracle
+
+SELECT register_migration_script('201607281208_IDEMPIERE-2428.sql') FROM dual
+;
diff --git a/migration/i3.1/postgresql/201608031225_IDEMPIERE-3146.sql b/migration/i3.1/postgresql/201608031225_IDEMPIERE-3146.sql
new file mode 100644
index 0000000000..63154b64ae
--- /dev/null
+++ b/migration/i3.1/postgresql/201608031225_IDEMPIERE-3146.sql
@@ -0,0 +1,8 @@
+-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
+-- Aug 3, 2016 12:25:05 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','{0} resolved multiple times = ({1})',0,0,'Y',TO_TIMESTAMP('2016-08-03 12:25:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2016-08-03 12:25:05','YYYY-MM-DD HH24:MI:SS'),100,200405,'ForeignMultipleResolved','D','3c350f49-c813-4ebc-ae1a-5d4b2fc76faa')
+;
+
+SELECT register_migration_script('201608031225_IDEMPIERE-3146.sql') FROM dual
+;
+
diff --git a/migration/i3.1/postgresql/201608061118_IDEMPIERE-3150.sql b/migration/i3.1/postgresql/201608061118_IDEMPIERE-3150.sql
new file mode 100644
index 0000000000..fd57662dd3
--- /dev/null
+++ b/migration/i3.1/postgresql/201608061118_IDEMPIERE-3150.sql
@@ -0,0 +1,1717 @@
+DROP VIEW c_invoice_linetax_vt;
+
+CREATE OR REPLACE VIEW c_invoice_linetax_vt AS
+ (
+ ( ( SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ uomt.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ il.c_tax_id,
+ il.taxamt,
+ il.linetotalamt,
+ tt.taxindicator,
+ il.line,
+ pt.m_product_id,
+ CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced ELSE NULL END AS qtyinvoiced,
+ CASE WHEN il.qtyentered <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyentered ELSE NULL END AS qtyentered,
+ CASE WHEN il.qtyentered <> 0 OR il.m_product_id IS NOT NULL THEN uomt.uomsymbol ELSE NULL END AS uomsymbol,
+ COALESCE(ct.name, (pt.name || COALESCE(productattribute(il.m_attributesetinstance_id), '')), il.description) AS name,
+ CASE WHEN COALESCE(ct.name, pt.name) IS NOT NULL THEN il.description ELSE NULL END AS description,
+ pt.documentnote,
+ p.upc,
+ p.sku,
+ COALESCE(pp.vendorproductno, p.value) AS productvalue,
+ ra.description AS resourcedescription,
+ CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist <> 0 THEN il.pricelist ELSE NULL END AS pricelist,
+ CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist <> 0 AND il.qtyentered <> 0 THEN il.pricelist * il.qtyinvoiced / il.qtyentered ELSE NULL END AS
+ priceenteredlist,
+ CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual AND il.pricelist <> 0 THEN (il.pricelist - il.priceactual) / il.pricelist * 100 ELSE NULL END
+ AS discount,
+ CASE WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual ELSE NULL END AS priceactual,
+ CASE WHEN il.priceentered <> 0 OR il.m_product_id IS NOT NULL THEN il.priceentered ELSE NULL END AS priceentered,
+ CASE WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt ELSE NULL END AS linenetamt,
+ il.m_attributesetinstance_id,
+ asi.m_attributeset_id,
+ asi.serno,
+ asi.lot,
+ asi.m_lot_id,
+ asi.guaranteedate,
+ pt.description AS productdescription,
+ p.imageurl,
+ il.c_campaign_id,
+ il.c_project_id,
+ il.c_activity_id,
+ il.c_projectphase_id,
+ il.c_projecttask_id,
+ il.ad_orgtrx_id AS c_invoiceline_ad_orgtrx_id,
+ il.a_processed,
+ il.c_charge_id,
+ il.c_orderline_id,
+ il.c_uom_id,
+ il.isdescription,
+ il.isprinted AS c_invoiceline_isprinted,
+ il.m_inoutline_id,
+ il.m_rmaline_id,
+ il.pricelimit,
+ il.processed AS c_invoiceline_processed,
+ il.ref_invoiceline_id,
+ il.rramt,
+ il.rrstartdate,
+ il.s_resourceassignment_id,
+ il.user1_id AS c_invoiceline_user1_id,
+ il.user2_id AS c_invoiceline_user2_id,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ i.ad_org_id AS c_invoice_ad_org_id,
+ i.ad_orgtrx_id AS c_invoice_ad_orgtrx_id,
+ i.ad_user_id AS c_invoice_ad_user_id,
+ i.c_activity_id AS c_invoice_c_activity_id,
+ i.c_bpartner_id AS c_invoice_c_bpartner_id,
+ i.c_bpartner_location_id,
+ i.c_campaign_id AS c_invoice_c_campaign_id,
+ i.c_charge_id AS c_invoice_c_charge_id,
+ i.c_conversiontype_id,
+ i.c_currency_id,
+ i.c_doctype_id,
+ i.c_doctypetarget_id,
+ i.c_dunninglevel_id,
+ i.chargeamt AS c_invoice_chargeamt,
+ i.c_order_id,
+ i.c_payment_id,
+ i.c_paymentterm_id,
+ i.c_project_id AS c_invoice_c_project_id,
+ i.created AS c_invoice_created,
+ i.createdby AS c_invoice_createdby,
+ i.dateacct,
+ i.dateinvoiced,
+ i.dateordered,
+ i.dateprinted,
+ i.description AS c_invoice_description,
+ i.docaction,
+ i.docstatus,
+ i.documentno,
+ i.dunninggrace,
+ i.generateto,
+ i.grandtotal,
+ i.invoicecollectiontype,
+ i.isactive AS c_invoice_isactive,
+ i.isapproved,
+ i.isdiscountprinted,
+ i.isindispute,
+ i.ispaid,
+ i.ispayschedulevalid,
+ i.isprinted AS c_invoice_isprinted,
+ i.isselfservice AS c_invoice_isselfservice,
+ i.issotrx,
+ i.istaxincluded AS c_invoice_istaxincluded,
+ i.istransferred,
+ i.m_pricelist_id,
+ i.m_rma_id,
+ i.paymentrule,
+ i.poreference,
+ i.posted,
+ i.processedon,
+ i.processing,
+ i.ref_invoice_id,
+ i.reversal_id,
+ i.salesrep_id,
+ i.sendemail,
+ i.totallines,
+ i.updated AS c_invoice_updated,
+ i.updatedby AS c_invoice_updatedby,
+ i.user1_id AS c_invoice_user1_id,
+ i.user2_id AS c_invoice_user2_id,
+ tt.ad_org_id AS c_tax_ad_org_id,
+ t.ad_rule_id,
+ t.c_country_id,
+ t.c_region_id,
+ t.c_taxcategory_id AS c_tax_c_taxcategory_id,
+ tt.description AS c_tax_description,
+ tt.isactive AS c_tax_isactive,
+ t.isdefault AS c_tax_isdefault,
+ t.isdocumentlevel,
+ t.issalestax,
+ t.issummary AS c_tax_issummary,
+ t.istaxexempt,
+ tt.name AS c_tax_name,
+ t.parent_tax_id,
+ t.rate,
+ t.requirestaxcertificate,
+ t.sopotype,
+ t.to_country_id,
+ t.to_region_id,
+ t.validfrom,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ pt.updated AS m_product_updated,
+ pt.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ ct.ad_org_id AS c_charge_ad_org_id,
+ c.c_bpartner_id AS c_charge_c_bpartner_id,
+ c.c_chargetype_id,
+ c.chargeamt AS c_charge_chargeamt,
+ c.c_taxcategory_id AS c_charge_c_taxcategory_id,
+ ct.description AS c_charge_description,
+ ct.isactive AS c_charge_isactive,
+ c.issamecurrency,
+ c.issametax,
+ c.istaxincluded AS c_charge_istaxincluded,
+ pp.ad_org_id AS c_bp_product_ad_org_id,
+ pp.c_bpartner_id AS c_bp_product_c_bpartner_id,
+ pp.created AS c_bp_product_created,
+ pp.createdby AS c_bp_product_createdby,
+ pp.description AS c_bp_product_description,
+ pp.isactive AS c_bp_product_isactive,
+ pp.ismanufacturer,
+ pp.manufacturer,
+ pp.qualityrating,
+ pp.shelflifemindays,
+ pp.shelflifeminpct,
+ pp.updated AS c_bp_product_updated,
+ pp.updatedby AS c_bp_product_updatedby,
+ pp.vendorcategory,
+ ra.ad_org_id AS s_rassignment_ad_org_id,
+ ra.assigndatefrom,
+ ra.assigndateto,
+ ra.created AS s_rassignment_created,
+ ra.createdby AS s_rassignment_createby,
+ ra.isactive AS s_rassignment_isactive,
+ ra.isconfirmed,
+ ra.name AS s_rassignment_name,
+ ra.qty AS s_rassignment_qty,
+ ra.s_resource_id AS s_rassignment_s_resource_id,
+ ra.updated AS s_rassignment_updated,
+ ra.updatedby AS s_rassignment_updatedby,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby
+ FROM c_invoiceline il
+ JOIN c_uom uom
+ ON il.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON il.c_uom_id = uomt.c_uom_id
+ JOIN c_invoice i
+ ON il.c_invoice_id = i.c_invoice_id
+ LEFT JOIN c_tax t
+ ON il.c_tax_id = t.c_tax_id
+ LEFT JOIN c_tax_trl tt
+ ON il.c_tax_id = tt.c_tax_id AND uomt.ad_language = tt.ad_language
+ LEFT JOIN m_product p
+ ON il.m_product_id = p.m_product_id
+ LEFT JOIN c_charge c
+ ON il.c_charge_id = c.c_charge_id
+ LEFT JOIN c_charge_trl ct
+ ON il.c_charge_id = ct.c_charge_id AND uomt.ad_language = ct.ad_language
+ LEFT JOIN c_bpartner_product pp
+ ON il.m_product_id = pp.m_product_id AND i.c_bpartner_id = pp.c_bpartner_id
+ LEFT JOIN m_product_trl pt
+ ON il.m_product_id = pt.m_product_id AND uomt.ad_language = pt.ad_language
+ LEFT JOIN s_resourceassignment ra
+ ON il.s_resourceassignment_id = ra.s_resourceassignment_id
+ LEFT JOIN m_attributesetinstance asi
+ ON il.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ UNION /* BOM lines */ SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ uomt.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ il.c_tax_id,
+ il.taxamt,
+ il.linetotalamt,
+ tt.taxindicator,
+ il.line + bl.line / 100 AS line,
+ pt.m_product_id,
+ CASE WHEN bl.isqtypercentage = 'N' THEN il.qtyinvoiced * bl.qtybom ELSE il.qtyinvoiced * (bl.qtybatch / 100) END AS qtyinvoiced,
+ CASE WHEN bl.isqtypercentage = 'N' THEN il.qtyentered * bl.qtybom ELSE il.qtyentered * (bl.qtybatch / 100) END AS qtyentered,
+ uomt.uomsymbol,
+ COALESCE(pt.name, p.name) AS name,
+ b.description,
+ COALESCE(pt.documentnote, p.documentnote) AS documentnote,
+ p.upc,
+ p.sku,
+ p.value AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ il.m_attributesetinstance_id,
+ asi.m_attributeset_id,
+ asi.serno,
+ asi.lot,
+ asi.m_lot_id,
+ asi.guaranteedate,
+ pt.description AS productdescription,
+ p.imageurl,
+ il.c_campaign_id,
+ il.c_project_id,
+ il.c_activity_id,
+ il.c_projectphase_id,
+ il.c_projecttask_id,
+ il.ad_orgtrx_id AS c_invoiceline_ad_orgtrx_id,
+ il.a_processed,
+ il.c_charge_id,
+ il.c_orderline_id,
+ il.c_uom_id,
+ il.isdescription,
+ il.isprinted AS c_invoiceline_isprinted,
+ il.m_inoutline_id,
+ il.m_rmaline_id,
+ il.pricelimit,
+ il.processed AS c_invoiceline_processed,
+ il.ref_invoiceline_id,
+ il.rramt,
+ il.rrstartdate,
+ il.s_resourceassignment_id,
+ il.user1_id AS c_invoiceline_user1_id,
+ il.user2_id AS c_invoiceline_user2_id,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ tt.ad_org_id AS c_tax_ad_org_id,
+ t.ad_rule_id,
+ t.c_country_id,
+ t.c_region_id,
+ t.c_taxcategory_id AS c_tax_c_taxcategory_id,
+ tt.description AS c_tax_description,
+ tt.isactive AS c_tax_isactive,
+ t.isdefault AS c_tax_isdefault,
+ t.isdocumentlevel,
+ t.issalestax,
+ t.issummary AS c_tax_issummary,
+ t.istaxexempt,
+ tt.name AS c_tax_name,
+ t.parent_tax_id,
+ t.rate,
+ t.requirestaxcertificate,
+ t.sopotype,
+ t.to_country_id,
+ t.to_region_id,
+ t.validfrom,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ p.updated AS m_product_updated,
+ p.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby
+ FROM pp_product_bom b
+ JOIN c_invoiceline il
+ ON b.m_product_id = il.m_product_id
+ JOIN m_product bp
+ ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
+ JOIN pp_product_bomline bl
+ ON bl.pp_product_bom_id = b.pp_product_bom_id
+ JOIN m_product p
+ ON bl.m_product_id = p.m_product_id
+ JOIN c_uom uom
+ ON p.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON p.c_uom_id = uomt.c_uom_id
+ JOIN m_product_trl pt
+ ON bl.m_product_id = pt.m_product_id AND uomt.ad_language = pt.ad_language
+ LEFT JOIN c_tax t
+ ON il.c_tax_id = t.c_tax_id
+ LEFT JOIN c_tax_trl tt
+ ON il.c_tax_id = tt.c_tax_id AND uomt.ad_language = tt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON il.m_attributesetinstance_id = asi.m_attributesetinstance_id)
+ UNION /* comment lines */ SELECT il.ad_client_id,
+ il.ad_org_id,
+ il.isactive,
+ il.created,
+ il.createdby,
+ il.updated,
+ il.updatedby,
+ l.ad_language,
+ il.c_invoice_id,
+ il.c_invoiceline_id,
+ NULL AS c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ NULL AS taxindicator,
+ il.line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ il.description AS name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+ FROM c_invoiceline il,
+ ad_language l
+ WHERE il.c_uom_id IS NULL AND l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
+ UNION /* empty line */ SELECT i.ad_client_id,
+ i.ad_org_id,
+ i.isactive,
+ i.created,
+ i.createdby,
+ i.updated,
+ i.updatedby,
+ l.ad_language,
+ i.c_invoice_id,
+ NULL AS c_invoiceline_id,
+ NULL AS c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ NULL AS taxindicator,
+ 999998 AS line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ NULL AS name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ NULL AS priceactual,
+ NULL AS priceentered,
+ NULL AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+ FROM c_invoice i,
+ ad_language l
+ WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y'
+ )
+UNION
+SELECT /* tax lines */ it.ad_client_id,
+ it.ad_org_id,
+ it.isactive,
+ it.created,
+ it.createdby,
+ it.updated,
+ it.updatedby,
+ tt.ad_language,
+ it.c_invoice_id,
+ NULL AS c_invoiceline_id,
+ it.c_tax_id,
+ NULL AS taxamt,
+ NULL AS linetotalamt,
+ tt.taxindicator,
+ 999999 AS line,
+ NULL AS m_product_id,
+ NULL AS qtyinvoiced,
+ NULL AS qtyentered,
+ NULL AS uomsymbol,
+ tt.name,
+ NULL AS description,
+ NULL AS documentnote,
+ NULL AS upc,
+ NULL AS sku,
+ NULL AS productvalue,
+ NULL AS resourcedescription,
+ NULL AS pricelist,
+ NULL AS priceenteredlist,
+ NULL AS discount,
+ CASE WHEN it.istaxincluded = 'Y' THEN it.taxamt ELSE it.taxbaseamt END AS priceactual,
+ CASE WHEN it.istaxincluded = 'Y' THEN it.taxamt ELSE it.taxbaseamt END AS priceentered,
+ CASE WHEN it.istaxincluded = 'Y' THEN NULL ELSE it.taxamt END AS linenetamt,
+ NULL AS m_attributesetinstance_id,
+ NULL AS m_attributeset_id,
+ NULL AS serno,
+ NULL AS lot,
+ NULL AS m_lot_id,
+ NULL AS guaranteedate,
+ NULL AS productdescription,
+ NULL AS imageurl,
+ NULL AS c_campaign_id,
+ NULL AS c_project_id,
+ NULL AS c_activity_id,
+ NULL AS c_projectphase_id,
+ NULL AS c_projecttask_id,
+ NULL AS c_invoiceline_ad_orgtrx_id,
+ NULL AS a_processed,
+ NULL AS c_charge_id,
+ NULL AS c_orderline_id,
+ NULL AS c_uom_id,
+ NULL AS isdescription,
+ NULL AS c_invoiceline_isprinted,
+ NULL AS m_inoutline_id,
+ NULL AS m_rmaline_id,
+ NULL AS pricelimit,
+ NULL AS c_invoiceline_processed,
+ NULL AS ref_invoiceline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_invoiceline_user1_id,
+ NULL AS c_invoiceline_user2_id,
+ NULL AS c_uom_ad_org_id,
+ NULL AS costingprecision,
+ NULL AS c_uom_description,
+ NULL AS c_uom_isactive,
+ NULL AS c_uom_isdefault,
+ NULL AS c_uom_name,
+ NULL AS stdprecision,
+ NULL AS uomtype,
+ NULL AS x12de355,
+ NULL AS c_invoice_ad_org_id,
+ NULL AS c_invoice_ad_orgtrx_id,
+ NULL AS c_invoice_ad_user_id,
+ NULL AS c_invoice_c_activity_id,
+ NULL AS c_invoice_c_bpartner_id,
+ NULL AS c_bpartner_location_id,
+ NULL AS c_invoice_c_campaign_id,
+ NULL AS c_invoice_c_charge_id,
+ NULL AS c_conversiontype_id,
+ NULL AS c_currency_id,
+ NULL AS c_doctype_id,
+ NULL AS c_doctypetarget_id,
+ NULL AS c_dunninglevel_id,
+ NULL AS c_invoice_chargeamt,
+ NULL AS c_order_id,
+ NULL AS c_payment_id,
+ NULL AS c_paymentterm_id,
+ NULL AS c_invoice_c_project_id,
+ NULL AS c_invoice_created,
+ NULL AS c_invoice_createdby,
+ NULL AS dateacct,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS dateprinted,
+ NULL AS c_invoice_description,
+ NULL AS docaction,
+ NULL AS docstatus,
+ NULL AS documentno,
+ NULL AS dunninggrace,
+ NULL AS generateto,
+ NULL AS grandtotal,
+ NULL AS invoicecollectiontype,
+ NULL AS c_invoice_isactive,
+ NULL AS isapproved,
+ NULL AS isdiscountprinted,
+ NULL AS isindispute,
+ NULL AS ispaid,
+ NULL AS ispayschedulevalid,
+ NULL AS c_invoice_isprinted,
+ NULL AS c_invoice_isselfservice,
+ NULL AS issotrx,
+ NULL AS c_invoice_istaxincluded,
+ NULL AS istransferred,
+ NULL AS m_pricelist_id,
+ NULL AS m_rma_id,
+ NULL AS paymentrule,
+ NULL AS poreference,
+ NULL AS posted,
+ NULL AS processedon,
+ NULL AS processing,
+ NULL AS ref_invoice_id,
+ NULL AS reversal_id,
+ NULL AS salesrep_id,
+ NULL AS sendemail,
+ NULL AS totallines,
+ NULL AS c_invoice_updated,
+ NULL AS c_invoice_updatedby,
+ NULL AS c_invoice_user1_id,
+ NULL AS c_invoice_user2_id,
+ NULL AS c_tax_ad_org_id,
+ NULL AS ad_rule_id,
+ NULL AS c_country_id,
+ NULL AS c_region_id,
+ NULL AS c_tax_c_taxcategory_id,
+ NULL AS c_tax_description,
+ NULL AS c_tax_isactive,
+ NULL AS c_tax_isdefault,
+ NULL AS isdocumentlevel,
+ NULL AS issalestax,
+ NULL AS c_tax_issummary,
+ NULL AS istaxexempt,
+ NULL AS c_tax_name,
+ NULL AS parent_tax_id,
+ NULL AS rate,
+ NULL AS requirestaxcertificate,
+ NULL AS sopotype,
+ NULL AS to_country_id,
+ NULL AS to_region_id,
+ NULL AS validfrom,
+ NULL AS m_product_ad_org_id,
+ NULL AS classification,
+ NULL AS m_product_copyfrom,
+ NULL AS m_product_created,
+ NULL AS m_product_createdby,
+ NULL AS c_revenuerecognition_id,
+ NULL AS c_subscriptiontype_id,
+ NULL AS m_product_c_taxcategory_id,
+ NULL AS descriptionurl,
+ NULL AS discontinued,
+ NULL AS discontinuedat,
+ NULL AS group1,
+ NULL AS group2,
+ NULL AS guaranteedays,
+ NULL AS guaranteedaysmin,
+ NULL AS help,
+ NULL AS m_product_isactive,
+ NULL AS isbom,
+ NULL AS isdropship,
+ NULL AS isexcludeautodelivery,
+ NULL AS isinvoiceprintdetails,
+ NULL AS ispicklistprintdetails,
+ NULL AS ispurchased,
+ NULL AS m_product_isselfservice,
+ NULL AS issold,
+ NULL AS isstocked,
+ NULL AS m_product_issummary,
+ NULL AS isverified,
+ NULL AS iswebstorefeatured,
+ NULL AS lowlevel,
+ NULL AS m_product_m_attributeset_id,
+ NULL AS m_product_m_asi_id,
+ NULL AS m_freightcategory_id,
+ NULL AS m_locator_id,
+ NULL AS m_product_m_prod_category_id,
+ NULL AS m_product_processing,
+ NULL AS producttype,
+ NULL AS r_mailtext_id,
+ NULL AS m_product_salesrep_id,
+ NULL AS s_expensetype_id,
+ NULL AS shelfdepth,
+ NULL AS shelfheight,
+ NULL AS shelfwidth,
+ NULL AS m_product_s_resource_id,
+ NULL AS unitsperpack,
+ NULL AS unitsperpallet,
+ NULL AS m_product_updated,
+ NULL AS m_product_updatedby,
+ NULL AS versionno,
+ NULL AS volume,
+ NULL AS weight,
+ NULL AS c_charge_ad_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded,
+ NULL AS c_bp_product_ad_org_id,
+ NULL AS c_bp_product_c_bpartner_id,
+ NULL AS c_bp_product_created,
+ NULL AS c_bp_product_createdby,
+ NULL AS c_bp_product_description,
+ NULL AS c_bp_product_isactive,
+ NULL AS ismanufacturer,
+ NULL AS manufacturer,
+ NULL AS qualityrating,
+ NULL AS shelflifemindays,
+ NULL AS shelflifeminpct,
+ NULL AS c_bp_product_updated,
+ NULL AS c_bp_product_updatedby,
+ NULL AS vendorcategory,
+ NULL AS s_rassignment_ad_org_id,
+ NULL AS assigndatefrom,
+ NULL AS assigndateto,
+ NULL AS s_rassignment_created,
+ NULL AS s_rassignment_createby,
+ NULL AS s_rassignment_isactive,
+ NULL AS isconfirmed,
+ NULL AS s_rassignment_name,
+ NULL AS s_rassignment_qty,
+ NULL AS s_rassignment_s_resource_id,
+ NULL AS s_rassignment_updated,
+ NULL AS s_rassignment_updatedby,
+ NULL AS m_asi_ad_org_id,
+ NULL AS m_asi_created,
+ NULL AS m_asi_createdby,
+ NULL AS m_asi_description,
+ NULL AS m_asi_isactive,
+ NULL AS m_asi_updated,
+ NULL AS m_asi_updatedby
+FROM c_invoicetax it
+ JOIN c_tax_trl tt
+ ON it.c_tax_id = tt.c_tax_id
+;
+
+DROP VIEW m_inout_line_vt;
+
+CREATE OR REPLACE VIEW m_inout_line_vt AS
+SELECT iol.ad_client_id,
+ iol.ad_org_id,
+ iol.isactive,
+ iol.created,
+ iol.createdby,
+ iol.updated,
+ iol.updatedby,
+ uomt.ad_language,
+ iol.m_inout_id,
+ iol.m_inoutline_id,
+ iol.line,
+ pt.m_product_id,
+ CASE WHEN iol.movementqty <> 0 OR iol.m_product_id IS NOT NULL THEN iol.movementqty ELSE NULL END AS
+ movementqty,
+ CASE WHEN iol.qtyentered <> 0 OR iol.m_product_id IS NOT NULL THEN iol.qtyentered ELSE NULL END AS qtyentered
+ ,
+ CASE WHEN iol.movementqty <> 0 OR iol.m_product_id IS NOT NULL THEN uomt.uomsymbol ELSE NULL END AS uomsymbol
+ ,
+ ol.qtyordered,
+ ol.qtydelivered,
+ CASE WHEN iol.movementqty <> 0 OR iol.m_product_id IS NOT NULL THEN ol.qtyordered - ol.qtydelivered ELSE NULL END
+ AS qtybackordered,
+ COALESCE(pt.name || productattribute(iol.m_attributesetinstance_id), ct.name, iol.description) AS name,
+ CASE WHEN COALESCE(ct.name, pt.name) IS NOT NULL THEN iol.description ELSE NULL END AS description,
+ pt.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,
+ iol.ad_orgtrx_id,
+ iol.c_charge_id,
+ iol.confirmedqty,
+ iol.c_orderline_id,
+ iol.c_uom_id AS m_inoutline_c_uom_id,
+ iol.isdescription AS m_inoutline_isdescription,
+ iol.isinvoiced,
+ iol.m_rmaline_id,
+ iol.pickedqty,
+ iol.processed AS m_inoutline_processed,
+ iol.ref_inoutline_id,
+ iol.reversalline_id,
+ iol.scrappedqty,
+ iol.targetqty,
+ iol.user1_id AS m_inoutline_user1_id,
+ iol.user2_id AS m_inoutline_user2_id,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.c_uom_id AS m_product_c_uom_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id AS m_product_m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ p.updated AS m_product_updated,
+ p.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby,
+ l.ad_org_id AS m_locator_ad_org_id,
+ l.isactive AS m_locator_isactive,
+ l.isdefault,
+ l.priorityno,
+ l.value AS m_locator_value,
+ ol.ad_org_id AS c_orderline_ad_org_id,
+ ol.ad_orgtrx_id AS c_orderline_ad_orgtrx_id,
+ ol.c_activity_id AS c_orderline_c_activity_id,
+ ol.c_bpartner_id AS c_orderline_c_bpartner_id,
+ ol.c_bpartner_location_id AS c_orderline_c_bp_location_id,
+ ol.c_charge_id AS c_orderline_c_charge_id,
+ ol.c_currency_id AS c_orderline_c_currency_id,
+ ol.c_order_id,
+ ol.c_project_id AS c_orderline_c_project_id,
+ ol.c_projectphase_id AS c_orderline_c_projectphase_id,
+ ol.c_projecttask_id AS c_orderline_c_projecttask_id,
+ ol.created AS c_orderline_created,
+ ol.createdby AS c_orderline_createdby,
+ ol.c_tax_id AS c_orderline_c_tax_id,
+ ol.c_uom_id AS c_orderline_c_uom_id,
+ ol.datedelivered,
+ ol.dateinvoiced,
+ ol.dateordered,
+ ol.datepromised AS c_orderline_datepromised,
+ ol.description AS c_orderline_description,
+ ol.discount,
+ ol.freightamt AS c_orderline_freightamt,
+ ol.isactive AS c_orderline_isactive,
+ ol.isdescription AS c_orderline_isdescription,
+ ol.line AS c_orderline_line,
+ ol.linenetamt,
+ ol.link_orderline_id,
+ ol.m_attributesetinstance_id AS c_orderline_m_asi_id,
+ ol.m_product_id AS c_orderline_m_product_id,
+ ol.m_promotion_id,
+ ol.m_shipper_id AS c_orderline_m_shipper_id,
+ ol.m_warehouse_id AS c_orderline_warehouse_id,
+ ol.priceactual,
+ ol.pricecost,
+ ol.priceentered,
+ ol.pricelimit,
+ ol.pricelist,
+ ol.processed AS c_orderline_processed,
+ ol.qtyentered AS c_orderline_qtyentered,
+ ol.qtyinvoiced,
+ ol.qtylostsales,
+ ol.qtyreserved,
+ ol.ref_orderline_id,
+ ol.rramt,
+ ol.rrstartdate,
+ ol.s_resourceassignment_id,
+ ol.updated AS c_orderline_updated,
+ ol.updatedby AS c_orderline_updatedby,
+ ol.user1_id AS c_orderline_user1_id,
+ ol.user2_id AS c_orderline_user2_id,
+ ct.ad_org_id AS c_charge_c_org_id,
+ c.c_bpartner_id AS c_charge_c_bpartner_id,
+ c.c_chargetype_id,
+ c.chargeamt AS c_charge_chargeamt,
+ c.c_taxcategory_id AS c_charge_c_taxcategory_id,
+ ct.description AS c_charge_description,
+ ct.isactive AS c_charge_isactive,
+ c.issamecurrency,
+ c.issametax,
+ c.istaxincluded AS c_charge_istaxincluded
+FROM m_inoutline iol
+ JOIN c_uom uom
+ ON iol.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON iol.c_uom_id = uomt.c_uom_id
+ LEFT JOIN m_product p
+ ON iol.m_product_id = p.m_product_id
+ LEFT JOIN m_product_trl pt
+ ON iol.m_product_id = pt.m_product_id AND uomt.ad_language = pt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ LEFT JOIN m_locator l
+ ON iol.m_locator_id = l.m_locator_id
+ LEFT JOIN c_orderline ol
+ ON iol.c_orderline_id = ol.c_orderline_id
+ LEFT JOIN c_charge c
+ ON iol.c_charge_id = c.c_charge_id
+ LEFT JOIN c_charge_trl ct
+ ON iol.c_charge_id = ct.c_charge_id AND uomt.ad_language = ct.ad_language
+ UNION SELECT iol.ad_client_id,
+ iol.ad_org_id,
+ iol.isactive,
+ iol.created,
+ iol.createdby,
+ iol.updated,
+ iol.updatedby,
+ uomt.ad_language,
+ iol.m_inout_id,
+ iol.m_inoutline_id,
+ iol.line + bl.line / 100 AS line,
+ pt.m_product_id,
+ CASE WHEN bl.isqtypercentage = 'N' THEN iol.movementqty * bl.qtybom ELSE iol.movementqty * (bl.qtybatch / 100) END AS movementqty,
+ CASE WHEN bl.isqtypercentage = 'N' THEN iol.qtyentered * bl.qtybom ELSE iol.qtyentered * (bl.qtybatch / 100) END AS qtyentered,
+ uomt.uomsymbol,
+ NULL AS qtyordered,
+ NULL AS qtydelivered,
+ NULL AS qtybackordered,
+ pt.name,
+ b.description,
+ pt.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,
+ iol.ad_orgtrx_id,
+ iol.c_charge_id,
+ iol.confirmedqty,
+ iol.c_orderline_id,
+ iol.c_uom_id AS m_inoutline_c_uom_id,
+ iol.isdescription AS m_inoutline_isdescription,
+ iol.isinvoiced,
+ iol.m_rmaline_id,
+ iol.pickedqty,
+ iol.processed AS m_inoutline_processed,
+ iol.ref_inoutline_id,
+ iol.reversalline_id,
+ iol.scrappedqty,
+ iol.targetqty,
+ iol.user1_id AS m_inoutline_user1_id,
+ iol.user2_id AS m_inoutline_user2_id,
+ pt.ad_org_id AS m_product_ad_org_id,
+ p.classification,
+ p.copyfrom AS m_product_copyfrom,
+ pt.created AS m_product_created,
+ pt.createdby AS m_product_createdby,
+ p.c_revenuerecognition_id,
+ p.c_subscriptiontype_id,
+ p.c_taxcategory_id AS m_product_c_taxcategory_id,
+ p.c_uom_id AS m_product_c_uom_id,
+ p.descriptionurl,
+ p.discontinued,
+ p.discontinuedat,
+ p.group1,
+ p.group2,
+ p.guaranteedays,
+ p.guaranteedaysmin,
+ p.help,
+ pt.isactive AS m_product_isactive,
+ p.isbom,
+ p.isdropship,
+ p.isexcludeautodelivery,
+ p.isinvoiceprintdetails,
+ p.ispicklistprintdetails,
+ p.ispurchased,
+ p.isselfservice AS m_product_isselfservice,
+ p.issold,
+ p.isstocked,
+ p.issummary AS m_product_issummary,
+ p.isverified,
+ p.iswebstorefeatured,
+ p.lowlevel,
+ p.m_attributeset_id AS m_product_m_attributeset_id,
+ p.m_attributesetinstance_id AS m_product_m_asi_id,
+ p.m_freightcategory_id,
+ p.m_locator_id AS m_product_m_locator_id,
+ p.m_product_category_id AS m_product_m_prod_category_id,
+ p.processing AS m_product_processing,
+ p.producttype,
+ p.r_mailtext_id,
+ p.salesrep_id AS m_product_salesrep_id,
+ p.s_expensetype_id,
+ p.shelfdepth,
+ p.shelfheight,
+ p.shelfwidth,
+ p.s_resource_id AS m_product_s_resource_id,
+ p.unitsperpack,
+ p.unitsperpallet,
+ pt.updated AS m_product_updated,
+ pt.updatedby AS m_product_updatedby,
+ p.versionno,
+ p.volume,
+ p.weight,
+ uomt.ad_org_id AS c_uom_ad_org_id,
+ uom.costingprecision,
+ uomt.description AS c_uom_description,
+ uomt.isactive AS c_uom_isactive,
+ uom.isdefault AS c_uom_isdefault,
+ uomt.name AS c_uom_name,
+ uom.stdprecision,
+ uom.uomtype,
+ uom.x12de355,
+ asi.ad_org_id AS m_asi_ad_org_id,
+ asi.created AS m_asi_created,
+ asi.createdby AS m_asi_createdby,
+ asi.description AS m_asi_description,
+ asi.isactive AS m_asi_isactive,
+ asi.updated AS m_asi_updated,
+ asi.updatedby AS m_asi_updatedby,
+ l.ad_org_id AS m_locator_ad_org_id,
+ l.isactive AS m_locator_isactive,
+ l.isdefault,
+ l.priorityno,
+ l.value AS m_locator_value,
+ NULL AS c_orderline_ad_org_id,
+ NULL AS c_orderline_ad_orgtrx_id,
+ NULL AS c_orderline_c_activity_id,
+ NULL AS c_orderline_c_bpartner_id,
+ NULL AS c_orderline_c_bp_location_id,
+ NULL AS c_orderline_c_charge_id,
+ NULL AS c_orderline_c_currency_id,
+ NULL AS c_order_id,
+ NULL AS c_orderline_c_project_id,
+ NULL AS c_orderline_c_projectphase_id,
+ NULL AS c_orderline_c_projecttask_id,
+ NULL AS c_orderline_created,
+ NULL AS c_orderline_createdby,
+ NULL AS c_orderline_c_tax_id,
+ NULL AS c_orderline_c_uom_id,
+ NULL AS datedelivered,
+ NULL AS dateinvoiced,
+ NULL AS dateordered,
+ NULL AS c_orderline_datepromised,
+ NULL AS c_orderline_description,
+ NULL AS discount,
+ NULL AS c_orderline_freightamt,
+ NULL AS c_orderline_isactive,
+ NULL AS c_orderline_isdescription,
+ NULL AS c_orderline_line,
+ NULL AS linenetamt,
+ NULL AS link_orderline_id,
+ NULL AS c_orderline_m_asi_id,
+ NULL AS c_orderline_m_product_id,
+ NULL AS m_promotion_id,
+ NULL AS c_orderline_m_shipper_id,
+ NULL AS c_orderline_warehouse_id,
+ NULL AS priceactual,
+ NULL AS pricecost,
+ NULL AS priceentered,
+ NULL AS pricelimit,
+ NULL AS pricelist,
+ NULL AS c_orderline_processed,
+ NULL AS c_orderline_qtyentered,
+ NULL AS qtyinvoiced,
+ NULL AS qtylostsales,
+ NULL AS qtyreserved,
+ NULL AS ref_orderline_id,
+ NULL AS rramt,
+ NULL AS rrstartdate,
+ NULL AS s_resourceassignment_id,
+ NULL AS c_orderline_updated,
+ NULL AS c_orderline_updatedby,
+ NULL AS c_orderline_user1_id,
+ NULL AS c_orderline_user2_id,
+ NULL AS c_charge_c_org_id,
+ NULL AS c_charge_c_bpartner_id,
+ NULL AS c_chargetype_id,
+ NULL AS c_charge_chargeamt,
+ NULL AS c_charge_c_taxcategory_id,
+ NULL AS c_charge_description,
+ NULL AS c_charge_isactive,
+ NULL AS issamecurrency,
+ NULL AS issametax,
+ NULL AS c_charge_istaxincluded
+ FROM pp_product_bom b
+ JOIN m_inoutline iol
+ ON b.m_product_id = iol.m_product_id
+ JOIN m_product bp
+ ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y'
+ JOIN pp_product_bomline bl
+ ON bl.pp_product_bom_id = b.pp_product_bom_id
+ JOIN m_product p
+ ON bl.m_product_id = p.m_product_id
+ JOIN c_uom uom
+ ON iol.c_uom_id = uom.c_uom_id
+ JOIN c_uom_trl uomt
+ ON p.c_uom_id = uomt.c_uom_id
+ JOIN m_product_trl pt
+ ON bl.m_product_id = pt.m_product_id AND uomt.ad_language = pt.ad_language
+ LEFT JOIN m_attributesetinstance asi
+ ON iol.m_attributesetinstance_id = asi.m_attributesetinstance_id
+ LEFT JOIN m_locator l
+ ON iol.m_locator_id = l.m_locator_id
+;
+
+SELECT register_migration_script('201608061118_IDEMPIERE-3150.sql') FROM dual
+;
+
diff --git a/migration/i3.1/postgresql/201608071251_IDEMPIERE-3153.sql b/migration/i3.1/postgresql/201608071251_IDEMPIERE-3153.sql
new file mode 100644
index 0000000000..510eb65f48
--- /dev/null
+++ b/migration/i3.1/postgresql/201608071251_IDEMPIERE-3153.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-3153 Allow negative BOM Product lines for co/by-products
+-- Aug 7, 2016 12:51:02 PM CEST
+UPDATE AD_Column SET ValueMin=NULL,Updated=TO_TIMESTAMP('2016-08-07 12:51:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723
+;
+
+SELECT register_migration_script('201608071251_IDEMPIERE-3153.sql') FROM dual
+;
+
diff --git a/migration/i3.1/postgresql/201608071350_IDEMPIERE-2065.sql b/migration/i3.1/postgresql/201608071350_IDEMPIERE-2065.sql
new file mode 100644
index 0000000000..7e73773864
--- /dev/null
+++ b/migration/i3.1/postgresql/201608071350_IDEMPIERE-2065.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-2065 flag Pay Schedule valid of invoice customer is not update in some case, make invoice not list in search when payment
+-- Aug 7, 2016 1:50:22 PM CEST
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2016-08-07 13:50:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10326
+;
+
+-- Aug 7, 2016 1:50:27 PM CEST
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2016-08-07 13:50:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60152
+;
+
+SELECT register_migration_script('201608071350_IDEMPIERE-2065.sql') FROM dual
+;
+
diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
index e6904bddf8..e392f20682 100644
--- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
+++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
@@ -958,7 +958,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if(idS == null && id < 0){
//it could be that record still doesn't exist if import mode is inserting or merging
if(isUpdateMode())
- return new StringBuilder(Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value}));
+ return new StringBuilder(Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{header.get(i),value}));
}
} else {
// no validation here
@@ -1016,8 +1016,9 @@ public class GridTabCSVImporter implements IGridTabImporter
if(isForeing && !"(null)".equals(value)){
String foreignTable = columnName.substring(0,columnName.length()-3);
- if(resolveForeign(foreignTable,foreignColumn,value,null) < 0)
- return new StringBuilder(Msg.getMsg(Env.getCtx(), "ForeignNotResolved" ,new Object[]{header.get(j),value}));
+ int id = resolveForeign(foreignTable,foreignColumn,value,null);
+ if (id < 0)
+ return new StringBuilder(Msg.getMsg(Env.getCtx(), id==-2?"ForeignMultipleResolved":"ForeignNotResolved" ,new Object[]{header.get(j),value}));
}
isEmptyRow=false;
}
@@ -1118,7 +1119,7 @@ public class GridTabCSVImporter implements IGridTabImporter
id = resolveForeign(foreignTable,foreignColumn,value,trx);
if(idS == null && id < 0)
- return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
+ return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{header.get(i),value});
if(id >= 0)
logMsg = gridTab.setValue(field,id);
@@ -1160,9 +1161,9 @@ public class GridTabCSVImporter implements IGridTabImporter
} else {
int id = resolveForeign(foreignTable, foreignColumn, value,trx);
- if(id < 0)
- return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
-
+ if (id < 0)
+ return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{header.get(i),value});
+
setValue = id;
if (field.isParentValue()) {
int actualId = (Integer) field.getValue();
@@ -1278,8 +1279,8 @@ public class GridTabCSVImporter implements IGridTabImporter
setValue = idS;
} else {
int id = resolveForeign(foreignTable, foreignColumn, setValue,trx);
- if(id < 0)
- return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{columnName,setValue});
+ if (id < 0)
+ return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{columnName,setValue});
setValue = id;
}
@@ -1452,22 +1453,40 @@ public class GridTabCSVImporter implements IGridTabImporter
private int resolveForeign(String foreignTable, String foreignColumn, Object value,Trx trx) {
int id = -1;
- String trxName = (trx!=null?trx.getTrxName():null);
- StringBuilder select = new StringBuilder("SELECT ")
- .append(foreignTable).append("_ID FROM ")
- .append(foreignTable).append(" WHERE ")
- .append(foreignColumn).append("=? AND IsActive='Y' AND AD_Client_ID=?");
- id = DB.getSQLValueEx(trxName, select.toString(), value, Env.getAD_Client_ID(Env.getCtx()));
- if (id == -1 && !"AD_Client".equals(foreignTable)) {
+
+ boolean systemAccess = false;
+ if (!"AD_Client".equals(foreignTable)) {
MTable ft = MTable.get(Env.getCtx(), foreignTable);
String accessLevel = ft.getAccessLevel();
if ( MTable.ACCESSLEVEL_All.equals(accessLevel)
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|| MTable.ACCESSLEVEL_SystemPlusClient.equals(accessLevel)) {
- // try System client if the table has System access
- id = DB.getSQLValueEx(trxName, select.toString(), value, 0);
+ systemAccess = true;
}
}
+
+ String trxName = (trx!=null?trx.getTrxName():null);
+
+ StringBuilder postSelect = new StringBuilder(" FROM ")
+ .append(foreignTable).append(" WHERE ")
+ .append(foreignColumn).append("=? AND IsActive='Y' AND AD_Client_ID");
+ if (systemAccess) {
+ postSelect.append(" IN (0,?)");
+ } else {
+ postSelect.append("=?");
+ }
+
+ StringBuilder selectCount = new StringBuilder("SELECT COUNT(*)").append(postSelect);
+ int count = DB.getSQLValueEx(trxName, selectCount.toString(), value, Env.getAD_Client_ID(Env.getCtx()));
+ if (count == 1) { // single value found, OK
+ StringBuilder selectId = new StringBuilder("SELECT ").append(foreignTable).append("_ID").append(postSelect);
+ id = DB.getSQLValueEx(trxName, selectId.toString(), value, Env.getAD_Client_ID(Env.getCtx()));
+ } else if (count > 1) { // multiple values found, error ForeignMultipleResolved
+ id = -2;
+ } else if (count == 0) { // no values found, error ForeignNotResolved
+ id = -3;
+ }
+
return id;
}
diff --git a/org.adempiere.base/src/org/adempiere/process/MatchInvReverse.java b/org.adempiere.base/src/org/adempiere/process/MatchInvReverse.java
index 4f37c0882a..6f25c9cf7d 100644
--- a/org.adempiere.base/src/org/adempiere/process/MatchInvReverse.java
+++ b/org.adempiere.base/src/org/adempiere/process/MatchInvReverse.java
@@ -48,7 +48,7 @@ public class MatchInvReverse extends SvrProcess {
if (inv.get_ID() != p_M_MatchInv_ID)
throw new AdempiereException("@NotFound@ @M_MatchInv_ID@ " + p_M_MatchInv_ID);
- if (inv.isPosted())
+ if (inv.isProcessed())
{
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
if (reversalDate == null) {
diff --git a/org.adempiere.base/src/org/adempiere/process/MatchPOReverse.java b/org.adempiere.base/src/org/adempiere/process/MatchPOReverse.java
index 338207de28..e46b4c028f 100644
--- a/org.adempiere.base/src/org/adempiere/process/MatchPOReverse.java
+++ b/org.adempiere.base/src/org/adempiere/process/MatchPOReverse.java
@@ -46,7 +46,7 @@ public class MatchPOReverse extends SvrProcess {
MMatchPO po = new MMatchPO (getCtx(), p_M_MatchPO_ID, get_TrxName());
if (po.get_ID() != p_M_MatchPO_ID)
throw new AdempiereException("@NotFound@ @M_MatchPO_ID@ " + p_M_MatchPO_ID);
- if (po.isPosted())
+ if (po.isProcessed())
{
Timestamp reversalDate = Env.getContextAsDate(getCtx(), "#Date");
if (reversalDate == null) {
diff --git a/org.adempiere.base/src/org/adempiere/util/LogAuthFailure.java b/org.adempiere.base/src/org/adempiere/util/LogAuthFailure.java
index 9623de84db..a7b93aeefa 100644
--- a/org.adempiere.base/src/org/adempiere/util/LogAuthFailure.java
+++ b/org.adempiere.base/src/org/adempiere/util/LogAuthFailure.java
@@ -35,13 +35,14 @@ public class LogAuthFailure {
private static FileOutputStream file = null;
private static Writer writer;
+ public static String authFailureFilename = "AuthFailure.log";
/** Logger */
private static CLogger log = CLogger.getCLogger(LogAuthFailure.class);
public LogAuthFailure() {
String path = Ini.getAdempiereHome() + File.separator + "log";
- String name = path + File.separator + "AuthFailure.log";
+ String name = path + File.separator + authFailureFilename;
File fileName;
try {
fileName = new File(name);
diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java
index cc1fb87121..237771dcaf 100644
--- a/org.adempiere.base/src/org/compiere/model/GridField.java
+++ b/org.adempiere.base/src/org/compiere/model/GridField.java
@@ -605,6 +605,10 @@ public class GridField
public Object getDefault(ParseSeq seqGetDefaultValue){
Object defaultValue = null;
for (Character seqType : seqGetDefaultValue){
+ if ( seqType == '3' // default from Expression
+ && m_vo.DefaultValue != null
+ && m_vo.DefaultValue.toUpperCase().equals("NULL")) // IDEMPIERE-2678
+ return null;
defaultValue = getDefaultValueByType(seqType);
if (defaultValue != null)
return defaultValue;
diff --git a/org.adempiere.base/src/org/compiere/model/MAcctSchema.java b/org.adempiere.base/src/org/compiere/model/MAcctSchema.java
index 7b13c0138c..5f2b3b2ce7 100644
--- a/org.adempiere.base/src/org/compiere/model/MAcctSchema.java
+++ b/org.adempiere.base/src/org/compiere/model/MAcctSchema.java
@@ -39,8 +39,7 @@ public class MAcctSchema extends X_C_AcctSchema
/**
*
*/
- private static final long serialVersionUID = -7228171623905614596L;
-
+ private static final long serialVersionUID = 8940388112876468770L;
/**
* Get AccountSchema of Client
@@ -201,8 +200,6 @@ public class MAcctSchema extends X_C_AcctSchema
} // MAcctSchema
- /** Element List */
- private MAcctSchemaElement[] m_elements = null;
/** GL Info */
private MAcctSchemaGL m_gl = null;
/** Default Info */
@@ -228,9 +225,7 @@ public class MAcctSchema extends X_C_AcctSchema
*/
public MAcctSchemaElement[] getAcctSchemaElements()
{
- if (m_elements == null)
- m_elements = MAcctSchemaElement.getAcctSchemaElements(this);
- return m_elements;
+ return MAcctSchemaElement.getAcctSchemaElements(this);
} // getAcctSchemaElements
/**
@@ -240,11 +235,8 @@ public class MAcctSchema extends X_C_AcctSchema
*/
public MAcctSchemaElement getAcctSchemaElement (String elementType)
{
- if (m_elements == null)
- getAcctSchemaElements();
- for (int i = 0; i < m_elements.length; i++)
- {
- MAcctSchemaElement ase = m_elements[i];
+ /** Element List */
+ for (MAcctSchemaElement ase : getAcctSchemaElements()) {
if (ase.getElementType().equals(elementType))
return ase;
}
diff --git a/org.adempiere.base/src/org/compiere/model/MInvoicePaySchedule.java b/org.adempiere.base/src/org/compiere/model/MInvoicePaySchedule.java
index d50d3ac3e9..72d58110d5 100644
--- a/org.adempiere.base/src/org/compiere/model/MInvoicePaySchedule.java
+++ b/org.adempiere.base/src/org/compiere/model/MInvoicePaySchedule.java
@@ -40,7 +40,7 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
/**
*
*/
- private static final long serialVersionUID = -1529278048406862670L;
+ private static final long serialVersionUID = 4613382619117842586L;
/**
* Get Payment Schedule of the invoice
@@ -229,7 +229,7 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
{
if (!success)
return success;
- if (is_ValueChanged("DueAmt"))
+ if (is_ValueChanged("DueAmt") || is_ValueChanged("IsActive"))
{
log.fine("afterSave");
getParent();
@@ -239,5 +239,15 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
return success;
} // afterSave
-
+ @Override
+ protected boolean afterDelete(boolean success) {
+ if (!success)
+ return success;
+ log.fine("afterDelete");
+ getParent();
+ m_parent.validatePaySchedule();
+ m_parent.saveEx();
+ return success;
+ }
+
} // MInvoicePaySchedule
diff --git a/org.adempiere.base/src/org/compiere/model/MMatchInv.java b/org.adempiere.base/src/org/compiere/model/MMatchInv.java
index 476b53a84d..12c272e775 100644
--- a/org.adempiere.base/src/org/compiere/model/MMatchInv.java
+++ b/org.adempiere.base/src/org/compiere/model/MMatchInv.java
@@ -366,7 +366,7 @@ public class MMatchInv extends X_M_MatchInv
*/
public boolean reverse(Timestamp reversalDate)
{
- if (this.isPosted() && this.getReversal_ID() == 0)
+ if (this.isProcessed() && this.getReversal_ID() == 0)
{
MMatchInv reversal = new MMatchInv (getCtx(), 0, get_TrxName());
PO.copyValues(this, reversal);
diff --git a/org.adempiere.base/src/org/compiere/model/MOrderPaySchedule.java b/org.adempiere.base/src/org/compiere/model/MOrderPaySchedule.java
index e5d85adf9d..ad9d8c3bec 100644
--- a/org.adempiere.base/src/org/compiere/model/MOrderPaySchedule.java
+++ b/org.adempiere.base/src/org/compiere/model/MOrderPaySchedule.java
@@ -40,7 +40,7 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
/**
*
*/
- private static final long serialVersionUID = -5506706349428999742L;
+ private static final long serialVersionUID = 2158181283878369676L;
/**
* Get Payment Schedule of the Order
@@ -229,7 +229,7 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
{
if (!success)
return success;
- if (is_ValueChanged("DueAmt"))
+ if (is_ValueChanged("DueAmt") || is_ValueChanged("IsActive"))
{
log.fine("afterSave");
getParent();
@@ -239,5 +239,15 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
return success;
} // afterSave
-
+ @Override
+ protected boolean afterDelete(boolean success) {
+ if (!success)
+ return success;
+ log.fine("afterDelete");
+ getParent();
+ m_parent.validatePaySchedule();
+ m_parent.saveEx();
+ return success;
+ }
+
} // MOrderPaySchedule
diff --git a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java
index 115c00ade5..f705516bac 100644
--- a/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java
+++ b/org.adempiere.base/src/org/eevolution/process/ImportInventoryMove.java
@@ -391,7 +391,7 @@ public class ImportInventoryMove extends SvrProcess
*/
private int getID(String tableName, String whereClause, Object[] values)
{
- return new Query(getCtx(),tableName,whereClause,get_TrxName())
+ return new Query(getCtx(),tableName,whereClause,get_TrxName()).setClient_ID()
.setParameters(values).firstId();
}
diff --git a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java
index 696d2b224d..62b08b662f 100644
--- a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java
+++ b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java
@@ -426,7 +426,7 @@ public class GLJournalGenerate extends SvrProcess
j.setDateDoc(p_DateAcct);
j.setDescription(journalGenerator.getDescription());
j.setDocumentNo(p_DocumentNo);
- j.setGL_Category_ID(journalGenerator.getGL_Category_ID());
+ j.set_ValueOfColumn("GL_Category_ID", journalGenerator.getGL_Category_ID()); // can be zero
j.setPostingType(journalGenerator.getPostingType());
j.setC_AcctSchema_ID(as.getC_AcctSchema_ID());
j.setC_ConversionType_ID(MConversionType.getDefault(as.getAD_Client_ID()));
diff --git a/org.adempiere.server/WEB-INF/web.xml b/org.adempiere.server/WEB-INF/web.xml
index a119f82681..987126a825 100644
--- a/org.adempiere.server/WEB-INF/web.xml
+++ b/org.adempiere.server/WEB-INF/web.xml
@@ -9,6 +9,10 @@
ServerRoot
1
+
+ org.eclipse.jetty.servlet.SessionCookie
+ ROOT_SESSIONID
+
iDempiere Monitor Filter
idempiereMonitorFilter
diff --git a/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java b/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java
index b48c4218e7..50dfcd4a05 100644
--- a/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java
+++ b/org.adempiere.server/src/main/servlet/org/compiere/web/AdempiereMonitor.java
@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.adempiere.util.LogAuthFailure;
import org.apache.ecs.HtmlColor;
import org.apache.ecs.xhtml.a;
import org.apache.ecs.xhtml.b;
@@ -382,6 +383,8 @@ public class AdempiereMonitor extends HttpServlet
String fileName = logs[i].getAbsolutePath();
if (fileName.equals(fileHandler.getFileName()))
continue;
+ if (fileName.endsWith(LogAuthFailure.authFailureFilename)) // Do not delete login failure
+ continue;
if (logs[i].delete())
log.warning("Deleted: " + fileName);
else
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java
index 428a232c55..cc44e13d51 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java
@@ -302,7 +302,8 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
//sameWarehouseCb
else if (e.getTarget().equals(sameWarehouseCb))
{
- initBPOrderDetails(((Integer)bPartnerField.getValue()).intValue(), false);
+ int bpId = bPartnerField.getValue() == null?0:((Integer)bPartnerField.getValue()).intValue();
+ initBPOrderDetails(bpId, false);
}
else if (e.getTarget().equals(upcField.getComponent()))
{
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java
index 819d54e5dd..231d2bb74a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java
@@ -1211,7 +1211,11 @@ public final class WAccountDialog extends Window
*/
public void valueChange(ValueChangeEvent evt) {
Object newValue = evt.getNewValue();
- if (newValue instanceof Integer)
+ if (newValue instanceof Integer) {
Env.setContext(Env.getCtx(), m_WindowNo, "Account_ID", ((Integer)newValue).intValue());
+ if (f_SubAcct_ID != null) {
+ f_SubAcct_ID.dynamicDisplay();
+ }
+ }
}
} // WAccountDialog
diff --git a/org.adempiere.ui.zk/WEB-INF/web.xml b/org.adempiere.ui.zk/WEB-INF/web.xml
index 956e8af021..712bf901c1 100644
--- a/org.adempiere.ui.zk/WEB-INF/web.xml
+++ b/org.adempiere.ui.zk/WEB-INF/web.xml
@@ -4,6 +4,10 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
iDempiere Web Client
+
+ org.eclipse.jetty.servlet.SessionCookie
+ WEBUI_SESSIONID
+
AtmosphereServlet
org.atmosphere.cpr.AtmosphereServlet