summaryrefslogtreecommitdiff
path: root/import_odoo_14_to_data_warehouse.ktr
diff options
context:
space:
mode:
Diffstat (limited to 'import_odoo_14_to_data_warehouse.ktr')
-rw-r--r--import_odoo_14_to_data_warehouse.ktr83
1 files changed, 30 insertions, 53 deletions
diff --git a/import_odoo_14_to_data_warehouse.ktr b/import_odoo_14_to_data_warehouse.ktr
index 3791db9..cf3cc07 100644
--- a/import_odoo_14_to_data_warehouse.ktr
+++ b/import_odoo_14_to_data_warehouse.ktr
@@ -486,57 +486,6 @@
</attribute>
</attributes>
</connection>
- <connection>
- <name>erp indoteknik production (localhost)</name>
- <server>10.148.0.3</server>
- <type>POSTGRESQL</type>
- <access>Native</access>
- <database>erp_indoteknik</database>
- <port>5432</port>
- <username>odoo</username>
- <password>Encrypted 2be98afc82bdfd8dd9a2ca45acc83f6c3</password>
- <servername/>
- <data_tablespace/>
- <index_tablespace/>
- <attributes>
- <attribute>
- <code>FORCE_IDENTIFIERS_TO_LOWERCASE</code>
- <attribute>N</attribute>
- </attribute>
- <attribute>
- <code>FORCE_IDENTIFIERS_TO_UPPERCASE</code>
- <attribute>N</attribute>
- </attribute>
- <attribute>
- <code>IS_CLUSTERED</code>
- <attribute>N</attribute>
- </attribute>
- <attribute>
- <code>PORT_NUMBER</code>
- <attribute>5432</attribute>
- </attribute>
- <attribute>
- <code>PRESERVE_RESERVED_WORD_CASE</code>
- <attribute>Y</attribute>
- </attribute>
- <attribute>
- <code>QUOTE_ALL_FIELDS</code>
- <attribute>N</attribute>
- </attribute>
- <attribute>
- <code>SUPPORTS_BOOLEAN_DATA_TYPE</code>
- <attribute>Y</attribute>
- </attribute>
- <attribute>
- <code>SUPPORTS_TIMESTAMP_DATA_TYPE</code>
- <attribute>N</attribute>
- </attribute>
- <attribute>
- <code>USE_POOLING</code>
- <attribute>N</attribute>
- </attribute>
- </attributes>
- </connection>
<order>
<hop>
<from>Table input</from>
@@ -771,8 +720,36 @@
<method>none</method>
<schema_name/>
</partitioning>
- <connection>erp indoteknik production (localhost)</connection>
- <sql>select * from v_total_omzet_by_invoice</sql>
+ <connection>dw bi indoteknik (localhost)</connection>
+ <sql>SELECT m.name AS invoice,
+ i.name AS industry,
+ ( SELECT rpp.name
+ FROM res_partner rpp
+ JOIN res_users ru ON ru.partner_id = rpp.id
+ WHERE ru.id = m.invoice_user_id) AS salesperson,
+ m.invoice_date,
+ to_char(m.invoice_date::timestamp with time zone, 'YYYY-MM'::text) AS year_month_invoice_date,
+ to_char(m.invoice_date::timestamp with time zone, 'YYYY'::text) AS year,
+ to_char(m.invoice_date::timestamp with time zone, 'MM'::text) AS month,
+ mf.name AS brand,
+ p.name AS product,
+ p.item_code,
+ ml.quantity,
+ ml.price_unit,
+ ml.price_subtotal,
+ ml.price_total,
+ rp.name AS customer,
+ rp.id AS partner_id,
+ get_quarter(to_char(m.invoice_date::timestamp with time zone, 'MM'::text)::character varying) AS quarter,
+ ml.id AS account_move_line_id
+ FROM account_move m
+ JOIN res_partner rp ON rp.id = m.partner_id
+ JOIN account_move_line ml ON ml.move_id = m.id
+ JOIN product p ON p.product_id = ml.product_id
+ LEFT JOIN brand mf ON mf.id = p.brand_id
+ LEFT JOIN res_partner_industry i ON i.id = rp.industry_id
+ WHERE m.move_type::text = 'out_invoice'::text AND m.state::text = 'posted'::text
+ AND ml.write_date >= (now() - '15 days'::interval)</sql>
<limit>0</limit>
<lookup/>
<execute_each_row>N</execute_each_row>