summaryrefslogtreecommitdiff
path: root/import_product_product.ktr
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-03-26 13:59:22 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-03-26 13:59:22 +0700
commitfd0dfcce1c1218a03ef48a3fc05dc3a880bc0c9b (patch)
treef7f3141bf1d318a4a61dd5af5808de944fddd4c2 /import_product_product.ktr
parent22188a7899a54b48142e9ab45c1a31b3c0290a1f (diff)
add product category parent id in product data warehouse
Diffstat (limited to 'import_product_product.ktr')
-rw-r--r--import_product_product.ktr18
1 files changed, 15 insertions, 3 deletions
diff --git a/import_product_product.ktr b/import_product_product.ktr
index 0942694..afdc987 100644
--- a/import_product_product.ktr
+++ b/import_product_product.ktr
@@ -558,12 +558,19 @@
<connection>erp indoteknik production (localhost)</connection>
<sql>select pp.id as product_id, pt.id as template_id, pt.name, pp.active::boolean, pt.x_manufacture as brand_id,
case when pp.default_code is null then pt.default_code else pp.default_code end as item_code,
-(select name from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category
+(
+ select name from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category
where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr
- where ppcptr.product_template_id = pt.id limit 1)))) as parent_category,
+ where ppcptr.product_template_id = pt.id limit 1)))
+) as parent_category,
(select store_fname from ir_attachment ia where ia.res_model='product.template' and res_field='image_1920' and ia.res_id=pt.id) as image,
pt.website_description as description,
-pt.weight
+pt.weight,
+(
+ select ppc.id from product_public_category ppc where id in((select replace(left(parent_path, 2), '/', '')::int from product_public_category
+ where id in(select ppcptr.product_public_category_id from product_public_category_product_template_rel ppcptr
+ where ppcptr.product_template_id = pt.id limit 1)))
+) as parent_category_id
from product_product pp
join product_template pt on pt.id = pp.product_tmpl_id
where pp.write_date >= (now() - '5 days'::interval)</sql>
@@ -892,6 +899,11 @@ where pp.write_date >= (now() - '5 days'::interval)</sql>
<rename>weight</rename>
<update>Y</update>
</value>
+ <value>
+ <name>parent_category_id</name>
+ <rename>parent_category_id</rename>
+ <update>Y</update>
+ </value>
</lookup>
<attributes/>
<cluster_schema/>