From fd0dfcce1c1218a03ef48a3fc05dc3a880bc0c9b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 26 Mar 2024 13:59:22 +0700 Subject: add product category parent id in product data warehouse --- import_product_product.ktr | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'import_product_product.ktr') 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 @@ erp indoteknik production (localhost) 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) @@ -892,6 +899,11 @@ where pp.write_date >= (now() - '5 days'::interval) weight Y + + parent_category_id + parent_category_id + Y + -- cgit v1.2.3